qiskit_addon_opt_mapper.converters.BinaryToSpin¶
- class BinaryToSpin[source]¶
Bases:
OptimizationProblemConverterConvert all binary variables in the problem to spin variables.
The conversion is done by the relation b_i = (1 - s_i)/2 where b_i is a binary variable and s_i is a spin variable.
Initialize converter.
Methods
__init__()Initialize converter.
convert(problem)Convert all binary variables in the problem to spin variables.
interpret(x)Convert a solution of the converted problem back to a solution of the original problem.