TempCtr¶
Doxygen¶
-
class TempCtr¶
Temporary constraint class.
This class represents a constraint which has not been built yet by a Model. It contains all the arguments needed to create a real constraint as instantiated by the
Ctr
class. It is made of a row (seeRow
) and a type (seeCtrType.rst.rst
).Typically, one creates a
TempCtr
by using the overloaded operators<=
,>=
and==
between variable expressions (i.e.,AffExpr
) and constant terms (i.e.,Constant
).Example 1:
Example 2 (equivalent to Example 1):... model.add_ctr(x + y <= 1.);
... model.add_ctr(TempCtr(Row(x + y, 1.), LessOrEqual));
Public Functions
-
TempCtr() = default¶
Default constructor.
Creates an empty temporary constraint. The default type is
LessOrEqual
.
-
inline TempCtr(LinExpr<Var> &&t_lhs, CtrType t_type, double t_rhs)¶
Constructor.
Creates a new temporary constraint.
- Parameters:
t_row – The desired row.
t_type – The desired constraint type.
-
TempCtr(TempCtr &&t_src) noexcept = default¶
Move constructor.
- Parameters:
t_src – The object to move.
-
TempCtr &operator=(const TempCtr &t_src) = default¶
Copy-assignment operator.
- Parameters:
t_src – The object to copy.
-
TempCtr &operator=(TempCtr &&t_src) noexcept = default¶
Move-assignment operator.
- Parameters:
t_src – The object to move.
-
inline CtrType type() const¶
Returns the temporary constraint type.
- Returns:
The temporary constraint type.
-
inline double rhs() const¶
-
inline double &rhs()¶
-
inline void set_rhs(double t_rhs)¶
-
TempCtr() = default¶