Skip to content
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

Mipgap #6

Merged
merged 12 commits into from
Aug 17, 2023
Merged

Mipgap #6

merged 12 commits into from
Aug 17, 2023

Conversation

mfuhr
Copy link
Contributor

@mfuhr mfuhr commented Aug 16, 2023

Add a WithMipGap trait and implement it for CBC, Cplex, GLPK, and Gurobi.

While updating the CBC command_name and with_temp_solution_file methods I also changed them to copy threads and seconds from self instead of setting those values to None. Most programmers probably expect those methods to retain set values instead of resetting them to None.

In the CBC read_specific_solution method I put buffer.split_whitespace() in a variable because the code now needs to call next() twice: once to look for "Optimal" and once to examine what follows to see if the status should be SubOptimal.

In the CBC arguments method I replaced the redundant setting of the timeout with the code to set the MIP gap.

In the Glpk arguments method I got rid of the iterator as suggested for the PR that implemented it. Since seconds and mipgap have different types I couldn't just add another tuple to the array that was being iterated over.

I don't have access to Cplex or Gurobi command line interfaces so I couldn't verify that they work, nor do I know how to recognize when a solution is suboptimal for those solvers. I relied solely on documentation to set the MIP gap arguments.

@lovasoa
Copy link
Contributor

lovasoa commented Aug 16, 2023

Great ! Maybe you could add some little tests that assert what the command arguments look like after a few with_xxx() calls ?

@mfuhr
Copy link
Contributor Author

mfuhr commented Aug 16, 2023

Tests added!

@lovasoa lovasoa merged commit c0cb125 into rust-or:master Aug 17, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants