Skip to main content

maximizing the sum of max functions

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Jaromił Najman
    • Gurobi Staff

    Hi Angelos,

    regarding the big M, you can set a big M for variable \(s_i\) to \(\max\{|a_i|,|b_i|\}\cdot \max\{|x^L|,|x^U|\}\) where \(x^L, x^U\) are the lower and upper bound of \(x\), respectively. You can calculate an even more accurate big M in some cases by checking all combinations of \(a_i,b_i\) and the bounds of \(x\) individually. Moreover, you don't need the left hand side inequalities \(a_i x \leq s_i\) and \(b_i x \leq s_i\) as you want to maximize the objective.

    A third way to model this type of problem would be to use the build in Gurobi max constraints. You would then have to introduce an auxiliary variable for each \(\max\) term as you already did with \(s_i\) and add a max constraint for it. You would also have to add auxiliary variables and equality constraints for each \(a_i x\) and \(b_i x\). However, it is not guaranteed that this approach will be faster than one of the two you presented.

    Best regards,
    Jaromił

    0
  • Angelos Georghiou
    • Gurobi-versary
    • First Comment
    • First Question

    Thanks a lot Jaromił!

     

    best wishes,

    Angelos

    0

Post is closed for comments.