Skip to main content

Divide by variable technique didn't work.

Answered

Comments

2 comments

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

Please sign in to leave a comment.