Skip to main content

Change variable type?

Answered

Comments

5 comments

  • Official comment
    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?.
  • Eli Towle
    Gurobi Staff Gurobi Staff

    Hi Fulya,

    You can modify the VType attribute of the corresponding GRBVar object. E.g., in Java:

    v.set(GRB.CharAttr.VType, GRB.CONTINUOUS)

    Thanks,

    Eli

    1
  • Fulya Terzi
    Gurobi-versary
    First Comment
    Curious

    Thank a lot. I got an error such as Cannot invoke set(GRB.CharAttr, char) on the array type GRBVar[].

    Since my object is GRBVar[]. How will I make for array type GRBVar?

     

    Thank you in advance

    0
  • Fulya Terzi
    Gurobi-versary
    First Comment
    Curious

    for (Map.Entry<String, GRBVar[]> varEntry : DecVariables.entrySet()) //IloIntVar[]

            varEntry.getValue(). set(GRB.CharAttr.VType, GRB.CONTINUOUS); // The error message: Cannot invoke set(GRB.CharAttr, char) on the array type GRBVar[]

    0
  • Eli Towle
    Gurobi Staff Gurobi Staff

    Hi Fulya,

    You have to loop over the array and set the VType attribute for each GRBVar element individually.

    Thanks,

    Eli

    1

Post is closed for comments.