English
Languages
English
Bengali
Japanese
Shortcuts



CplexOptimizer

class CplexOptimizer(disp=False, cplex_parameters=None)[source]

Bases: OptimizationAlgorithm

The CPLEX optimizer wrapped as an Qiskit OptimizationAlgorithm.

This class provides a wrapper for cplex.Cplex (https://pypi.org/project/cplex/) to be used within the optimization module.

Examples

>>> from qiskit_optimization.problems import QuadraticProgram
>>> from qiskit_optimization.algorithms import CplexOptimizer
>>> problem = QuadraticProgram()
>>> # specify problem here, if cplex is installed
>>> optimizer = CplexOptimizer() if CplexOptimizer.is_cplex_installed() else None
>>> if optimizer: result = optimizer.solve(problem)

Initializes the CplexOptimizer.

Parameters

Attributes

cplex_parameters

Returns parameters for CPLEX

disp

Returns the display setting.

Methods

get_compatibility_msg(problem)

Checks whether a given problem can be solved with this optimizer.

is_cplex_installed()

Returns True if cplex is installed

solve(problem)

Tries to solves the given problem using the optimizer.