# docplex.mp.constants module¶

class docplex.mp.constants.BasisStatus[source]

Bases: enum.Enum

This enumerated type describes the different values for basis status.

Basis status can be queried for variables and linear constraints in LP problems.

Possible values are:

• NotABasisStatus: invalid or unknown status,
• Basic, means the variable belongs to the base,
• AtLower, means the variable is non-basic, at its lower bound,
• AtUpper, means the variable is non-basic, at its upper bound,
• FreeNonBasic, means the variable is nonbasic and is not at a bound.

The list of possible values for basis status can be found in the CPLEX documentation:

https://www.ibm.com/support/knowledgecenter/SSSA5P_20.1.0/ilog.odms.cplex.help/refcallablelibrary/cpxapi/getbase.html

class docplex.mp.constants.ComparisonType[source]

Bases: enum.Enum

This enumerated class defines the various types of linear constraints:

• LE for e1 <= e2 constraints
• EQ for e1 == e2 constraints
• GE for e1 >= e2 constraints

where e1 and e2 denote linear expressions.

operator_symbol

Returns a string operator for the constraint.

Example

Returns string “<=” for a e1 <= e2 constraint.

Returns: A string describing the logical operator used in the constraint. string
class docplex.mp.constants.ConflictStatus[source]

Bases: enum.Enum

This enumerated class defines the conflict status types.

class docplex.mp.constants.CplexScope[source]

Bases: enum.Enum

An enumeration.

class docplex.mp.constants.EffortLevel[source]

Bases: enum.Enum

This enumerated class controls the effort level used for a MIP start. The numeric value is identical to the CPLEX EffortLevel parameter values.

The list of possible values for effort level status can be found in the CPLEX documentation:

https://www.ibm.com/support/knowledgecenter/SSSA5P_20.1.0/ilog.odms.cplex.help/refcppcplex/html/enumerations/IloCplex_MIPStartEffort.html

class docplex.mp.constants.ObjectiveSense[source]

Bases: enum.Enum

This enumerated class defines the two types of objectives, Minimize and Maximize.

is_maximize()[source]

Returns True if objective is a maximizing objective.

is_minimize()[source]

Returns True if objective is a minimizing objective.

short_name

Returns a short (‘min’ or ‘max’) string describing the objective.

verb

Returns a string describing the objective (in lowercase)

• ‘minimize’ for the Minimize objective
• ‘maximize’ for the Maximize objective
class docplex.mp.constants.QualityMetric[source]

Bases: enum.Enum

An enumeration.

class docplex.mp.constants.RelaxationMode[source]

Bases: enum.Enum

This enumerated type describes the different strategies for model relaxation:
• MinSum, OptSum,
• MinInf, OptInf,

A relaxation algorithms works in two phases: In the first phase, it finds a feasible solution while making minimal changes to the model (according to a metric). In the second phase, it searches for an optimal solution while keeping the relaxation at the minimal value found in phase 1.

Enumerated values work in pairs: MinXXX, OptXXX

• MinXXX values stop at phase 1, they look for a feasible soluion, they do not optimize the objective.
• OptXXX run the two phases, looking for an optimal relaxed solution. They take longer.

The metric used to evaluate the quality of the relaxation is determined by the XXX part of the name. There are three metrics:

• Inf (MinInf, OptInf) minimizes the number of relaxed constraints. This metric will prefer to relax one constraint, even with a huge slack, instead of two.
• Sum (MinSum, OptSum): minimizes the sum of relaxations.
• Quand (MinQuad, OptQuad): minimizes the sum of squares of relaxations. This metric is the most expensive in computation time, but avoids huge discrepancies between relaxations: two constraints with relaxations of 2,2 will have a better quality (2^2 + 2^2 = 8) than relaxations of 3,1 (3^2 +1 = 10).
class docplex.mp.constants.SOSType[source]

Bases: enum.Enum

This enumerated class defines the SOS types:

• SOS1 for SOS type 1
• SOS1 for SOS type 2.
class docplex.mp.constants.SolveAttribute[source]

Bases: enum.Enum

An enumeration.

class docplex.mp.constants.UpdateEvent[source]

Bases: enum.Enum

An enumeration.

class docplex.mp.constants.VarBoundType[source]

Bases: enum.Enum

This enumerated class describes the two types of variable bounds:
• LB is for lower bound
• UB is for uupper bound

This enumerated type is used in conflict refiner.

class docplex.mp.constants.WriteLevel[source]

Bases: enum.Enum

This enumerated class controls what is written in MST mip start files. The numeric value is identical to the CPLEX WriteLevel parameter values.

The possible values are (in order of decreasing quantity of information written).

• AllVars (1): all variables are written
• DiscreteVars (2): all discrete variables are written (binary, integer, semi-integer)
• NonZeroVars (3): all non-zero vars are written, regardless of their type.
• DiscreteNonZeroVars (4): all discrete non-zero vars are written.
• Auto (0): automatic value, same as DiscreteVars.

New in version 2.10