# An effective way to submit all the jobs for VQE/QAOA at a time to an IBMQ machine?

In Qiskit, I am solving a VRP for 5 nodes and it creates 20 variables for a QUBO. It runs in a 65 qubit machines (any machine below that many fails). Now, in such a typical solvers for optimization (VQE, QAOA etc.) more than 100 circuits are run in a machine. With max_evals we can run a bunch of these in the IBMQ machines to gain on wait time. I am wondering if there is pros/cons of using 1 circuit at a time or max_evals set to max_iter or is there a thumb-rule to select the optimum max_evals? One pro is obviously we can avoid the wait-time in queue. But is there any other cons?

Also, what is the most effective way to run such a QUBO, so that all the jobs cann be submitted at a time to the machine, so that there is no wait time?

If you decomposed your Hamiltonian into Pauli strings, and it has 100 different terms, then yes you can use one machine to do the quantum subroutine to evaluate the expectation for each of the term.

$$\langle H \rangle = \sum_{i} h_i \langle P_i \rangle$$

So you can evaluate $$\langle P_1 \rangle$$ on one machine and $$\langle P_2 \rangle$$ on another machine...

The problem is there is only one 65 qubit machine as far as I know. So even if you submit 100 circuits, they will be executed one by one. This is not going to save you any time.

Also, you have to remember that not all qubits are created equal and hence not all machines will have the same quality. This could be a problem if one of the many machines that you want to run in parallel is not of good quality. Your result will be heavily affected.

• Thanks, but 100 circuits working one by one will still work for me. What is happening now is the max_iter is 100, but it is requiring 84 eval count. It is creating 1 job with 1 circuit and submits it. It waits in queue, then process, then another job is submitted again. It waits in the queue again, Then it creates a 3rd job with 82 circuits and then a final job with 1 circuit. So a total of 4 jobs are submitted with queue-wait time in between. – Amitava Chakraborty Oct 9 '20 at 19:51
• All I want is a method to submit all 4 jobs in one go so that I have to endure the queue wait time only once. Once it is submitted, it can run the jobs sequentially, I don't mind. – Amitava Chakraborty Oct 9 '20 at 19:51
• @AmitavaChakraborty The iteration is part of the optimization process. The max_iter you are mentioned must be part of the optimizer call. For instance, SLSQP(maxiter=100), meaning that you will run the quantum circuit, evaluate the cost/objective function, then pass it to the classical optimizer; and the maximum number you set this is at 100. The problem may or may not converge at 100 iterations. Think of this as "epochs" in neural networks if you are more familiar with that setting. In this sense, you can't do anything but wait in queue. (cont to the next comment...) – KAJ226 Oct 9 '20 at 20:37
• You must evaluate $\langle H \rangle$ (the objective function), then pass this to the classical optimizer. The classical optimizer will update the parameters in your quantum circuit. You can't speed this process up. The part where you can speed up is the evaluation of $\langle H \rangle$ by doing each of the expectation term independently and parallel. Note that this is actually already being done in Qiskit. – KAJ226 Oct 9 '20 at 20:40