In the Variational Quantum Linear Solver (VQLS) paper they define four cost functions (2 global and 2 local) and state in Appendix B that "all four cost functions are non-negative." However, in the qiskit VQLS tutorial where they implement one of the global cost functions you can see from their output that the cost function tends to negative numbers (~$-25$). Does this imply that they have an incorrect implementation of the cost function? What does it mean to have a negative cost function?

For some context, I am working with the local cost function, and it sometimes goes negative but not always. The reason I ask these questions is because I am unsure about how to handle convergence for my optimizer for negative cost functions.

  • 2
    $\begingroup$ Which optimizer are you using that has you worried about negative function values? This seems like it wouldn't be a problem $\endgroup$
    – forky40
    Apr 15, 2021 at 18:41
  • $\begingroup$ I am using the Simultaneous Perturbation Stochastic Approximation (SPSA). I should clarify that the optimizer can still convergence on a solution when the cost function is negative. However, my experience has been that the solutions are less accurate when negative values are reached. This observation and the fact that the VQLS paper states that these cost functions are "non-negative" leads me to believe that there may be an error in the qiskit implementation. $\endgroup$ Apr 15, 2021 at 19:49
  • 1
    $\begingroup$ Yes the negative values seem weird. For what its worth, on my end when I reran all the code blocks on that page using the in-browser kernel the -25 values disappeared and everything was positive. $\endgroup$
    – forky40
    Apr 15, 2021 at 21:49
  • $\begingroup$ Interesting, I reran the code on my system and again reached negative values. My guess is there must be some kind of minima in the landscape that the optimization algorithm sometimes finds. This could explain why I saw it and you didn't. Perhaps if you reran it a few times you would see negative values. To get back on track, however, does the presence of the negative cost function values indicate an error in their implementation of the cost function? $\endgroup$ Apr 15, 2021 at 22:11


Your Answer

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

Browse other questions tagged or ask your own question.