Clingo
Loading...
Searching...
No Matches
Clingo::Model Class Reference

Class to provide an mutable view of a model. More...

#include <solve.hh>

Inheritance diagram for Clingo::Model:
Clingo::ConstModel

Public Member Functions

 Model (clingo_model_t *mdl)
 Constructor from the underlying C representation.
 
auto control () const -> SolveControl
 Get the associated solve control object.
 
void extend (SymbolSpan symbols) const
 Extend the model with additional symbols.
 
- Public Member Functions inherited from Clingo::ConstModel
 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 (Model const &x) -> clingo_model_t *
 Cast the model to its C representation.
 

Detailed Description

Class to provide an mutable view of a model.

The model can be extended by theory symbols or clauses added to the running search.

Constructor & Destructor Documentation

◆ Model()

Clingo::Model::Model ( clingo_model_t mdl)
inlineexplicit

Constructor from the underlying C representation.

Parameters
mdlthe C representation of the model

Member Function Documentation

◆ control()

auto Clingo::Model::control ( ) const -> SolveControl
inline

Get the associated solve control object.

Returns
the solve control object

◆ extend()

void Clingo::Model::extend ( SymbolSpan  symbols) const
inline

Extend the model with additional symbols.

Parameters
symbolsthe symbols to extend the model with

Friends And Related Symbol Documentation

◆ c_cast

auto c_cast ( Model const x) -> clingo_model_t *
friend

Cast the model to its C representation.

Parameters
xthe model to cast
Returns
the C representation of the model

The documentation for this class was generated from the following file: