InequalityToEquality#

class InequalityToEquality(mode='auto')[ソース]#

ベースクラス: QuadraticProgramConverter

Convert inequality constraints into equality constraints by introducing slack variables.

サンプル

>>> from qiskit_optimization.problems import QuadraticProgram
>>> from qiskit_optimization.converters import InequalityToEquality
>>> problem = QuadraticProgram()
>>> # define a problem
>>> conv = InequalityToEquality()
>>> problem2 = conv.convert(problem)
パラメータ:

mode (str) –

To choose the type of slack variables. There are 3 options for mode.

  • 』integer』: All slack variables will be integer variables.

  • 』continuous』: All slack variables will be continuous variables.

  • 』auto』: Use integer variables if possible, otherwise use continuous variables.

Attributes

mode#

Returns the mode of the converter

戻り値:

The mode of the converter used for additional slack variables

Methods

convert(problem)[ソース]#

Convert a problem with inequality constraints into one with only equality constraints.

パラメータ:

problem (QuadraticProgram) – The problem to be solved, that may contain inequality constraints.

戻り値:

The converted problem, that contain only equality constraints.

例外:
戻り値の型:

QuadraticProgram

interpret(x)[ソース]#

Convert a result of a converted problem into that of the original problem.

パラメータ:

x (ndarray | List[float]) – The result of the converted problem or the given result in case of FAILURE.

戻り値:

The result of the original problem.

戻り値の型:

ndarray