Skip to main content

How to add equation containing decision variable into an array.

Answered

Comments

3 comments

  • Official comment
    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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • Gurobi Staff

    In your code \(\texttt{Expo_noise_matrix}\) is a range object and thus, you cannot assign values to it.

    You should rather use a dictionary for \(\texttt{Expo_noise_matrix}\).

    Time_span = 16
    Expo_noise_matrix = {}
    Times = range(1,Time_span+1)
    for k in Times:
        Expo_noise_matrix[k] = ((70*y[1,k]+60*y[2,k]+80*y[3,k])*(1-((-1+y[1,k]+y[2,k]+y[3,k])*0.2)))

    Best regards, 
    Jaromił

    0
  • Thunwa Wanphian
    • Gurobi-versary
    • First Comment
    • First Question

    Dear: Jaromił

    It's work now, thank you :).

    Best regards,

    Thunwa.

    0

Post is closed for comments.