-
Notifications
You must be signed in to change notification settings - Fork 0
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
adding relative & absolute mip gaps #17
adding relative & absolute mip gaps #17
Conversation
test/all_tests.jl
Outdated
@@ -81,6 +81,8 @@ end | |||
# solve and check output is expected for each input json file | |||
@testset "$j" for j in json_names | |||
output = JSON3.read(run_solve(read_json("inputs", j))) | |||
@info output | |||
#isdefined(Main, :Infiltrator) && Main.infiltrate(@__MODULE__, Base.@locals, @__FILE__, @__LINE__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the @info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh my goodness. thought i 've removed them. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/SolverAPI.jl
Outdated
@@ -111,6 +111,16 @@ function response( | |||
res["solve_time_sec"] = Float64(MOI.get(model, MOI.SolveTimeSec())) | |||
|
|||
result_count = MOI.get(model, MOI.ResultCount()) | |||
|
|||
try | |||
res["relative_gap"] = Float64(MOI.get(model, MOI.RelativeGap())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes a little more sense to do
rel_gap = Float64(MOI.get(model, MOI.RelativeGap()))
and then only set res["relative_gap"]
if it's finite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. good point
res["relative_gap"] = Float64(MOI.get(model, MOI.RelativeGap())) | ||
if isinf(res["relative_gap"]) | ||
res["relative_gap"] = nothing # Inf cannot be serialized to JSON | ||
res["relative_gap"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line?
src/SolverAPI.jl
Outdated
res["relative_gap"] | ||
rel_gap = Float64(MOI.get(model, MOI.RelativeGap())) | ||
if isinf(rel_gap) | ||
res["relative_gap"] = rel_gap# Inf cannot be serialized to JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res["relative_gap"] = rel_gap# Inf cannot be serialized to JSON | |
res["relative_gap"] = rel_gap # Inf cannot be serialized to JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, it should be if !isinf(rel_gap)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Co-authored-by: Chris Coey <[email protected]>
nice! good to merge when green |
https://relationalai.atlassian.net/jira/software/c/projects/RAI/boards/41?search=jian&selectedIssue=RAI-17621
Added supports for relative_gap_tolerance and absolute_gap_tolerance, and the report of final relative_gap from solver. Note that MOI doesn't support reporting the final absolute gap.