7.3.6. MdoExprLinear¶
- class mindoptpy.MdoExprLinear¶
Bases:
mindoptpy.MdoExpr
This object implements the data structure to hold a linear constraint expression object, which consists of a set of coefficient-variable pairs.
Typical steps to input a linear constraint expression are:
Create a set of empty variable objects by calling
mindoptpy.MdoModel.add_var()
.Create an empty linear expression object,
mindoptpy.MdoExprLinear()
.Input linear expression using overloaded operators such as
+
, or member functionmindoptpy.MdoExprLinear.add_terms()
.
Note
This is a temporary object with a short lifespan in general.
In general, overloaded operators such as
+
are less efficient and thus shall be avoided in a loop. Note taht the most efficient way to build an expression object is to callmindoptpy.MdoExprLinear.add_terms()
.
Examples
MdoVar x1 =