How do i create two-dimensional array variable using addvars() in C++

Answered

Comments

2 comments

  • Jaromił Najman

    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
    Comment actions Permalink
  • Hongdong Xiong

    Thanks it help me a lot!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk