qrao.encoding.QuantumRandomAccessEncoding¶
- class QuantumRandomAccessEncoding(max_vars_per_qubit=3)[source]¶
This class specifies a Quantum Random Access Code that can be used to encode the binary variables of a QUBO (quadratic unconstrained binary optimization problem).
- Parameters:
max_vars_per_qubit (
int
) – maximum possible compression ratio. Supported values are 1, 2, or 3.
Methods
__init__
([max_vars_per_qubit])encode
(problem)Encode the (n,1,p) QRAC relaxed Hamiltonian of this problem.
ensure_thawed
()Raise a
RuntimeError
if the object is frozen and thus cannot be modified.freeze
()Freeze the object to prevent further modification.
state_prep
(dvars)Prepare a multiqubit QRAC state.
term2op
(*variables)Construct a
PauliSumOp
that is a product of encoded decisionvariable
(s).Attributes
OPERATORS
compression_ratio
Compression ratio
frozen
True
if the object can no longer be modified,False
otherwise.max_vars_per_qubit
Maximum number of variables per qubit
minimum_recovery_probability
Minimum recovery probability, as set by
max_vars_per_qubit
num_qubits
Number of qubits
num_vars
Number of decision variables
offset
Relaxed Hamiltonian offset
problem
The
QuadraticProgram
used as basis for the encodingq2vars
Each element contains the list of decision variable indice(s) encoded on that qubit
qubit_op
Relaxed Hamiltonian operator
var2op
Maps each decision variable to
(qubit_index, operator)