16 template<
typename Number>
32 bool evaluated =
false;
34 for (
const auto& [var, ran] : m) {
36 static Number min_width = Number(1)/(Number(1048576));
37 while (!ran.is_numeric() && ran.interval().diameter() > min_width) {
42 if (ran.is_numeric()) {
43 evaluated |=
assign(var, ran,
false);
44 if (evaluated)
return true;
48 for (
const auto& [var, ran] : m) {
49 if (!ran.is_numeric()) {
50 evaluated |=
assign(var, ran,
false);
51 if (evaluated)
return true;
61 if (!
m_poly.has(var))
return false;
63 CARL_LOG_TRACE(
"carl.ran.interval",
"Assign " << var <<
" -> " << ran);
66 static Number min_width = Number(1)/(Number(1048576));
108 std::map<Variable, Interval<Number>> var_to_interval;
111 var_to_interval.emplace(var, ran.interval());
113 CARL_LOG_TRACE(
"carl.ran.interval",
"Got intervals " << var_to_interval);
114 assert(!var_to_interval.empty());
128 if (var_to_interval.find(var) == var_to_interval.end())
continue;
130 if (ran.is_numeric()) {
136 var_to_interval[var] = ran.interval();
#define CARL_LOG_TRACE(channel, msg)
MultivariatePolynomial< C, O, P > squareFreePart(const MultivariatePolynomial< C, O, P > &polynomial)
std::vector< UnivariatePolynomial< Coeff > > sturm_sequence(const UnivariatePolynomial< Coeff > &p, const UnivariatePolynomial< Coeff > &q)
Computes the sturm sequence of two polynomials.
int count_real_roots(const std::vector< UnivariatePolynomial< Coefficient >> &seq, const Interval< Coefficient > &i)
Calculate the number of real roots of a polynomial within a given interval based on a sturm sequence ...
bool is_zero(const Interval< Number > &i)
Check if this interval is a point-interval containing 0.
bool evaluate(const BasicConstraint< Poly > &c, const Assignment< Number > &m)
bool is_root_of(const UnivariatePolynomial< Coeff > &p, const Coeff &value)
UnivariatePolynomial< Coeff > replace_main_variable(const UnivariatePolynomial< Coeff > &p, Variable newVar)
Replaces the main variable in a polynomial.
Variable fresh_real_variable() noexcept
void variables(const BasicConstraint< Pol > &c, carlVariables &vars)
UnivariatePolynomial< Coeff > pseudo_remainder(const UnivariatePolynomial< Coeff > ÷nd, const UnivariatePolynomial< Coeff > &divisor)
Calculates the pseudo-remainder.
auto resultant(const ContextPolynomial< Coeff, Ordering, Policies > &p, const ContextPolynomial< Coeff, Ordering, Policies > &q)
UnivariatePolynomial< MultivariatePolynomial< typename UnderlyingNumberType< Coeff >::type > > switch_main_variable(const UnivariatePolynomial< Coeff > &p, Variable newVar)
Switches the main variable using a purely syntactical restructuring.
void substitute_inplace(MultivariateRoot< Poly > &mr, Variable var, const Poly &poly)
Create a copy of the underlying polynomial with the given variable replaced by the given polynomial.
A Variable represents an algebraic variable that can be used throughout carl.
The class which contains the interval arithmetic including trigonometric functions.
const Number & upper() const
The getter for the upper boundary of the interval.
const Number & lower() const
The getter for the lower boundary of the interval.
bool is_point_interval() const
Function which determines, if the interval is a pointinterval.
This class represents a univariate polynomial with coefficients of an arbitrary type.
bool is_constant() const
Check if the polynomial is constant.
const Coeff & constant_part() const
Retrieve the constant term of this polynomial or zero, if there is no constant term.
bool has(Variable v) const
const auto & value() const
const auto & interval() const
const auto & polynomial() const
std::map< Variable, const IntRepRealAlgebraicNumber< Number > & > m_ir_assignments
bool assign(const std::map< Variable, IntRepRealAlgebraicNumber< Number >> &m, bool refine_model=true)
MultivariatePolynomial< Number > m_original_poly
bool assign(Variable var, const IntRepRealAlgebraicNumber< Number > &ran, bool refine_model=true)
ran_evaluator(const MultivariatePolynomial< Number > &p)
UnivariatePolynomial< MultivariatePolynomial< Number > > m_poly