-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return the optimality gap of a solution #323
Comments
Hi, Yeah, you're right, prioritizr doesn't currently report this information and it looks like it might possible for Gurobi at least (using the mipgap attribute, see https://www.gurobi.com/documentation/current/refman/r_grb.html). I'll take a look and see what I can do. |
Also, in terms of storing this information, prioritizr uses attributes to append additional information to the output of |
Ah yes, I'd forgotten the attributes that are added. |
Just to follow up, I've merged a PR to the main branch that adds this functionality. After generating a solution (e.g., called |
Thanks very much for this Jeff! I just gave it a try and works perfectly. |
Awesome - thanks for trying it out! |
I can't remember if we already discussed this, so apologies if we did and the answer was 'it's not possible'!
I often solve multiple problems in a loop, saving each solution. When I use the
time_limit
parameter inadd_gurobi_solver()
the solution might not solve to the optimality gap specified it it runs out of time before reaching that gap. The optimality gap outputs to the console, but I wonder if it's possible to return the value as well, to avoid having to go through long console outputs to find optimality gaps for all solutions? It seems like it is possible to return a value from Gurobi using MIPGap, though I don't know if there exists something equivalent for other solvers. I guess the bigger problem is, what do you return the gap to since the output fromsolve()
is just the solution as e.g. a raster or sf object. One option would be to return a list with the solution as the first element and the gap as second, but this makes for a messier returned object.Just a thought, and totally understand that this might not be practical.
The text was updated successfully, but these errors were encountered: