docplex.cp reference manual

The following Python modules are provided in the package docplex.cp:

model.py

This module implements the object CpoModel which groups a collection of docplex.cp expressions into a single model before the model is submitted for solving. This module is the only module that needs to be imported before writing a model, as it imports all other necessary modules in order to make their features available (CpoExpression, CpoModeler, CpoFunction, CpoParameters).

expression.py

This module is automatically imported when CpoModeler is imported. It provides the various atomic expression elements manipulated by DOcplex.CP:

  • integer variables,
  • interval variables,
  • transition matrices,
  • tuple sets, and
  • state functions.

It also defines a set of methods that simplify the creation of these expressions.

modeler.py

This module contains a list of methods that construct all possible model expressions from other model expressions. There is one method for each operation, each with possible multiple ways to call it.

function.py

This module is dedicated to the particular case of function expressions:

  • segmented functions and
  • step functions.

It also contains many operators for manipulating these functions before adding them to a model.

parameters.py

This module contains the definition of the various solving parameters that can be associated with a model in order to to configure the solve. The list of possible values is also given.

solution.py

This module contains the objects that represent a solution of the model when solved. The root object CpoSolveResult manages a set of solution objects for each variable element of the model.

config.py

This module contains the definition of most important configuration parameters with their assignment to appropriate default value.

solver.py

This module contains the abstraction of what is a solver of CPO models. It is usually not directly visible as long as solving is requested by calling method solve() on the model, but is is required when advanced functions are required.

solver_listener.py

This module contains the definition of a solver listener that allows to be informed of the different solving steps. It also provides the implementation of some default useful listeners.

utils_visu.py

This module contains miscellaneous utility classes and methods that are used by other modules of docplex.cp.

utils_visu.py

This module is a add-on to matplotlib for easy display of CP Optimizer scheduling solutions and structures.

environment.py

This module handles the different elements that allow to execute the same optimization program independently from the solving environment. This environment may be:

  • on premise, using a local version of CPLEX Optimization Studio,
  • on DOcplexcloud, the python program running inside the Python Worker,

As far as possible, the adaptation to the execution environment is done automatically.

Indices and tables