QuadraticProgramToQubo#
- class QuadraticProgramToQubo(penalty=None)[ソース]#
ベースクラス:
QuadraticProgramConverter
Convert a given optimization problem to a new problem that is a QUBO.
サンプル
>>> from qiskit_optimization.problems import QuadraticProgram >>> from qiskit_optimization.converters import QuadraticProgramToQubo >>> problem = QuadraticProgram() >>> # define a problem >>> conv = QuadraticProgramToQubo() >>> problem2 = conv.convert(problem)
- パラメータ:
penalty (float | None) – 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
- penalty#
Returns the penalty factor used in conversion.
- 戻り値:
The penalty factor used in conversion.
Methods
- convert(problem)[ソース]#
Convert a problem with linear constraints into new one with a QUBO form.
- パラメータ:
problem (QuadraticProgram) – The problem with linear constraints to be solved.
- 戻り値:
The problem converted in QUBO format as minimization problem.
- 例外:
QiskitOptimizationError – In case of an incompatible problem.
- 戻り値の型:
- static get_compatibility_msg(problem)[ソース]#
Checks whether a given problem can be solved with this optimizer.
Checks whether the given problem is compatible, i.e., whether the problem can be converted to a QUBO, and otherwise, returns a message explaining the incompatibility.
- パラメータ:
problem (QuadraticProgram) – The optimization problem to check compatibility.
- 戻り値:
A message describing the incompatibility.
- 戻り値の型:
- is_compatible(problem)[ソース]#
Checks whether a given problem can be solved with the optimizer implementing this method.
- パラメータ:
problem (QuadraticProgram) – The optimization problem to check compatibility.
- 戻り値:
Returns True if the problem is compatible, False otherwise.
- 戻り値の型: