Getting VBasis/CBasis attributes without optimizing
AnsweredI am writing a library that will solve a series of LPs where we will manually set the basis using the VBasis/CBasis attributes. I would like to directly unit test getting/setting the basis (i.e. without optimizing a model). Is it possible to programmatically check that a manually set basis has been successfully set and is valid?
In more detail: I set a full, valid basis using the VBasis/CBasis API, then update the model. I then attempt to query the basis attributes and get Gurobi Error 10005: Unable to retrieve attribute 'V/CBasis'. If I optimize the model, then I can successfully query the basis attributes of the optimal solution.
I believe that my code is correctly setting the basis: 1) providing a valid basis does not trigger the "Warning, invalid warm-start basis discarded", 2) providing an invalid basis does trigger the warning, 3) seeding the optimal basis and then optimizing solves the problem at iteration 0 with presolve automatically disabled, and 4) seeding a suboptimal feasible basis solves the problem in >=1 iteration with presolve automatically disabled. I can pull together a minimal working example if desired.
-
Official comment
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?. -
Hi Joey,
It is not possible to check the manually set basis without actually optimizing the problem. However, you could set the IterationLimit to 0 or 1 and/or use the MESSAGE callback to check for the warning about an invalid warm-start basis.
I hope this helps.Best regards,
Jaromił0
Post is closed for comments.
Comments
2 comments