Clingo
|
Class to provide an immutable view of a model. More...
#include <solve.hh>
Public Member Functions | |
ConstModel (clingo_model_t const *mdl) | |
Constructor from the underlying C representation. | |
auto | symbols (ShowFlags flags=ShowFlags::shown) const -> SymbolVector |
Get the symbols of the model. | |
auto | contains (Symbol const &atom) const -> bool |
Check if the model contains a specific atom. | |
auto | type () const -> ModelType |
Get the type of the model. | |
auto | number () const -> uint64_t |
Get the running number of the model. | |
auto | is_true (ProgramLiteral lit) const -> bool |
Check whether the given literal is true in the model. | |
auto | is_consequence (ProgramLiteral lit) const -> std::optional< bool > |
Check whether the given literal is consequence of the model. | |
auto | cost () const -> SumSpan |
Get the cost of the model. | |
auto | priorities () const -> WeightSpan |
Get the priorities of the costs of a model. | |
auto | optimality_proven () const -> bool |
Check whether the model is proven to be optimal. | |
auto | thread_id () const -> ProgramId |
Get the thread id of the solver that found the model. | |
auto | to_string () const -> std::string |
Convert the model to a string representation. | |
Friends | |
auto | c_cast (ConstModel const &x) -> clingo_model_t const * |
Cast the model to its C representation. | |
Class to provide an immutable view of a model.
|
inlineexplicit |
Constructor from the underlying C representation.
For internal use.
mdl | the C representation of the model |
Check if the model contains a specific atom.
atom | the atom to check |
Get the cost of the model.
Each priority of a minimize constraint is associated with a cost.
|
inline |
Check whether the given literal is consequence of the model.
The function return std::nullopt if it is not known whether the literal is a consequence. Otherwise, it returns true if the literal is a consequence and false if it is not.
lit | the literal to check |
|
inline |
Check whether the given literal is true in the model.
lit | the literal to check |
Get the running number of the model.
Check whether the model is proven to be optimal.
Depending on the reasoning mode and the context the model is access, this function might return false even though the model is optimal.
|
inline |
Get the priorities of the costs of a model.
|
inline |
Get the symbols of the model.
flags | the flags to select which symbols to return |
Get the thread id of the solver that found the model.
|
inline |
Convert the model to a string representation.
Get the type of the model.
|
friend |
Cast the model to its C representation.
x | the model to cast |