TempCtr
-
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.,Expr
) 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));
Subclassed by idol::CtrVersion
Public Functions
-
TempCtr() = default
Default constructor.
Creates an empty temporary constraint. The default type is
LessOrEqual
.
-
inline TempCtr(Row &&t_row, CtrType t_type)
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 const Row &row() const
Returns the row of the temporary constraint (see Row).
- Returns:
The row of the temporary constraint.
-
inline Row &row()
Returns the row of the temporary constraint (see Row).
- Returns:
The row of the temporary constraint.
-
inline CtrType type() const
Returns the temporary constraint type.
- Returns:
The temporary constraint type.
-
TempCtr() = default