What are common uses of GRBfixmodel()?
オープンThe description of GRBfixmodel() in the documentation here https://docs.gurobi.com/projects/optimizer/en/current/reference/c/solving.html#c.GRBfixmodel makes sense to me, but I was wondering what are some examples of when this gets used? Is one possible example a performance improvement when doing multiple solves? For examploe, are successive solves potentially faster by fixing the integer variables of an original MIP solution while allow the continuous variables to move for new parameters or changes in constraints or objective?
-
Hi Mike,
One use case could be, when you have a MIP model but want to calculate dual values (see this question). Those are not available for a MIP model, but when you fix all integer variables, the remaining model is LP and duals can be calculated.
Note that while successive solves might be faster when using a fixed model, you're really changing the model by fixing the integer values - so the optimal solution you get for a second solve, might not be the same as what you could get when leaving the model "unfixed". One alternative could be to use the integer values from a previous solve as MIP start or variable hint (see here). While those guide the search, they don't restrict the search space.
Kind regards,
Ronald1 -
As a followup on https://support.gurobi.com/hc/en-us/articles/360034305272-How-do-I-retrieve-the-dual-Pi-values-for-a-MIP-problem, is it required to call GRBOptimize() on the fixed model before calling GRBgetdblattrarray() to get the "Pi" (dual) values or can the values be retrieved immediately after calling GRBfixmodel()?
In other words, do I have to do:
GRBoptimize(model);
GRBfixmodel(model, &fixed_model);
GRBoptimize(fixed_model);
GRBgetdblattrarray(fixed_model, GRB_DBL_ATTR_PI, 0, num_vars, dual_sol);Or can I just do
GRBoptimize(model);
GRBfixmodel(model, &fixed_model);
GRBgetdblattrarray(fixed_model, GRB_DBL_ATTR_PI, 0, num_vars, dual_sol);0
サインインしてコメントを残してください。
コメント
2件のコメント