Relaxed variable in Java API
AnsweredHello support team,
I define an integer variable as following:
GRBVar[][] start = new GRBVar[mach.length][item.length];
for (int m = 0; m < mach.length; m++) {
for (int k = 0; k < item.length; k++) {
start[m][k] = model.addVar(0, 200, 0, GRB.INTEGER, "start" + m + "." + k);
}
}
I need to convert the integer variable to the continuous variable without changing in the initial definition.
Would you say that is there any way to cast it?
Regards
Omidi. A
0
-
Official comment
Hi Abbas,
you can change the type of a variable with by settings it's variable type attribute. E.g., start[0][0].set(GRB.CharAttr.VType, GRB.CONTINUOUS).
Best,
Michael
-
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?. -
Hi Michael,
Thanks for your advice. It works fine.
Regards
Abbas
0
Post is closed for comments.
Comments
3 comments