Bounds for Variable
回答済みI am using Gurobi 9.0, with C++. I am trying to put an array element, that is created for a C++ function ( use random) as a UPPER bound of a GRB Var array, as follows:
for ( t = 0; t < z; t++) {
ostringstream vname;
vname << "Wcurt" << t;
// Wcurt[t].set(GRB_CharAttr_VType,GRB_INTEGER);
Wcurt[t].set(GRB_DoubleAttr_UB, P_wind[t]);
Wcurt[t].set(GRB_DoubleAttr_LB, 0);
Wcurt[t].set(GRB_StringAttr_VarName, vname.str());
}
W_curt can be continuous;
I appreciate any help.
Best regards,
As a syntax, what means the C++ syntax is wrong, however that also has to do with the GRBVar is created, meaning as also an array.
-
Hi Alessandra!
I am not sure I understand the problem or the error here. Could you please share a minimal reproducible example, including the error message?
Thanks,
Matthias0 -
Hi Matthias,
The problem is my array P_wind is one single function output, that was randomly chosen from one data 2-D array [T][N] that will be the Upper Bound (UB) for the Gurobi variable W_curt[ ], my code is Gurobi C++ in VS. I just one be sure, is not problematic for a GRB_VAR have such output as UB.
I would be very kind, to let me know about it.
Best Regards,
Alessandra
0 -
Hi Alessandra,
This should be fine. Just be aware that you cannot have dynamically changing values (e.g. the output of a function that is part of your problem) as model parameters. The upper bound has to be a fixed value for Gurobi.
I hope that answers your question.
Cheers,
Matthias0
サインインしてコメントを残してください。
コメント
3件のコメント