# VQE restart from a previous computation

I'm running VQE algorithm on ibmq-qasm-simulator.
I'm trying to implement a restart mechanism in order to be able to start a new computation from the result of a previous one.

To do so I've tried to set VQE' s initial_point parameter to result['optimal_point'], where result is the return value of vqe.run(quinstance) of the previous computation.

The code has worked for a very small graph (4 nodes, 4 edges), anyway it continues to fail for little bigger graphs (5 and 6 nodes). It doesn't converge to a minimum energy state but continues to oscillate.

Is this the correct way to implement a restart?
Thanks

• Just an intermediate question: there was a bug with the restarting algorithm in version 0.19.0, which was fixed in 0.19.2. Are you running this latest version? May 18 '20 at 15:16
• I don't know that algorithm, could you please show it to me? May 18 '20 at 15:35
• Sorry, that was a typo. I meant "a bug with restarting the algorithm". What's the Qiskit version you are running? May 18 '20 at 19:48
• I'm running 0.19.1 May 19 '20 at 6:35
• what do you mean by error? Is it the fact that the algorithm doesn't converge or anything else? Jun 16 '20 at 13:48

You can use a callback function to save the parameters for each iterations of your vqe algorithm and even store the mean, std. Below an example:

# Create the callback function to store intermediate values in vqe
counts = []
values = []
parameters_list=[]
std_list=[]
def store_intermediate_result(eval_count, parameters, mean, std):
counts.append(eval_count)
values.append(mean)
parameters_list.append(parameters)
std_list.append(std)
# Create your vqe instance by specifying the callback function and run it on the simulator

last_parameters=parameters_list[-1]