Skip to main content

Settting parameter of MIP Focus 1 for facility location allocation problem

Answered

Comments

5 comments

  • Riley Clement
    • Gurobi Staff Gurobi Staff

    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
  • Rizqi Nugroho
    • First Comment
    • First Question
    • Gurobi-versary

    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
  • Riley Clement
    • Gurobi Staff Gurobi Staff

    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
  • Riley Clement
    • Gurobi Staff Gurobi Staff

    And I forgot to mention - I would upgrade to Gurobi v12.

    0
  • Rizqi Nugroho
    • First Comment
    • First Question
    • Gurobi-versary

    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.