qlauncher.routines.qiskit.algorithms.qiskit_native#
Algorithms for Qiskit routines
Summary#
Classes:
Algorithm class with FALQON. |
|
Algorithm class with QAOA. |
|
Abstract class for Qiskit optimization algorithms |
|
Variational Quantum EigenSolver - qiskit-algorithm implementation wrapper. |
Functions:
Commutator |
|
CVar cost function to be used instead of mean for qaoa training |
|
Reference#
- class qlauncher.routines.qiskit.algorithms.qiskit_native.QiskitOptimizationAlgorithm(**alg_kwargs)[source]#
Bases:
AlgorithmAbstract class for Qiskit optimization algorithms
- make_tag(problem: Problem, backend: QiskitBackend) str[source]#
- qlauncher.routines.qiskit.algorithms.qiskit_native.commutator(op_a: SparsePauliOp, op_b: SparsePauliOp) SparsePauliOp[source]#
Commutator
- qlauncher.routines.qiskit.algorithms.qiskit_native.int_to_bitstring(number: int, total_bits: int)[source]#
- qlauncher.routines.qiskit.algorithms.qiskit_native.cvar_cost(probs_values: Iterable[tuple[float, float]], alpha: float)[source]#
CVar cost function to be used instead of mean for qaoa training
- class qlauncher.routines.qiskit.algorithms.qiskit_native.QAOA(p: int = 1, optimization_method: Literal['COBYLA'] = 'COBYLA', max_evaluations: int = 100, training_aggregation_method: Literal['mean', 'cvar'] = 'mean', cvar_alpha: float = 1, alternating_ansatz: bool = False, aux=None, **alg_kwargs)[source]#
Bases:
QiskitOptimizationAlgorithmAlgorithm class with QAOA.
- Parameters:
p (int) – The number of QAOA steps. Defaults to 1.
optimizer (Optimizer | None) – Optimizer used during algorithm runtime. If set to None turns into COBYLA. Defaults to None,
alternating_ansatz (bool) – Whether to use an alternating ansatz. Defaults to False. If True, it’s recommended to provide a mixer_h to alg_kwargs.
aux – Auxiliary input for the QAOA algorithm.
**alg_kwargs – Additional keyword arguments for the base class.
- name#
The name of the algorithm.
- Type:
str
- aux#
Auxiliary input for the QAOA algorithm.
- p#
The number of QAOA steps.
- Type:
int
- optimizer#
Optimizer used during algorithm runtime.
- Type:
Optimizer
- alternating_ansatz#
Whether to use an alternating ansatz.
- Type:
bool
- parameters#
List of parameters for the algorithm.
- Type:
list
- mixer_h#
The mixer Hamiltonian.
- Type:
SparsePauliOp | None
- property setup: dict#
- class qlauncher.routines.qiskit.algorithms.qiskit_native.FALQON(driver_h: SparsePauliOp | None = None, delta_t: float = 0.03, beta_0: float = 0.0, max_reps: int = 20)[source]#
Bases:
QiskitOptimizationAlgorithmAlgorithm class with FALQON.
- Parameters:
driver_h (Operator | None) – The driver Hamiltonian for the problem.
delta_t (float) – The time step for the evolution operators.
beta_0 (float) – The initial value of beta.
n (int) – The number of iterations to run the algorithm.
**alg_kwargs – Additional keyword arguments for the base class.
- driver_h#
The driver Hamiltonian for the problem.
- Type:
Operator | None
- delta_t#
The time step for the evolution operators.
- Type:
float
- beta_0#
The initial value of beta.
- Type:
float
- n#
The number of iterations to run the algorithm.
- Type:
int
- cost_h#
The cost Hamiltonian for the problem.
- Type:
Operator | None
- n_qubits#
The number of qubits in the problem.
- Type:
int
- parameters#
The list of algorithm parameters.
- Type:
list[str]
- property setup: dict#
- run(problem: Problem, backend: QiskitBackend, formatter: Callable) Result[source]#
Runs the FALQON algorithm
- class qlauncher.routines.qiskit.algorithms.qiskit_native.VQE(optimizer: Optimizer | None = None, ansatz: QuantumCircuit | None = None, with_numpy: bool = False)[source]#
Bases:
QiskitOptimizationAlgorithmVariational Quantum EigenSolver - qiskit-algorithm implementation wrapper.
- Parameters:
optimizer (optimizers.Optimizer | None, optional) – Optimizer for VQE. Defaults to None.
ansatz (QuantumCircuit | None, optional) – VQE’s ansatz. Defaults to None.
with_numpy (bool, optional) – Ignores ansatz parameter and backend, and changes solver to Numpy based. Defaults to False.
- property ansatz: QuantumCircuit#