10 std::optional<LPRealAlgebraicNumber>
evaluate(
11 const LPPolynomial& polynomial,
12 const std::map<Variable, LPRealAlgebraicNumber>& evalMap) {
13 lp_assignment_t& assignment = LPAssignment::getInstance().get(evalMap);
14 auto result = lp_polynomial_evaluate(polynomial.get_internal(), &assignment);
16 if (result->type == LP_VALUE_NONE) {
21 auto ran = LPRealAlgebraicNumber(std::move(*result));
46 boost::tribool
evaluate(
const BasicConstraint<LPPolynomial>& constraint,
const std::map<Variable, LPRealAlgebraicNumber>& evalMap) {
47 CARL_LOG_DEBUG(
"carl.ran.libpoly",
" Evaluation constraint " << constraint <<
" for assignment " << evalMap);
50 return carl::evaluate(constraint.lhs().constant_part(), constraint.relation());
53 auto poly_pol = constraint.lhs().get_internal();
54 lp_assignment_t& assignment = LPAssignment::getInstance().get(evalMap);
57 if (evalMap.find(v) == evalMap.end()) {
58 int result = lp_polynomial_constraint_evaluate_subs(poly_pol, lp_sign(constraint.relation()), &assignment);
59 if (result == -1)
return boost::indeterminate;
64 return lp_polynomial_constraint_evaluate(poly_pol, lp_sign(constraint.relation()), &assignment);
#define CARL_LOG_DEBUG(channel, msg)
carl is the main namespace for the library.
bool is_constant(const ContextPolynomial< Coeff, Ordering, Policies > &p)
bool evaluate(const BasicConstraint< Poly > &c, const Assignment< Number > &m)
void variables(const BasicConstraint< Pol > &c, carlVariables &vars)