diff --git a/qiskit/aqua/algorithms/minimum_eigen_solvers/qaoa/var_form.py b/qiskit/aqua/algorithms/minimum_eigen_solvers/qaoa/var_form.py index 16160da042b7..6180cd66c27d 100755 --- a/qiskit/aqua/algorithms/minimum_eigen_solvers/qaoa/var_form.py +++ b/qiskit/aqua/algorithms/minimum_eigen_solvers/qaoa/var_form.py @@ -16,7 +16,7 @@ import numpy as np -from qiskit.aqua.operators import (OperatorBase, X, I, H, Zero, CircuitStateFn, +from qiskit.aqua.operators import (OperatorBase, X, I, H, CircuitStateFn, EvolutionFactory, LegacyBaseOperator) from qiskit.aqua.components.variational_forms import VariationalForm from qiskit.aqua.components.initial_states import InitialState @@ -80,13 +80,12 @@ def construct_circuit(self, parameters, q=None): self.num_parameters, len(parameters) )) - circuit = (H ^ self._num_qubits) # initialize circuit, possibly based on given register/initial state if self._initial_state is not None: - init_state = CircuitStateFn(self._initial_state.construct_circuit('circuit')) + stateVector = CircuitStateFn(self._initial_state.construct_circuit('circuit')) + circuit = stateVector.to_circuit_op() else: - init_state = Zero - circuit = circuit.compose(init_state) + circuit = (H ^ self._num_qubits) for idx in range(self._p): circuit = (self._cost_operator * parameters[idx]).exp_i().compose(circuit)