QuadraticProgramToQubo¶
- class QuadraticProgramToQubo(penalty=None)[source]¶
Bases:
qiskit_optimization.converters.quadratic_program_converter.QuadraticProgramConverter
Convert a given optimization problem to a new problem that is a QUBO.
Examples
>>> from qiskit_optimization.problems import QuadraticProgram >>> from qiskit_optimization.converters import QuadraticProgramToQubo >>> problem = QuadraticProgram() >>> # define a problem >>> conv = QuadraticProgramToQubo() >>> problem2 = conv.convert(problem)
- Parameters
penalty (
Optional
[float
]) – Penalty factor to scale equality constraints that are added to objective. If None is passed, a penalty factor will be automatically calculated on every conversion.
Attributes
Returns the penalty factor used in conversion.
Methods
convert
(problem)Convert a problem with linear constraints into new one with a QUBO form.
get_compatibility_msg
(problem)Checks whether a given problem can be solved with this optimizer.
interpret
(x)Convert a result of a converted problem into that of the original problem.
is_compatible
(problem)Checks whether a given problem can be solved with the optimizer implementing this method.