Skip to main content

How to formulate a constraint that models the maximum of a maximum value?

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Riley Clement
    • Gurobi Staff

    Hi Benjamin,

    The addGenConstrMax function is our equivalent.  As noted in the description of the function you can also use gp.max_

    In this particular case though I think using the max function will introduce unnecessary variables and constraints and I suggest trying the following alternative:

    for j in N:
        m.addConstr(a[0] <= a[j] + M)
        for k in N if j != k:
        m.addConstr(a[0] + (t_d[0,k] + s_d[k] + t_d[k,j] - t_t[0,j])*z[0,k,j]] <= a[j] + M)

    - Riley

    1
  • Benjamin Brandt
    • Gurobi-versary
    • First Question
    • First Comment

    Thank you!

    0

Post is closed for comments.