Is it possible for QP method to change the target function dynamically?
OngoingI'm trying QP solver now. And I'm curious about if we can change the objective function in each iteration. If so, how to deal with it? is it possible to add a callback function and change the objective function after each iteration?
-
Hi Haxiang,
I don't see why changing the objective at every iteration would be useful. Or do you regard one QP optimization run as one iteration in some larger context?
Gurobi does not warm-start QPs when using the barrier method to solve them. There is also no automatic warm-start when using the simplex algorithm (parameter Method=0 or 1), but you might be able to store the optimal basis and load it for the consecutive problem. To do that, you need to query and set the VBasis and CBasis attributes after one run and before starting the next one. Please note that you also need to disable presolving (parameter Presolve=0) for this to work.
Cheers,
Matthias0 -
Yes, the QP optimization is actually a part of a larger context. Do you mean it does not support warm-start in the QP barrier method? Even if I change GRB_DoubleAttr_Start, it still cannot affect the gurobi performance? Btw, I can find a warm start by myself. And do you mean only the simplex method supports a warm start? And to use a warm start in the simplex method, do I have to change its basis instead of an initial solution?
0 -
That's correct. The barrier method (for LP and QP) does not support warm-starting. The Start attribute is mainly used for (mixed) integer models to provide a feasible solution quickly - it is not as effective for continuous problems.
And yes, to use the warm-start of the simplex method, it's best to provide a basis. When passing an initial solution, Gurobi has to compute the corresponding basis, so it's better to pass the basis information right away.
Cheers,
Matthias0 -
ok, I'll try then. One more question. Since I want to use QP solver many times, is there any other suggestion to accelerate the optimization speed? I'm wondering if some operation (like initiating an environment or setting a model for each time) is also time-consuming.
Thanks for your help!
0
Please sign in to leave a comment.
Comments
4 comments