How can I add a parameter into the the constraint?

Answered

Comments

2 comments

  • Jaromił Najman

    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
    Comment actions Permalink
  • merve özer

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

    Kind regards,

    Merve

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk