I have a question of understanding in Gurobi: I have an objective function in which my optimization variable x is squared. I have solved this bsiher by a quadratic objective function with $x$, $x$. Now, however, I need another optimization variable in this equation, so according to other posts here, I have set up a constraint that returns me the optimization variable $z = x^2$ and use this instead of $x, x$ in my objective function. Correspondingly, I also set the parameter for NonConvex to 2. What irritates me now is that I get different values for my objective function when using $x, x$ or $z$. Maybe someone can explain to me why this is the case or maybe I am doing something wrong.

  • 3
    $\begingroup$ Do you mean you get different solution or different optimal objective value? If same objective value, then the problem has a non-unique minimizer, and there is no reason to expect that two completely different formulations of the problem would yield the same solution (in particular when you create one version using a simple QP, and the other approach with a nonconvex model which requires a completely different and much more computationally demanding solution machinery) $\endgroup$ – Johan Löfberg Apr 19 at 7:57
  • $\begingroup$ The values of the objective function also deviate, but only very slightly. This is then probably also related to the calculation method and the computational effort, or? $\endgroup$ – Handballer73 Apr 20 at 6:54
  • $\begingroup$ The optimality tolerances are probably a couple of orders of magnitude larger in the nonconvex solver than the convex solver, so it depends on what you mean with slightly $\endgroup$ – Johan Löfberg Apr 20 at 7:06
  • $\begingroup$ I just did an evaluation and the deviations are negligible. Thank you for the tip and the hint, I simply had a thinking error. $\endgroup$ – Handballer73 Apr 20 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.