carl  24.04
Computer ARithmetic Library
Evaluation.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/logic/tribool.hpp>
5 #include "Interval.h"
6 
7 namespace carl {
8 
9 template<typename Number>
10 inline boost::tribool evaluate(Interval<Number> interval, Relation relation) {
11  if (interval.is_positive()) {
12  return evaluate(Sign::POSITIVE, relation);
13  } else if (interval.is_negative()) {
14  return evaluate(Sign::NEGATIVE, relation);
15  } else if (interval.is_zero()) {
16  return evaluate(Sign::ZERO, relation);
17  } else if (interval.is_semi_negative()) {
18  if (relation == Relation::GREATER) {
19  return false;
20  } else if (relation == Relation::LEQ) {
21  return true;
22  }
23  } else if (interval.is_semi_positive()) {
24  if (relation == Relation::LESS) {
25  return false;
26  } else if (relation == Relation::GEQ) {
27  return true;
28  }
29  }
30  return boost::indeterminate;
31 }
32 
33 }
carl is the main namespace for the library.
@ NEGATIVE
Indicates that .
@ ZERO
Indicates that .
@ POSITIVE
Indicates that .
bool evaluate(const BasicConstraint< Poly > &c, const Assignment< Number > &m)
Definition: Evaluation.h:10
@ GREATER
Definition: SignCondition.h:15
Relation
Definition: Relation.h:20
The class which contains the interval arithmetic including trigonometric functions.
Definition: Interval.h:134
bool is_negative() const
Definition: Interval.h:1133
bool is_semi_positive() const
Definition: Interval.h:1146
bool is_semi_negative() const
Definition: Interval.h:1157
bool is_positive() const
Definition: Interval.h:1120
bool is_zero() const
Function which determines, if the interval is the zero interval.
Definition: Interval.h:1101