How do i create two-dimensional array variable using addvars() in C++
回答済みhi, I want to create a 47*96 two-dimensional array of multiple decision variables in C++ following the documentation, but got errors. How to create it correctly


0
-
正式なコメント
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,
The C++ addVars function does not create a multidimensional array but a one dimensional array. In order to construct a 2 dimensional array of GRBVar objects, you can use
GRBVar* v[47];
for (int i = 0; i<47; i++)
{
v[i] = model.addVars(96);
}You can then access the variables via \(\texttt{v[i][j]}\).
Best regards,
Jaromił1 -
Thanks it help me a lot!
0
投稿コメントは受け付けていません。
コメント
3件のコメント