-
-
Save Q-lds/2f61e5c2e5be9d5cd31acf8eb78c677e to your computer and use it in GitHub Desktop.
The openqaoa_job entrypoint script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from braket.aws import AwsQuantumJob | |
from openqaoa.workflows.optimizer import RQAOA | |
from openqaoa.problems.problem import NumberPartition | |
from openqaoa.workflows.aws_input.helpers import create_aws_input_data, save_input_data | |
np_qubo = NumberPartition.random_instance(n_numbers=8).get_qubo_problem() | |
# Define the RQAOA object (default rqaoa_type='adaptive') | |
r = RQAOA() | |
r.set_rqaoa_parameters(n_max=1, n_cutoff=3) | |
r.set_circuit_properties(p=1, param_type='standard', init_type='ramp', mixer_hamiltonian='x') | |
r.set_classical_optimizer(method='cobyla', maxiter=200, save_intermediate=False) | |
r.compile(np_qubo) | |
# Specify a path where to store the QUBO and the QAOA parameters | |
input_data = create_aws_input_data(r, vc) | |
save_input_data(input_data,'openqaoa_params.json') | |
job = AwsQuantumJob.create( | |
device="arn:aws:braket:::device/quantum-simulator/amazon/sv1", | |
job_name=job_name, | |
source_module="./scripts/rqaoa.py", | |
image_uri='XXX.dkr.ecr.us-east-1.amazonaws.com/amazon-braket-oq-dev:latest', | |
input_data={"input_data": 'openqaoa_params.json'}, | |
wait_until_complete=True # This frees the console | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment