pub struct GenericSolveHandle<C: ControlCtx, E: SolveEventHandler> { /* private fields */ }Expand description
Search handle to a solve call.
Implementations§
Source§impl<C: ControlCtx, E: SolveEventHandler> GenericSolveHandle<C, E>
impl<C: ControlCtx, E: SolveEventHandler> GenericSolveHandle<C, E>
Sourcepub fn get(&mut self) -> Result<SolveResult, ClingoError>
pub fn get(&mut self) -> Result<SolveResult, ClingoError>
Get the next solve result.
Blocks until the result is ready. When yielding partial solve results can be obtained, i.e., when a model is ready, the result will be satisfiable but neither the search exhausted nor the optimality proven.
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif solving fails
Sourcepub fn wait(&mut self, timeout: Duration) -> bool
pub fn wait(&mut self, timeout: Duration) -> bool
Wait for the specified amount of time to check if the next result is ready.
If the time is set to zero, this function can be used to poll if the search is still active. If the time is negative, the function blocks until the search is finished.
§Arguments
timeout- the maximum time to wait
Sourcepub fn model(&mut self) -> Result<Option<&Model>, ClingoError>
pub fn model(&mut self) -> Result<Option<&Model>, ClingoError>
Get the next model or None if there are no more models.
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif solving fails
Sourcepub fn model_mut(&mut self) -> Result<Option<&mut Model>, ClingoError>
pub fn model_mut(&mut self) -> Result<Option<&mut Model>, ClingoError>
Get the next model or None if there are no more models.
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif solving fails
Sourcepub fn core(&mut self) -> Result<Vec<SolverLiteral>, ClingoError>
pub fn core(&mut self) -> Result<Vec<SolverLiteral>, ClingoError>
When a problem is unsatisfiable, get a subset of the assumptions that made the problem unsatisfiable.
If the program is not unsatisfiable, an empty vector is returned.
Returns the unsatisfiable core
§Errors
Sourcepub fn resume(&mut self) -> Result<(), ClingoError>
pub fn resume(&mut self) -> Result<(), ClingoError>
Discards the last model and starts the search for the next one.
If the search has been started asynchronously, this function continues the search in the background.
Note: This function does not block.
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif solving fails
Sourcepub fn cancel(&mut self) -> Result<(), ClingoError>
pub fn cancel(&mut self) -> Result<(), ClingoError>
Stop the running search and block until done.
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif solving fails
Sourcepub fn close(self) -> Result<GenericControl<C>, ClingoError>
pub fn close(self) -> Result<GenericControl<C>, ClingoError>
Stops the running search and releases the handle.
Blocks until the search is stopped (as if an implicit cancel was called before the handle is released).
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif solving fails