-
Notifications
You must be signed in to change notification settings - Fork 9
Update DominguezRios to delete boxes that are already searched. #166
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #166 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 1206 1213 +7
=========================================
+ Hits 1206 1213 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Refactor objective function creation and update constraints.
|
I'd write it like this: diff --git a/src/algorithms/DominguezRios.jl b/src/algorithms/DominguezRios.jl
index e5d8d4c..54ca9ae 100644
--- a/src/algorithms/DominguezRios.jl
+++ b/src/algorithms/DominguezRios.jl
@@ -148,6 +148,10 @@ function _update!(
return
end
+_isapprox(::Nothing, ::_DominguezRiosBox) = false
+
+_isapprox(A::_DominguezRiosBox, B::_DominguezRiosBox) = A.l ≈ B.l && A.u ≈ B.u
+
function minimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
@assert MOI.get(model.inner, MOI.ObjectiveSense()) == MOI.MIN_SENSE
n = MOI.output_dimension(model.f)
@@ -190,6 +194,7 @@ function minimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
solutions = SolutionPoint[]
k = 0
status = MOI.OPTIMAL
+ B_prev = Vector{Union{Nothing,_DominguezRiosBox}}(nothing, n)
while any(!isempty(l) for l in L)
if (ret = _check_premature_termination(model)) !== nothing
status = ret
@@ -197,6 +202,11 @@ function minimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
end
i, k = _select_next_box(L, k)
B = L[k][i]
+ if _isapprox(B_prev[k], B)
+ deleteat!(L[k], i)
+ continue
+ end
+ B_prev[k] = B
# We're going to scale `w` here by `scale` instead of the usual
# `1 / max(...)`. It will show up in a few places bbelow.
w = scale ./ max.(1, B.u - yI) |
odow
left a 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.
I guess the alternative is to change the _update! function so that we don't keep adding previously searched boxes?
No description provided.