Skip to main content

GurobiError: No variable names available to index

Answered

Comments

4 comments

  • Eli Towle
    Gurobi Staff Gurobi Staff

    Hi Rohan,

    You could see this error if you are trying to read a solution file into a model with no variables. Did you add variables to the model (named to match the variables in the .mst file) prior to calling Model.read()?

    Thanks,

    Eli

    0
  • Rohan Bhatia
    Gurobi-versary
    First Comment
    First Question

    Hi Eli! Thanks for the comment. Actually, the model contains all the variables when I'm calling model.read. I'm calling it just before model.optimize().

    Could there be any other reasons for this error?

    Thanks,
    Rohan

    0
  • Eli Towle
    Gurobi Staff Gurobi Staff

    Hi Rohan,

    Could you try calling Model.update() immediately before reading the .mst file? Thanks!

    Eli

    2
  • Rohan Bhatia
    Gurobi-versary
    First Comment
    First Question

    Hi Eli,

    It worked! Thanks!

    Rohan

    1

Please sign in to leave a comment.