Skip to main content

Model creation fails for larger models with "NullPointerException: Cannot invoke "gurobi.GRBVar.getcolno()" because "v" is null"

Answered

Comments

2 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    It is hard to help here without a minimal reproducible example. Your code snippet uses many objects and data structures not defined in the snippet. Additionally, please post a screenshot of the full error code.

    ' "v" is null' indicates that a variable object you pass is NULL instead of GRBVar. This may happen if, e.g., vars[Pair(a,b)] has not been added to the model yet.

    0
  • Sven Fiergolla
    Gurobi-versary
    First Comment
    First Question

    Thanks for your quick reply.

    ' "v" is null' indicates that a variable object you pass is NULL instead of GRBVar. This may happen if, e.g., vars[Pair(a,b)] is not present.

    I kind of excluded this possibility and expected another error but you are right, some of the vars were not present. Now it's running like a charm.

    0

Please sign in to leave a comment.