31 template<
typename Rational,
typename Poly>
41 template<
typename Rational,
typename Poly>
44 template<
typename Rational,
typename Poly>
56 template<
typename Rational,
typename Poly>
59 template<
typename Rational,
typename Poly>
61 template<
typename Rational,
typename Poly>
63 template<
typename Rational,
typename Poly>
65 template<
typename Rational,
typename Poly>
68 template<
typename Rational,
typename Poly>
71 template<
typename Rational,
typename Poly>
74 for (
const auto& var : vars) {
75 if (model.
find(var) == model.
end())
return std::nullopt;
76 if (model.
at(var).isRational()) {
77 result.emplace(var,
typename Poly::RootType(model.
at(var).asRational()));
78 }
else if (model.
at(var).isRAN()) {
79 result.emplace(var, model.
at(var).asRAN());
87 template<
typename Rational,
typename Poly>
90 for (
const auto& e : model) {
91 if (e.second.isRational()) {
92 assert(e.first.is_variable());
93 result.emplace(e.first.asVariable(),
typename Poly::RootType(e.second.asRational()));
94 }
else if (e.second.isRAN()) {
95 assert(e.first.is_variable());
96 result.emplace(e.first.asVariable(), e.second.asRAN());
Represent a real algebraic number (RAN) in one of several ways:
carl is the main namespace for the library.
std::optional< Assignment< typename Poly::RootType > > get_ran_assignment(const carlVariables &vars, const Model< Rational, Poly > &model)
bool getRationalAssignmentsFromModel(const Model< Rational, Poly > &_model, std::map< Variable, Rational > &_rationalAssigns)
Obtains all assignments which can be transformed to rationals and stores them in the passed map.
Formula< Poly > representingFormula(const ModelVariable &mv, const Model< Rational, Poly > &model)
bool isPartOf(const std::map< Variable, Rational > &_assignment, const Model< Rational, Poly > &_model)
unsigned satisfies(const Model< Rational, Poly > &_assignment, const Formula< Poly > &_formula)
std::map< Variable, T > Assignment
void getDefaultModel(Model< Rational, Poly > &_defaultModel, const UEquality &_constraint, bool _overwrite=true, size_t _seed=0)
Represent a polynomial (in)equality against zero.
Represent a collection of assignments/mappings from variables to values.
auto find(const typename Map::key_type &key) const
const auto & at(const key_type &key) const
Represent a sum type/variant over the different kinds of variables that exist in CARL to use them in ...
Implements an uninterpreted equality, that is an equality of either two uninterpreted function instan...