メインコンテンツへスキップ

GRBVar::index() seems to not exist

進行中

コメント

2件のコメント

  • Marika Karbstein
    • Gurobi Staff Gurobi Staff

    That is right, the functions GRBVar::index() and GRBConstr:index() are not available in Gurobi Version 8.1.

    The documentation on the Gurobi Webiste can be filtered by version. In this way, you will only see the functions that are really available.

    0
  • Elisheva Rabinowitz
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you!

    As a followup question, in the version I'm using (8.1), is there any easy way to find out if a GRBVar object is in fact initialized?

    For example, if at some point in my code I have an array of type GRBVar and later on want to check which indices contain active variables, is there an easy way for me to do that? The relevant code would look something like

    GRBVar v[10];

    ....

    v[i] = addVar(0, 0, ...);

    for some index i, and then later on I would like to have a condition of the sort

    if(v[3]){

    ....

    which checks if v[3] has a value that has been returned from addVar/s.

    Currently, I used GRBModel::getVars() and iterated through the returned array, while checking for each existing variable if is v[3], using GRBVar::sameAs(v[3]). Is there a more elegant way to do this?

    Thanks

    0

サインインしてコメントを残してください。