qiskit.chemistry.algorithms.VQEAdapt¶
-
class
VQEAdapt
(operator, var_form_base, optimizer, initial_point=None, excitation_pool=None, threshold=1e-05, delta=1, max_iterations=None, max_evals_grouped=1, aux_operators=None, quantum_instance=None)[source]¶ DEPRECATED. The Adaptive VQE algorithm.
See https://arxiv.org/abs/1812.11173
- Parameters
operator (
LegacyBaseOperator
) – Qubit operatorvar_form_base (
VariationalForm
) – base parameterized variational formoptimizer (
Optimizer
) – the classical optimizer algorithminitial_point (
Optional
[ndarray
]) – optimizer initial pointexcitation_pool (
Optional
[List
[WeightedPauliOperator
]]) – list of excitation operatorsthreshold (
float
) – absolute threshold value for gradients, has a min. value of 1e-15.delta (
float
) – finite difference step size for gradient computation, has a min. value of 1e-5.max_iterations (
Optional
[int
]) – maximum number of macro iterations of the VQEAdapt algorithm.max_evals_grouped (
int
) – max number of evaluations performed simultaneouslyaux_operators (
Optional
[List
[LegacyBaseOperator
]]) – Auxiliary operators to be evaluated at each eigenvaluequantum_instance (
Union
[QuantumInstance
,Backend
,BaseBackend
,None
]) – Quantum Instance or Backend
- Raises
ValueError – if var_form_base is not an instance of UCCSD.
See also – qiskit/chemistry/components/variational_forms/uccsd_adapt.py
-
__init__
(operator, var_form_base, optimizer, initial_point=None, excitation_pool=None, threshold=1e-05, delta=1, max_iterations=None, max_evals_grouped=1, aux_operators=None, quantum_instance=None)[source]¶ - Parameters
operator (
LegacyBaseOperator
) – Qubit operatorvar_form_base (
VariationalForm
) – base parameterized variational formoptimizer (
Optimizer
) – the classical optimizer algorithminitial_point (
Optional
[ndarray
]) – optimizer initial pointexcitation_pool (
Optional
[List
[WeightedPauliOperator
]]) – list of excitation operatorsthreshold (
float
) – absolute threshold value for gradients, has a min. value of 1e-15.delta (
float
) – finite difference step size for gradient computation, has a min. value of 1e-5.max_iterations (
Optional
[int
]) – maximum number of macro iterations of the VQEAdapt algorithm.max_evals_grouped (
int
) – max number of evaluations performed simultaneouslyaux_operators (
Optional
[List
[LegacyBaseOperator
]]) – Auxiliary operators to be evaluated at each eigenvaluequantum_instance (
Union
[QuantumInstance
,Backend
,BaseBackend
,None
]) – Quantum Instance or Backend
- Raises
ValueError – if var_form_base is not an instance of UCCSD.
See also – qiskit/chemistry/components/variational_forms/uccsd_adapt.py
Methods
__init__
(operator, var_form_base, optimizer)- type operator
LegacyBaseOperator
set parameterized circuits to None
find_minimum
([initial_point, var_form, …])Optimize to find the minimum cost value.
get optimal circuit
get optimal cost
get optimal vector
get_prob_vector_for_params
(…[, …])Helper function to get probability vectors for a set of params
get_probabilities_for_counts
(counts)get probabilities for counts
run
([quantum_instance])Execute the algorithm with selected backend.
set_backend
(backend, **kwargs)Sets backend with configuration.
Attributes
Returns backend.
Returns initial point
returns optimal parameters
Returns optimizer
Returns quantum instance.
Return a numpy random.
Returns variational form
-
property
backend
¶ Returns backend.
- Return type
Union
[Backend
,BaseBackend
]
-
cleanup_parameterized_circuits
()¶ set parameterized circuits to None
-
find_minimum
(initial_point=None, var_form=None, cost_fn=None, optimizer=None, gradient_fn=None)¶ Optimize to find the minimum cost value.
- Parameters
initial_point (
Optional
[ndarray
]) – If not None will be used instead of any initial point supplied via constructor. If None and None was supplied to constructor then a random point will be used if the optimizer requires an initial point.var_form (
Union
[QuantumCircuit
,VariationalForm
,None
]) – If not None will be used instead of any variational form supplied via constructor.cost_fn (
Optional
[Callable
]) – If not None will be used instead of any cost_fn supplied via constructor.optimizer (
Optional
[Optimizer
]) – If not None will be used instead of any optimizer supplied via constructor.gradient_fn (
Optional
[Callable
]) – Optional gradient function for optimizer
- Returns
Optimized variational parameters, and corresponding minimum cost value.
- Return type
dict
- Raises
ValueError – invalid input
-
get_prob_vector_for_params
(construct_circuit_fn, params_s, quantum_instance, construct_circuit_args=None)¶ Helper function to get probability vectors for a set of params
-
get_probabilities_for_counts
(counts)¶ get probabilities for counts
-
property
initial_point
¶ Returns initial point
- Return type
Optional
[ndarray
]
-
property
optimal_params
¶ returns optimal parameters
-
property
optimizer
¶ Returns optimizer
- Return type
Optional
[Optimizer
]
-
property
quantum_instance
¶ Returns quantum instance.
- Return type
Optional
[QuantumInstance
]
-
property
random
¶ Return a numpy random.
-
run
(quantum_instance=None, **kwargs)¶ Execute the algorithm with selected backend.
- Parameters
quantum_instance (
Union
[QuantumInstance
,Backend
,BaseBackend
,None
]) – the experimental setting.kwargs (dict) – kwargs
- Returns
results of an algorithm.
- Return type
dict
- Raises
AquaError – If a quantum instance or backend has not been provided
-
set_backend
(backend, **kwargs)¶ Sets backend with configuration.
- Return type
None
-
property
var_form
¶ Returns variational form
- Return type
Union
[QuantumCircuit
,VariationalForm
,None
]