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

How can I add a parameter into the the constraint?

回答済み

コメント

3件のコメント

  • 正式なコメント
    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 Merve,

    You could use the quicksum function to model these 2 constraints as

    Resource1 = m.addConstr( quicksum( x['Resource1',i] * mh['Resource1',i] for i in I ) <= 5 , name="Resource1" )
    Resource2 = m.addConstr( quicksum( x['Resource2',i] * mh['Resource2',i] for i in I ) <= 12 , name="Resource2" )

    You can access the values of \(\texttt{mh}\) via the \(\texttt{[]}\) operator and the corresponding key given in the \(\texttt{matching}\) list. Thus, \(\texttt{mh['Resource1‘,'item1‘]}\) provides the integer 3.

    Best regards,
    Jaromił

    1
  • merve özer
    • Gurobi-versary
    • First Comment
    • First Question

    This is great! I obtained exactly what I wanted. Thank you very much.

    Kind regards,

    Merve

    0

投稿コメントは受け付けていません。