Skip to main content

Divide by variable technique didn't work.

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.
  • Marika Karbstein
    • Gurobi Staff

    Hi Thunwa,

    I am not quite sure about your model.
    But you need to use the m.addVars() method to create variables for Aux_Expo_noise1[k] and Aux_Expo_noise2[k] and also for Expo_noise_matrix[k] (if this should not be just 1).

    Then you need to add a constraint for each line in your for-loop, for example (here I assume matrix[k] needs to be 1):

    aux1 = m.addVars(Times, vtype=gp.GRB.CONTINUOUS, name = "aux1")
    aux2 = m.addVars(Times, vtype=gp.GRB.CONTINUOUS, name = "aux2")
    for k in Times:
      m.addConstr(aux1[k] == (70*y[1,k]+60*y[2,k]+80*y[3,k])*(z[1,k]+z[2,k]+z[3,k]))
      m.addConstr(aux2[k] == 0.8+0.2*y[1,k]+0.2*y[2,k]+0.2*y[3,k])
        m.addConstr(aux1[k] * aux2[k] == 1)

    I hope this information helps.

    Best regards,
    Marika

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

    Hi, Marika

     

    This is really informative to my model.

    Thank you a lot

     

    Best regards,

    Thunwa

    0

Post is closed for comments.