qiskit.optimization.converters.IntegerToBinary¶
-
class
IntegerToBinary
[ソース]¶ Convert a
QuadraticProgram
into new one by encoding integer with binary variables.This bounded-coefficient encoding used in this converted is proposed in [1], Eq. (5).
サンプル
>>> from qiskit.optimization.problems import QuadraticProgram >>> from qiskit.optimization.converters import IntegerToBinary >>> problem = QuadraticProgram() >>> var = problem.integer_var(name='x', lowerbound=0, upperbound=10) >>> conv = IntegerToBinary() >>> problem2 = conv.convert(problem)
参照
- [1]: Sahar Karimi, Pooya Ronagh (2017), Practical Integer-to-Binary Mapping for Quantum
Annealers. arxiv.org:1706.01945.
Methods
__init__
()Initialize self.
convert
(problem)Convert an integer problem into a new problem with binary variables.
interpret
(x)Convert back the converted problem (binary variables) to the original (integer variables).
-
convert
(problem)[ソース]¶ Convert an integer problem into a new problem with binary variables.
- パラメータ
problem (
QuadraticProgram
) – The problem to be solved, that may contain integer variables.- 戻り値の型
QuadraticProgram
- 戻り値
The converted problem, that contains no integer variables.
- 例外
QiskitOptimizationError – if variable or constraint type is not supported.