Amazon Braket Simulator¶
Uses Amazon Braket simulators for circuit evaluation. Both local and cloud simulators are supported.
Available as BraketSimulatorClient.
Tip
No registration required.
By authenticating with an AWS account subscribed to Amazon Braket, you can also use cloud simulators (SV1, TN1, DM1).
- Solver specification:
Client class
Depends on the algorithm
Depends on the algorithm
Depends on the algorithm
Quantum computer type
Gate-based simulator
API method
Local simulation / REST API (Amazon Braket)
The variable types and polynomial degree accepted for the input problem depend on the chosen algorithm.
When QAOA is specified as the client argument
Binary
Ising
Integer
Real
Objective function
-
Nth degree*
-
-
Equality constraint
-
**
-
-
Inequality constraint
-
-
-
-
*: Problems of arbitrary degree are supported. However, depending on the qubit connectivity of the quantum computer, the required number of qubits may increase.
**: When Constrained QAOA is selected via QAOA type, N-HOT constraints are supported.
When RQAOA is specified as the client argument
Binary
Ising
Integer
Real
Objective function
-
Nth degree*
-
-
Equality constraint
-
-
-
-
Inequality constraint
-
-
-
-
*: Problems of arbitrary degree are supported. However, depending on the qubit connectivity of the quantum computer, the required number of qubits may increase.
- Client class:
The client class has the following attributes and methods.
Attribute
Data type
Details
The simulator name or cloud simulator device ARN to use. Default:
"braket_sv"
Local simulators:Cloud simulators:
Specifies the provider used to connect to the device. Currently, only Amazon Braket is supported.
- Backend-specific metadata:
Detailed sampling information is available via QAOA’s sampling_meta. Uses
BraketJobMeta.meta = client_result.history[0].sampling_meta meta.circuit # The executed circuit object meta.metadata # Amazon Braket task metadata (task_id, created_at, ended_at)
- Configuration example:
import boto3 from braket.aws import AwsSession from amplify import QAOA, BraketSimulatorClient # Using a local simulator client = BraketSimulatorClient(QAOA) client.device = "braket_sv" # Using a cloud simulator client = BraketSimulatorClient(QAOA, device="SV1") boto_session = boto3.Session(profile_name="my-profile") client.provider = AwsSession(boto_session=boto_session) # Set QAOA parameters client.parameters.reps = 1 client.parameters.shots = 100
- Execution example:
from amplify import Model, VariableGenerator, solve # Create decision variables and the objective function g = VariableGenerator() q = g.array("Binary", 2) f = q[0] * q[1] + q[0] - q[1] + 1 # Create a model model = Model(f) # Run the solver result = solve(model, client)
Obtain the backend version:
>>> client.version()