|
|
delpi
0.0.1
DElta-complete LP solver
|
Represents a symbolic form of an expression. More...
#include <Expression.h>
Public Member Functions | |
| template<MapFromTo< Variable, mpq_class > T> | |
| mpq_class | Evaluate (const T &env={}) const |
| Evaluates using a given environment (by default, an empty environment). | |
| Expression | Substitute (const SubstitutionMap &s) const |
| Create a copy of this expression, replacing all occurrences of the variables in s with corresponding expressions in s. | |
| Expression & | Add (const Variable &var, const mpq_class &coeff) |
| Add a linear monomial \( c \cdot x \), where \( c \) is a constant and \( x \) is a Variable, to the current expression. | |
| Expression & | Subtract (const Variable &var, const mpq_class &coeff) |
| Subtract a linear monomial \( c \cdot x \), where \( c \) is a constant and \( x \) is a Variable, to the current expression. | |
| std::ostream & | Print (std::ostream &os) const |
| Print a string representation of this class to the provided os. | |
Private Attributes | |
| intrusive_ptr< ExpressionCell > | ptr_ |
| Internal pointer to the ExpressionCell. | |
Represents a symbolic form of an expression.
Its syntax tree is as follows:
To check structural equality between two expressions use Expression::equal_to.
Definition at line 37 of file Expression.h.
| Expression & delpi::Expression::Add | ( | const Variable & | var, |
| const mpq_class & | coeff ) |
Add a linear monomial \( c \cdot x \), where \( c \) is a constant and \( x \) is a Variable, to the current expression.
| var | variable of the linear monomial |
| coeff | coefficient of the linear monomial |
Definition at line 76 of file Expression.cpp.
|
nodiscard |
Evaluates using a given environment (by default, an empty environment).
| T | map from variable to value (i.e. std::map<Variable, mpq_class>, std::unordered_map<Variable, mpq_class>) |
| env | map between each variable and its value |
| std::exception | if there exists variable in this expression whose assignment is not provided by env |
Definition at line 45 of file Expression.cpp.
| std::ostream & delpi::Expression::Print | ( | std::ostream & | os | ) | const |
Print a string representation of this class to the provided os.
It is an alternative to the more standard operator<<.
| os | output stream |
Definition at line 50 of file Expression.cpp.
|
nodiscard |
Create a copy of this expression, replacing all occurrences of the variables in s with corresponding expressions in s.
Note that the substitutions occur simultaneously.
| s | map of substitutions. Maps the old variable to the new one. |
Definition at line 48 of file Expression.cpp.
| Expression & delpi::Expression::Subtract | ( | const Variable & | var, |
| const mpq_class & | coeff ) |
Subtract a linear monomial \( c \cdot x \), where \( c \) is a constant and \( x \) is a Variable, to the current expression.
| var | variable of the linear monomial |
| coeff | coefficient of the linear monomial |
Definition at line 84 of file Expression.cpp.