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

C++ GRBModel::addvars() problem

回答済み

コメント

5件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff Gurobi Staff
    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?.
  • Gwyneth Butera
    • Gurobi Staff Gurobi Staff

    Hi Sebastian - 

    The fourth argument to addVars() ("type") should be an array of length "count". 

    I hope this helps,

    Gwyneth

    0
  • Sebastían Díaz
    • Gurobi-versary
    • First Comment
    • First Question

    I got another error because when i use the array i got invalid type and the constant for binary is "B".

     

    Thanks for responding. 

    0
  • Gwyneth Butera
    • Gurobi Staff Gurobi Staff

    Hi Sebastian - This doesn't work because "B" is not an array of length arcos.size().

    char type[] = {GRB_BINARY, GRB_BINARY, GRB_BINARY};
    ...
    x = model.addVars(0,0,obj,type,name,3);

    I hope this helps.

    0
  • Sebastían Díaz
    • Gurobi-versary
    • First Comment
    • First Question

    thanks that help me alot

    0

投稿コメントは受け付けていません。