Struct Model

Source
pub struct Model(/* private fields */);
Expand description

Represents a model.

Implementations§

Source§

impl Model

Source

pub fn model_type(&self) -> Result<ModelType, ClingoError>

Get the type of the model.

Source

pub fn number(&self) -> Result<u64, ClingoError>

Get the running number of the model.

Source

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
Source

pub fn contains(&self, Symbol: Symbol) -> Result<bool, ClingoError>

Constant time lookup to test whether an atom is in a model.

§Arguments
  • atom - the atom to lookup
Source

pub fn is_true(&self, literal: SolverLiteral) -> Result<bool, ClingoError>

Check whether a program literal is true in a model.

§Arguments
  • literal - the literal to lookup
Source

pub fn cost(&self) -> Result<Vec<i64>, ClingoError>

Get the cost vector of a model.

§Errors

See: Model::optimality_proven()

Source

pub fn optimality_proven(&self) -> Result<bool, ClingoError>

Whether the optimality of a model has been proven.

See: Model::cost()

Source

pub fn thread_id(&self) -> Result<Id, ClingoError>

Get the id of the solver thread that found the model.

Source

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

Source

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.

Trait Implementations§

Source§

impl Debug for Model

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&mut Model> for *mut clingo_model

Source§

fn from(model: &mut Model) -> Self

Converts to this type from the input type.
Source§

impl From<Model> for clingo_model

Source§

fn from(model: Model) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnwindSafe for Model

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.