メインコンテンツへスキップ

Linearizing Max function in constraint

回答済み

コメント

2件のコメント

  • Joao Coelho
    • Gurobi-versary
    • First Question
    • First Comment

    the list earliest is a parameter of my problem, not a variable

     

    0
  • Maliheh Aramon
    • Gurobi Staff

    Hi Joao, 

    Let us assume that you would like to implement a constraint in the form \(\max(x, c)\) with \(c\) being a constant value. 

    • You need to fist define an auxiliary variable \(y\)
    • You can then use the method Model.addGenConstrMax() (or general constraint helper function gurobipy.max_()) to implement the relationship \(y = \max(x, c)\). 
    • You can then use \(y\) in place of \(\max(x, c)\) in any other constraint where the \(\max\) function appears. 

    Best regards,

    Maliheh

    0

サインインしてコメントを残してください。