carl  24.04
Computer ARithmetic Library
carl::Model< Rational, Poly > Class Template Reference

Represent a collection of assignments/mappings from variables to values. More...

#include <Model.h>

Collaboration diagram for carl::Model< Rational, Poly >:

Public Types

using key_type = ModelVariable
 
using mapped_type = ModelValue< Rational, Poly >
 
using Map = std::map< key_type, mapped_type >
 

Public Member Functions

const auto & at (const key_type &key) const
 
auto begin () const
 
auto end () const
 
auto empty () const
 
auto size () const
 
void clear ()
 
template<typename P >
auto insert (const P &pair)
 
template<typename P >
auto insert (typename Map::const_iterator it, const P &pair)
 
template<typename... Args>
auto emplace (const key_type &key, Args &&...args)
 
template<typename... Args>
auto emplace_hint (typename Map::const_iterator it, const key_type &key, Args &&...args)
 
Map::iterator erase (const ModelVariable &variable)
 
Map::iterator erase (const typename Map::iterator &it)
 
Map::iterator erase (const typename Map::const_iterator &it)
 
void clean ()
 
auto find (const typename Map::key_type &key) const
 
auto find (const typename Map::key_type &key)
 
 Model ()=default
 
 Model (const std::map< Variable, Rational > &assignment)
 
template<typename Container >
bool contains (const Container &c) const
 
template<typename T >
void assign (const typename Map::key_type &key, const T &t)
 
void update (const Model &model, bool disjoint=true)
 
const ModelValue< Rational, Poly > & evaluated (const typename Map::key_type &key) const
 Return the ModelValue for the given key, evaluated if it's a ModelSubstitution and evaluatable, otherwise return it raw. More...
 
void print (std::ostream &os, bool simple=true) const
 
void printOneline (std::ostream &os, bool simple=false) const
 

Private Member Functions

void resetCaches () const
 

Private Attributes

Map mData
 
std::map< key_type, std::size_t > mUsedInSubstitution
 

Detailed Description

template<typename Rational, typename Poly>
class carl::Model< Rational, Poly >

Represent a collection of assignments/mappings from variables to values.

We use a ModelVariable to abstract over the different kinds of variables in CARL, and a ModelValue to abstract over the different kinds of values for these variables. Most notably, a value can be a "carl::ModelSubstitution" whose value depends on the values of other variables in the Model.

Definition at line 19 of file Model.h.

Member Typedef Documentation

◆ key_type

template<typename Rational , typename Poly >
using carl::Model< Rational, Poly >::key_type = ModelVariable

Definition at line 21 of file Model.h.

◆ Map

template<typename Rational , typename Poly >
using carl::Model< Rational, Poly >::Map = std::map<key_type,mapped_type>

Definition at line 23 of file Model.h.

◆ mapped_type

template<typename Rational , typename Poly >
using carl::Model< Rational, Poly >::mapped_type = ModelValue<Rational,Poly>

Definition at line 22 of file Model.h.

Constructor & Destructor Documentation

◆ Model() [1/2]

template<typename Rational , typename Poly >
carl::Model< Rational, Poly >::Model ( )
default

◆ Model() [2/2]

template<typename Rational , typename Poly >
carl::Model< Rational, Poly >::Model ( const std::map< Variable, Rational > &  assignment)
inline

Definition at line 111 of file Model.h.

Member Function Documentation

◆ assign()

template<typename Rational , typename Poly >
template<typename T >
void carl::Model< Rational, Poly >::assign ( const typename Map::key_type &  key,
const T &  t 
)
inline

Definition at line 124 of file Model.h.

◆ at()

template<typename Rational , typename Poly >
const auto& carl::Model< Rational, Poly >::at ( const key_type key) const
inline

Definition at line 38 of file Model.h.

Here is the caller graph for this function:

◆ begin()

template<typename Rational , typename Poly >
auto carl::Model< Rational, Poly >::begin ( ) const
inline

Definition at line 43 of file Model.h.

◆ clean()

template<typename Rational , typename Poly >
void carl::Model< Rational, Poly >::clean ( )
inline

Definition at line 92 of file Model.h.

◆ clear()

template<typename Rational , typename Poly >
void carl::Model< Rational, Poly >::clear ( )
inline

Definition at line 57 of file Model.h.

◆ contains()

template<typename Rational , typename Poly >
template<typename Container >
bool carl::Model< Rational, Poly >::contains ( const Container &  c) const
inline

