qiskit_addon_opt_mapper.translators.from_docplex_mp

from_docplex_mp(model, indicator_big_m=None)[source]

Translate a docplex.mp model into a quadratic problem.

Note that this supports the following features of docplex:

  • linear / quadratic objective function

  • linear / quadratic / indicator constraints

  • binary / integer / continuous variables

  • logical expressions (logical_not, logical_and, and logical_or)

Higher-order objective terms and constraints are not supported in a docplex.mp model. Also spin variables are not supported.

Parameters:
  • model (Model) – The docplex.mp model to be loaded.

  • indicator_big_m (float | None) – The big-M value used for the big-M formulation to convert indicator constraints into linear constraints. If None, it is automatically derived from the model.

Returns:

The quadratic problem corresponding to the model.

Raises:
  • RuntimeError – if docplex is not installed.

  • OptimizationError – if the model contains unsupported elements.

Return type:

OptimizationProblem