Skip to main content

Balancing penalty weights when relaxing constraints




  • Greg Glockner
    Gurobi Staff Gurobi Staff

    This sounds like a good candidate for hierarchical objectives - see .

  • Alan Atkinson
    First Question
    First Comment

    And that's how I modeled it the second go around.

    The bit I don't quite get though - and I'm sure I'm missing something obvious - is whether the difference in the size of the calculated objective functions matters. 

    So if I have two objectives a and b. a maxes at 10^3 and b maxes at 10^6 (say) how do I say a is 2x the weight (importance) of b?

    Would it be 2.0 or 2*10^6/10^3?

    And if the second of the two how would I pull these numbers to set the weights.

    It's something that's not well covered in the docs (imo). Or if it is I'm clearly not getting it...


  • Greg Glockner
    Gurobi Staff Gurobi Staff

    With a hierarchical objectives (priorities), Gurobi solves the model with the highest priority objective, then fixes that as a constraint and solves the model with the next priority objective, etc. At each step, it uses warm start information.

    With this, don't put a large weight on any objective; keep the magnitude reasonable.

    The objective constraints need not be strict; you can give a bit of tolerance when they become constraints.

    This should do exactly what you want.


Please sign in to leave a comment.