I am experiencing some problems with qiskit implementation of VQE. First of all, in initialize an ansatz in one of the following ways:
ansatz = EfficientSU2(1, reps=1, entanglement='linear', insert_barriers=True)
ansatz = RealAmplitudes(1, reps=1)
Then, I execute VQE using this code:
vqe_inputs = {
'ansatz': ansatz,
'operator': matrix_op,
'optimizer': COBYLA(max_iter=100, tol=0.00001),
'initial_point': np.random.random(ansatz.num_parameters),
'measurement_error_mitigation': True,
'shots': 1024
}
options = {
'backend_name': backend.name(),
}
job = provider.runtime.run(program_id='vqe', inputs=vqe_inputs, options=options)
I would like to say that it always worked in this way, but since some time, when I try to execute it I get this error:
raise RuntimeError("The ansatz must be parameterized, but has 0 free parameters.")
I do not understand what is going on, also because it is a code which always worked so far, and I cannot figure out why it does not work on real backends only. Of course, I checked and the backend supports runtime service.
Any idea about what could be the cause?
Thanks a lot for your attention and Best Regards,