I’m following the tutorial (https://qiskit.org/textbook/ch-applications/vqe-molecules.html) to construct the VQE circuit. In this tutorial, it used the classical optimizer like “COBYLA, SPSA, SLSQP” to choose the appropriate parameters. I wonder how to adjust the optimizers so the optimizers will always choose the specific parameters.

I want to choose two kinds of specific parameters:

  1. The multiple of a number. For example: I want the parameters to be 2πi/2^10 ,i∈N

  2. A given set. For example: I want the parameters to be chosen from a set {0.01, 0.05, 0.23, …}

How do I constraint the optimizers? Thanks for answering my questions!


1 Answer 1


If you make your parameter space discontinuous, then most optimisation algorithms will not work. They require a smooth continuous function to calculate gradients (gradient-free ones make similar assumptions too).

If your set is small and the total number of parameters is not too large, you can try all combinations (brute force).

You want to go into the direction of discreet optimisation, so that is the keyword you are looking for ;)

  • $\begingroup$ Thanks for answering! Do you have any suggestion about discrete optimisation? Or do you mean because most of optimizers are gradient-based, so there isn't any method to do discrete optimisation? $\endgroup$
    – 劉承瀚
    Commented Feb 13, 2023 at 8:29
  • $\begingroup$ There are discreet methods but I am not an expert. You might want to reconsider if you really want to do this, and if it brings any advantage. $\endgroup$
    – quantum
    Commented Feb 13, 2023 at 12:17
  • $\begingroup$ Thank you very much! Your answer is very helpful for me! $\endgroup$
    – 劉承瀚
    Commented Feb 13, 2023 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.