Skip to main content

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

Answered

Comments

2 comments

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

Please sign in to leave a comment.