InequalityToEquality#
- class InequalityToEquality(mode='auto')[source]#
Bases:
QuadraticProgramConverter
Convert inequality constraints into equality constraints by introducing slack variables.
Examples
>>> 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)[source]#
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.
- রেইজেস:
QiskitOptimizationError -- If a variable type is not supported.
QiskitOptimizationError -- If an unsupported mode is selected.
QiskitOptimizationError -- If an unsupported sense is specified.
- রিটার্ন টাইপ: