docplex.mp.vartype module

class docplex.mp.vartype.BinaryVarType[source]

Bases: VarType

This class models the binary variable type and is not meant to be instantiated. Each model contains one instance of this type.

is_discrete()[source]

Checks if this is a discrete type.

Returns:

True as this is a discrete type.

Return type:

Boolean

class docplex.mp.vartype.ContinuousVarType[source]

Bases: VarType

This class models the continuous variable type and is not meant to be instantiated. Each model contains one instance of this type.

is_discrete()[source]

Checks if this is a discrete type.

Returns:

False because this type is not a discrete type.

Return type:

Boolean

class docplex.mp.vartype.IntegerVarType[source]

Bases: VarType

This class models the integer variable type and is not meant to be instantiated. Each models contains one instance of this type.

is_discrete()[source]

Checks if this is a discrete type.

Returns:

True as this is a discrete type.

Return type:

Boolean

class docplex.mp.vartype.SemiContinuousVarType[source]

Bases: VarType

This class models the semi-continuous variable type and is not meant to be instantiated.

property default_lb

This property returns the default lower bound for the type.

is_discrete()[source]

Checks if this is a discrete type.

Returns:

False because this type is not a discrete type.

Return type:

Boolean

class docplex.mp.vartype.SemiIntegerVarType[source]

Bases: VarType

This class models the semi-integer variable type and is not meant to be instantiated.

property default_lb

This property returns the default lower bound for the type.

is_discrete()[source]

Checks if this is a discrete type.

Returns:

True because this type is an integer type.

Return type:

Boolean

class docplex.mp.vartype.VarType[source]

Bases: object

This abstract class is the parent class for all types of decision variables.

This class must never be instantiated. Specialized sub-classes are defined for each type of decision variable.

property cplex_typecode

This property returns the CPLEX type code for this type. Possible values are:

  • ‘B’ for binary type

  • ‘I’ for integer type

  • ‘C’ for continuous type

  • ‘S’ for semicontinuous type

  • ‘N’ for semiinteger type

Returns:

a one-letter string.

property default_lb

This property returns the default lower bound for the type.

property default_ub

This property returns the default upper bound for the type.

is_discrete()[source]

Checks if this is a discrete type.

Returns:

True if the type is a discrete type.

Return type:

Boolean

property short_name

This property returns a short name string for the type.

to_string()[source]
Returns:

A string representation of the type.

Return type:

string