Skip to main content

Usage of variable as key during building of model - Python API

Answered

Comments

3 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?.
  • Jaromił Najman
    • Gurobi Staff Gurobi Staff

    Hi Grzegorz,

    Unfortunately, in order to access and make use of the variable objects while constructing the your model, you have to call the update function due to Gurobi's lazy update approach.

    Is there a particular reason why you would like to use the variable object as key instead of the variable name? You could also just get the variable object by using the getVarByName function.

    Best regards,
    Jaromił

    0
  • Grzegorz Siekaniec
    • Gurobi-versary
    • Curious
    • First Comment

    Hi Jaromił, thanks for finding time to provide an answer. The reason why I want to have bidrectional dictionary is to map business domain objects with variables so it is easier to query solution and then take actions on those objects. Otherwise, I need to use a variable name as a proxy. I ended up with populating regular dictionary in the beginning and then populating bidirectional dictionary after calling update function.

    0

Post is closed for comments.