In Gurobi, model modification is performed in a lazy fashion, meaning that modifications don't affect the model immediately. Rather, the changes are queued and applied later. If your program simply creates a model and solves it, you will probably never notice this behavior. However, if you directly or indirectly query certain model information (attributes) before your modifications are applied, you may find that certain attributes are not available.
The message "Awaiting Model Update" means that a variable's information is not yet available because the model must be updated. You can execute the update function to make variable attributes accessible before optimization:
C: | GRBupdatemodel() |
C++: | GRBModel::update() |
Java: | GRBModel.update() |
C#: | GRBModel.Update() |
Python: | Model.update() |
You should not encounter this error when using MATLAB or R. In these APIs, the model structure and parameters are not passed to Gurobi's C library until the model is solved. After the model is solved, the results are collected and returned to the user in a structure that is no longer connected to Gurobi's C library. In this sense, there is no "interactive" communication with the Gurobi library like there is in the other APIs.
Please note that the X attribute is only available if a feasible solution point is available, e.g., through a previous optimization run. You can check whether a solution is available via the SolCount attribute.
Comments
0 comments
Article is closed for comments.