I have a multidimensional variable:
var = m.addVars(N,time,vtype=GRB.INTEGER, name ="Var_")
and I would like to calculate the maximum value of this variable for each N. For example,
max_var is the maximum in value of var[0, t] in all time. I have defined this variable:
max_var = m.addVars(n,vtype=GRB.INTEGER, name ="MaxVar_")
and the constraint is:
m.addConstrs( (max_var[n] == max_(var[n,t]) for n in N), "cMaxValues")
but it always returns the last element in var[n,t]. Am I in the correct way or Gurobi needs only lists for the max_ function?
Please sign in to leave a comment.