pub struct Model(/* private fields */);Expand description
Represents a model.
Implementations§
Source§impl Model
impl Model
Sourcepub fn model_type(&self) -> Result<ModelType, ClingoError>
pub fn model_type(&self) -> Result<ModelType, ClingoError>
Get the type of the model.
Sourcepub fn number(&self) -> Result<u64, ClingoError>
pub fn number(&self) -> Result<u64, ClingoError>
Get the running number of the model.
Sourcepub fn symbols(&self, show: ShowType) -> Result<Vec<Symbol>, ClingoError>
pub fn symbols(&self, show: ShowType) -> Result<Vec<Symbol>, ClingoError>
Get the symbols of the selected types in the model.
Note: CSP assignments are represented using functions with name “$” where the first argument is the name of the CSP variable and the second one its value.
§Arguments
show- which symbols to select
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif the size is too small
Sourcepub fn is_true(&self, literal: SolverLiteral) -> Result<bool, ClingoError>
pub fn is_true(&self, literal: SolverLiteral) -> Result<bool, ClingoError>
Sourcepub fn cost(&self) -> Result<Vec<i64>, ClingoError>
pub fn cost(&self) -> Result<Vec<i64>, ClingoError>
Get the cost vector of a model.
§Errors
ClingoError::InternalErrorwithErrorCode::BadAllocorErrorCode::Runtimeif the size is too small
Sourcepub fn optimality_proven(&self) -> Result<bool, ClingoError>
pub fn optimality_proven(&self) -> Result<bool, ClingoError>
Whether the optimality of a model has been proven.
See: Model::cost()
Sourcepub fn thread_id(&self) -> Result<Id, ClingoError>
pub fn thread_id(&self) -> Result<Id, ClingoError>
Get the id of the solver thread that found the model.
Sourcepub fn extend(&mut self, symbols: &[Symbol]) -> bool
pub fn extend(&mut self, symbols: &[Symbol]) -> bool
Add symbols to the model.
These symbols will appear in clingo's output, which means that this function is only meaningful if there is an underlying clingo application. Only models passed to the ::clingo_solve_event_callback_t are extendable.
§Arguments
symbols- the symbols to add
Returns whether the call was successful
Sourcepub fn context(&self) -> Result<&mut SolveControl, ClingoError>
pub fn context(&self) -> Result<&mut SolveControl, ClingoError>
Get the associated solve control object of a model.
This object allows for adding clauses during model enumeration.