General Constraint Helper Functions with Matrices?
It is easy to get the minimum when it is a Vars or a constant. For example:
var1 = m.addVar(name="var1", vtype=GRB.INTEGER)
var2 = m.addVar(name="var2", vtype=GRB.INTEGER)
m.addConstr(var1 == 6)
m.addConstr(var2 == min_(var1, 5))
But, how to do the same with matrix variables? For example:
vector1 = m.addMVar(1, name="vector1", vtype=GRB.INTEGER)
vector2 = m.addMVar(1, name="vector1", vtype=GRB.INTEGER)
m.addConstr(vector1[0] == 6)
m.addConstr(vector2[0] == min_(vector1[0], 5))
Thanks!
0
-
Official comment
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 why not try our AI Gurobot?.
Post is closed for comments.
Comments
1 comment