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

amplify.AerClient

Execution parameters

Depends on the algorithm

Execution result

Depends on the algorithm

Execution time

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

device

str

The device on which the Aer Simulator runs. One of "CPU", "GPU", or "Thrust". Default: "CPU". See AerSimulator for details.

method

str

The simulation method. "automatic", "statevector", "density_matrix", etc. Default: "automatic". See AerSimulator for details.

qiskit_pass_manager

qiskit.transpiler.PassManager | EllipsisType | None

The Qiskit qiskit.transpiler.PassManager used for circuit transpilation. The default (...) auto-generates one via generate_preset_pass_manager. None to skip transpilation.

token

str | None

IBM Cloud API key. When set, IBM Quantum noise models can be downloaded and used.

url

str | None

The connection URL for QiskitRuntimeService.

proxy

str | None

Proxy server for connecting to QiskitRuntimeService.

verify

bool | None

Whether to verify the server’s TLS certificate.

noise_model

str | None

The name of the IBM Quantum device to emulate with AerSimulator. None runs without noise. Valid names include those available from FakeProviderForBackendV2. If a valid token is set, names retrievable via QiskitRuntimeService.backend() are also available.

channel

str | None

The QiskitRuntimeService channel. "ibm_quantum_platform", "ibm_cloud", "local", etc.

Method

Arguments

Return type

Details

get_options()

dict[str, Any]

Returns the Aer Simulator options that have been explicitly set via set_options.

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'}