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:

  1. Create a set of empty variable objects by calling mindoptpy.MdoModel.add_var().

  2. Create an empty linear expression object, mindoptpy.MdoExprLinear().

  3. Input linear expression using overloaded operators such as +, or member function mindoptpy.MdoExprLinear.add_terms().


  1. This is a temporary object with a short lifespan in general.

  2. 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 call mindoptpy.MdoExprLinear.add_terms().


MdoVar x1 =