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.
Add a
WithMipGap
trait and implement it for CBC, Cplex, GLPK, and Gurobi.While updating the CBC
command_name
andwith_temp_solution_file
methods I also changed them to copythreads
andseconds
fromself
instead of setting those values toNone
. Most programmers probably expect those methods to retain set values instead of resetting them toNone
.In the CBC
read_specific_solution
method I putbuffer.split_whitespace()
in a variable because the code now needs to callnext()
twice: once to look for"Optimal"
and once to examine what follows to see if the status should beSubOptimal
.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. Sinceseconds
andmipgap
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.