Definition at line 117 of file Model.h.

Here is the caller graph for this function:

◆ emplace()

template<typename Rational , typename Poly >
template<typename... Args>
auto carl::Model< Rational, Poly >::emplace ( const key_type key,
Args &&...  args 
)
inline

Definition at line 71 of file Model.h.

Here is the call graph for this function:

◆ emplace_hint()

template<typename Rational , typename Poly >
template<typename... Args>
auto carl::Model< Rational, Poly >::emplace_hint ( typename Map::const_iterator  it,
const key_type key,
Args &&...  args 
)
inline

Definition at line 76 of file Model.h.

Here is the call graph for this function:

◆ empty()

template<typename Rational , typename Poly >
auto carl::Model< Rational, Poly >::empty ( ) const
inline

Definition at line 50 of file Model.h.

◆ end()

template<typename Rational , typename Poly >
auto carl::Model< Rational, Poly >::end ( ) const
inline

Definition at line 46 of file Model.h.

Here is the caller graph for this function:

◆ erase() [1/3]

template<typename Rational , typename Poly >
Map::iterator carl::Model< Rational, Poly >::erase ( const ModelVariable variable)
inline

Definition at line 80 of file Model.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ erase() [2/3]

template<typename Rational , typename Poly >
Map::iterator carl::Model< Rational, Poly >::erase ( const typename Map::const_iterator &  it)
inline

Definition at line 88 of file Model.h.

◆ erase() [3/3]

template<typename Rational , typename Poly >
Map::iterator carl::Model< Rational, Poly >::erase ( const typename Map::iterator &  it)
inline

Definition at line 84 of file Model.h.

Here is the call graph for this function:

◆ evaluated()

template<typename Rational , typename Poly >
const ModelValue<Rational,Poly>& carl::Model< Rational, Poly >::evaluated ( const typename Map::key_type &  key) const
inline

Return the ModelValue for the given key, evaluated if it's a ModelSubstitution and evaluatable, otherwise return it raw.

Parameters
keyThe model must contain an assignment with the given key.

Definition at line 146 of file Model.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find() [1/2]

template<typename Rational , typename Poly >
auto carl::Model< Rational, Poly >::find ( const typename Map::key_type &  key)
inline

Definition at line 105 of file Model.h.

◆ find() [2/2]

template<typename Rational , typename Poly >
auto carl::Model< Rational, Poly >::find ( const typename Map::key_type &  key) const
inline

Definition at line 102 of file Model.h.

Here is the caller graph for this function:

◆ insert() [1/2]

template<typename Rational , typename Poly >
template<typename P >
auto carl::Model< Rational, Poly >::insert ( const P &  pair)
inline

Definition at line 61 of file Model.h.

Here is the call graph for this function:

◆ insert() [2/2]

template<typename Rational , typename Poly >
template<typename P >
auto carl::Model< Rational, Poly >::insert ( typename Map::const_iterator  it,
const P &  pair 
)
inline

Definition at line 66 of file Model.h.

Here is the call graph for this function:

◆ print()

template<typename Rational , typename Poly >
void carl::Model< Rational, Poly >::print ( std::ostream &  os,
bool  simple = true 
) const
inline

Definition at line 151 of file Model.h.

Here is the call graph for this function:

◆ printOneline()

template<typename Rational , typename Poly >
void carl::Model< Rational, Poly >::printOneline ( std::ostream &  os,
bool  simple = false 
) const
inline

Definition at line 175 of file Model.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetCaches()

template<typename Rational , typename Poly >
void carl::Model< Rational, Poly >::resetCaches ( ) const
inlineprivate

Definition at line 29 of file Model.h.

Here is the caller graph for this function:

◆ size()

template<typename Rational , typename Poly >
auto carl::Model< Rational, Poly >::size ( ) const
inline

Definition at line 53 of file Model.h.

◆ update()

template<typename Rational , typename Poly >
void carl::Model< Rational, Poly >::update ( const Model< Rational, Poly > &  model,
bool  disjoint = true 
)
inline

Definition at line 129 of file Model.h.

Field Documentation

◆ mData

template<typename Rational , typename Poly >
Map carl::Model< Rational, Poly >::mData
private

Definition at line 27 of file Model.h.

◆ mUsedInSubstitution

template<typename Rational , typename Poly >
std::map<key_type, std::size_t> carl::Model< Rational, Poly >::mUsedInSubstitution
private

Definition at line 28 of file Model.h.


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