InequalityToEquality.encode¶
- InequalityToEquality.encode(op, name=None, mode='auto')[source]¶
Convert a problem with inequality constraints into one with only equality constraints.
- Parameters
op (
QuadraticProgram
) – The problem to be solved, that may contain inequality constraints.name (
Optional
[str
]) – The name of the converted problem.mode (
str
) –To chose 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’: Try to use integer variables but if it’s not possible,
use continuous variables
- Return type
- Returns
The converted problem, that contain only equality constraints.
- Raises
QiskitOptimizationError – If a variable type is not supported.
QiskitOptimizationError – If an unsupported mode is selected.
QiskitOptimizationError – If an unsupported sense is specified.