Qiskit Aer Simulator¶
Uses the Qiskit Aer Simulator for circuit evaluation.
Available as AerClient.
Tip
No registration required.
You can use IBM Quantum noise models by setting an IBM Quantum API key obtained from your IBM Cloud Platform account.
- 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 (Qiskit Aer)
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 device on which the Aer Simulator runs. One of
"CPU","GPU", or"Thrust". Default:"CPU". See AerSimulator for details.The simulation method.
"automatic","statevector","density_matrix", etc. Default:"automatic". See AerSimulator for details.The Qiskit
qiskit.transpiler.PassManagerused for circuit transpilation. The default (...) auto-generates one via generate_preset_pass_manager.Noneto skip transpilation.IBM Cloud API key. When set, IBM Quantum noise models can be downloaded and used.
The connection URL for QiskitRuntimeService.
Proxy server for connecting to QiskitRuntimeService.
Whether to verify the server’s TLS certificate.
The name of the IBM Quantum device to emulate with AerSimulator.
Noneruns without noise. Valid names include those available from FakeProviderForBackendV2. If a validtokenis set, names retrievable via QiskitRuntimeService.backend() are also available.The QiskitRuntimeService channel.
"ibm_quantum_platform","ibm_cloud","local", etc.Method
Arguments
Return type
Details
Returns the Aer Simulator options that have been explicitly set via
set_options.Arbitrary keyword arguments
Sets execution options for the Aer Simulator. See the AerSimulator documentation for available options. Examples:
seed_simulator,noise_model,precision,fusion_enable, etc.- Backend-specific metadata:
Detailed sampling information is available via QAOA’s sampling_meta. Uses
QiskitJobMeta.meta = client_result.history[0].sampling_meta meta.job_id # Job ID meta.circuit # The executed Qiskit circuit object meta.transpiled_circuit # The circuit after transpilation (None if not transpiled) meta.metadata # Raw metadata from the job result meta.metrics # Metrics data such as execution time from the job result
- Configuration example:
from amplify import QAOA, AerClient # Create the client client = AerClient(QAOA) # Set QAOA parameters client.parameters.reps = 1 client.parameters.shots = 100 # To use a noise model client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" client.noise_model = "fake_fez" # Set the simulation device client.device = "CPU" client.method = "automatic"
- 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() '0.17.2'
Check and set Aer Simulator options:
>>> client.get_options() {'device': 'CPU', 'method': 'automatic'} >>> client.set_options(seed_simulator=42) >>> client.get_options() {'seed_simulator': 42, 'device': 'CPU', 'method': 'automatic'}