How to combine decision variables?
Answeredx = m.addMVar(shape = 3, vtype=GRB.BINARY)
y = m.addMVar(shape = 4, vtype=GRB.INTEGER)
Is there any way to combine these two decision variables in one and make it shape = 7?
TIA
0
-
Official comment
This post is more than two 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. -
Hi,
Yes, you can define different variable types for matrix variables. See below where the first three MVar variables are binary and the last four are integers.
m.addMVar(7, vtype=["B" for _ in range(3)] + ["I" for _ in range(4)])
Best regards,
Maliheh
0 -
Thank you!
0
Post is closed for comments.
Comments
3 comments