core.converters.qrao.qrao31#
This modeule implements Quantum Random Access Optimization (QRAO) using \((3,1,p)\)-QRAC [Fuller et al., 2024].
The Ising Hamiltonian
is converted into a relaxed Hamiltonian using the \((3,1,p)\)-QRAC method and the relaxed Hamiltonian becomes
where \(i\) th variable is mapped into Pauli \(\mu\) operator of the \(k\) th qubit by \(f(i)\). For example, if \(f(i) = (2,0)\), the \(i\) th variable is mapped into the Pauli \(Z\) operator of the 2nd qubit. If \(f(i) = (0,1)\), the \(i\) th variable is mapped into the Pauli \(X\) operator of the 0th qubit. If \(f(i) = (4,2)\), the \(i\) th variable is mapped into the Pauli \(Y\) operator of the 4th qubit The assignment of variables to qubits is determined by solving the graph coloring problem on the interaction graph so that \(f(i)\) and \(f(j)\) are assigned to different qubits.
This module provides functionality to convert optimization problems which written by jijmodeling into relaxed Hamiltonians using \((3,1,p)\)-QRAO.
The QRAC31Converter class extends the QuantumConverter base class, specializing in \((3,1,p)\) -QRAO-specific operations such as relaxed Hamiltonian generation and result decoding.
- Key Features:
Generation of relaxed Hamiltonians for \((3,1,p)\)-QRAO
Graph coloring algorithm for qubit assignment
Retrieve an encoded Pauli operators list for Pauli Rounding
Decoding of rounding results into classical optimization solutions
Attention
Currently, this module does not provide the rounding algorithm.
Note
This module requires jijmodeling and jijmodeling_transpiler for problem representation and decoding functionalities.
Bryce Fuller, Charles Hadfield, Jennifer R. Glick, Takashi Imamichi, Toshinari Itoko, Richard J. Thompson, Yang Jiao, Marna M. Kagele, Adriana W. Blom-Schieber, Rudy Raymond, and Antonio Mezzacapo. Approximate solutions of combinatorial problems via quantum relaxations. IEEE Transactions on Quantum Engineering, 5():1–15, 2024. doi:10.1109/TQE.2024.3421294.
Classes#
\((3,1,p)\)-QRAO (Quantum Random Access Optimization) converter class. |
Functions#
|
qrac encode |
|
Module Contents#
- color_group_to_qrac_encode(color_group: dict[int, list[int]]) dict[int, qamomile.core.operator.PauliOperator] #
qrac encode
- Parameters:
color_group (dict[int, list[int]]) – key is color (qubit’s index). value is list of bit’s index.
- Returns:
key is bit’s index. value is tuple of qubit’s index and Pauli operator kind.
- Return type:
dict[int, tuple[int, Pauli]]
Examples
>>> color_group = {0: [0, 1, 2], 1: [3, 4], 2: [6,]} >>> color_group_to_qrac_encode(color_group) {0: Z0, 1: X0, 2: Y0, 3: Z1, 4: X1, 6: Z2}
- qrac31_encode_ising(ising: qamomile.core.ising_qubo.IsingModel, color_group: dict[int, list[int]]) tuple[qamomile.core.operator.Hamiltonian, dict[int, qamomile.core.operator.PauliOperator]] #
- class QRAC31Converter(compiled_instance, relax_method: jijmodeling_transpiler.core.pubo.RelaxationMethod = jmt.pubo.RelaxationMethod.AugmentedLagrangian, normalize_model: bool = False, normalize_ising: Literal['abs_max', 'rms'] | None = None)#
Bases:
qamomile.core.converters.converter.QuantumConverter
\((3,1,p)\)-QRAO (Quantum Random Access Optimization) converter class.
This class provides methods to convert optimization problems into \((3,1,p)\)-QRAO relaxed Hamiltonians, and decode quantum computation results.
Examples
from qamomile.core.converters.qrao.qrao31 import QRAC31Converter # Initialize with a compiled optimization problem instance qrao_converter = QRAC31Converter(compiled_instance) # Generate relaxed Hamiltonian cost_hamiltonian = qrao_converter.get_cost_hamiltonian()
Initialize the QuantumConverter.
This method initializes the converter with the compiled instance of the optimization problem
- Parameters:
compiled_instance – The compiled instance of the optimization problem.
relax_method (jmt.pubo.RelaxationMethod) – The relaxation method for PUBO conversion. Defaults to AugmentedLagrangian.
normalize_model (bool) – The objective function and the constraints are normalized using the maximum absolute value of the coefficients contained in each. Defaults to False
normalize_ising (Literal["abs_max", "rms"] | None) – The normalization method for the Ising Hamiltonian. Available options: - “abs_max”: Normalize by absolute maximum value - “rms”: Normalize by root mean square Defaults to None.
- max_color_group_size = 3#
- ising_encode(multipliers: dict[str, float] | None = None, detail_parameters: dict[str, dict[tuple[int, Ellipsis], tuple[float, float]]] | None = None) qamomile.core.ising_qubo.IsingModel #
Encode the problem to an Ising model.
This method converts the problem from QUBO (Quadratic Unconstrained Binary Optimization) to Ising model representation.
- Parameters:
multipliers (Optional[dict[str, float]]) – Multipliers for constraint terms.
detail_parameters (Optional[dict[str, dict[tuple[int, ...], tuple[float, float]]]]) – Detailed parameters for the encoding process.
- Returns:
The encoded Ising model.
- Return type:
- get_cost_hamiltonian() qamomile.core.operator.Hamiltonian #
Construct the relaxed Hamiltonian for \((3,1,p)\)-QRAO.
- Returns:
The relaxed Hamiltonian.
- Return type:
qm_o.Hamiltonian
- get_encoded_pauli_list() list[qamomile.core.operator.Hamiltonian] #
Get the encoded Pauli operators as a list of Hamiltonians.
This method returns the Pauli Operators which correspond to the each variable in the Ising model.
- Returns:
A list of the encoded Pauli operators.
- Return type:
list[qm_o.Hamiltonian]