Settting parameter of MIP Focus 1 for facility location allocation problem
AnsweredDear all,
I am currently working on a multi-period large Facility Location Allocation Problem, with 1 binary variable, 1 continuous variable, and 1 variable between 0 & 1. I also implemented a piecewise linear constraint on the problem.
In the early period (where demand is still low), the problem is solved under 60 minutes using Gurobi, with MIPFocus = 2, MIPGap = 0.05, Presolve = 2. However, in the later years where demand is high, the optimization took over 1000 minutes but it still not solve. I'd like to ask, would it gives significantly different result if I change the parameters of MIPFocus to 1? And would it still give a global optimal solutions?
In any case, should anyone have ideas to efficiently solve the problem, please feel free to give feedback. Thank you in advance
-
Hi Rizqi,
However, in the later years where demand is high, the optimization took over 1000 minutes but it still not solve.
Does "not solve" mean it does not find any solutions? Or does not terminate with an OPTIMAL status code?
would it gives significantly different result if I change the parameters of MIPFocus to 1
Are you referring to the quality of solution, or the behavior of the solver?
And would it still give a global optimal solutions?
Yes, if your MIP Gap is sufficiently small, and the solve is not terminated due to other criteria such as a time limit or nodelimit. In practice though the time and resources needed to solve some problems to optimality makes them intractable.
should anyone have ideas to efficiently solve the problem
I almost always recommend users to try our NoRel heuristic if their problem is not easily solved.
I also recommend to avoid setting parameters without justification - either from observations made from log files or from robust experimental evidence - see How can I make accurate comparisons?
- Riley
0 -
Dear Riley,
Thank you very much for your response. For the first question, I'd like to answer using this file ( gurobi.log), in which I think the objective is driven further from the bound (I am not sure if this is correct, as my knowledge on this is still limited). Should you find any insights from the file, I'd be happy to receive feedback from you.
In any case, I am going to try your advice to implement the NoRel heuristic, will update you further for the result
Kind regards,
Rizqi
0 -
Hi Rizqi,
The log isn't telling us much here. This is a big model!
Presolved model has 2980 SOS constraint(s)
Ideally SOS constraints are translated to linear constraints during presolve, so that they can contribute to the linear relaxation. Not always, but often, this is a consequence of not bounding variables. If possible please add bounds to your variables - the tighter the bounds the better.
When you try NoRel, you'll want to make sure run it long enough for it to get to phase 2 (assuming a feasible solution exists). I would try setting it to a large number (a few hours) and see how it goes.
You may also want to try removing the objective, so that you have a "feasibility problem" and see if it can find a solution. If it can then you can use this solution as a MIP start to the original model.
- Riley
0 -
And I forgot to mention - I would upgrade to Gurobi v12.
0 -
Dear Riley,
Thank you very much for your feedback. I'd first response to your comment regarding setting the bounds. Here is a snippet of the code that I use as the bound. As for the rest, I'll try to set a ca. 6 hours NoRelHeurTime implemented.
Many thanks once again for your feedback!
# Define variables
model.x = Var(model.Nodes, within=Binary)
model.y = Var(model.Nodes, within=NonNegativeIntegers, bounds=(0, max_chargers))
model.lam = Var(model.Nodes, model.q, within=Reals, bounds=(0, 1))
# Define piecewise variables and constraints
if constant_charge_time[0]:
model.y_pc = Var(model.Nodes, within=NonNegativeIntegers, bounds=(0, max_chargers))
model.piece_wise = Piecewise(
model.Nodes, model.y_pc, model.y,
pw_pts=list(piece_wise.values()), f_rule=list(piece_wise.keys()),
pw_repn='SOS2', pw_constr_type='EQ', unbounded_domain_var=True
)0
Please sign in to leave a comment.
Comments
5 comments