Skip to main content

Error when assigning binary variable type ('GRB' is not defined)

Answered

Comments

2 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?.
  • Sonja Mars
    • Gurobi Staff Gurobi Staff

    Hi Nicolas,

    This is probably a problem with the import of the Gurobi Python module. In our examples we do the following:

    import gurobipy as gp
    from gurobipy import GRB

    If these lines are present before you actually want to use something from our Python module (so normally, you would add them in the beginning of your file), your code should work fine. Please also see our mip1.py example.

    Best,

      Sonja

    1

Post is closed for comments.