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 nonbasic, at its lower bound,
 AtUpper, means the variable is nonbasic, at its upper bound,
 FreeNonBasic, means the variable is nonbasic and is not at a bound.
See also
The list of possible values for basis status can be found in the CPLEX documentation:

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. Return type: string

class
docplex.mp.constants.
ConflictStatus
[source]¶ Bases:
enum.Enum
This enumerated class defines the conflict status types.

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.
 See Also:
 The list of possible values for effort level status can be found in the CPLEX documentation:

class
docplex.mp.constants.
ObjectiveSense
[source]¶ Bases:
enum.Enum
This enumerated class defines the two types of objectives, Minimize and Maximize.

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.
RelaxationMode
[source]¶ Bases:
enum.Enum
 This enumerated type describes the different strategies for model relaxation:
 MinSum, OptSum,
 MinInf, OptInf,
 MinQuad, OptQuad.
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.
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, semiinteger)
 NonZeroVars (3): all nonzero vars are written, regardless of their type.
 DiscreteNonZeroVars (4): all discrete nonzero vars are written.
 Auto (0): automatic value, same as DiscreteVars.
New in version 2.10