Skip to content

Commit ee16b31

Browse files
committed
Minor fixes for DominguezRios
1 parent 08f7799 commit ee16b31

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

src/algorithms/DominguezRios.jl

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ end
6767

6868
function _select_next_box(L::Vector{Vector{_DominguezRiosBox}}, k::Int)
6969
p = length(L)
70-
if any(.!isempty.(L))
70+
@assert any(!isempty(l) for l in L)
71+
k = k % p + 1
72+
while isempty(L[k])
7173
k = k % p + 1
72-
while isempty(L[k])
73-
k = k % p + 1
74-
end
75-
i = argmax([B.priority for B in L[k]])
7674
end
75+
i = argmax([B.priority for B in L[k]])
7776
return i, k
7877
end
7978

@@ -190,7 +189,7 @@ function minimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
190189
end
191190
i, k = _select_next_box(L, k)
192191
B = L[k][i]
193-
# We're goign to scale `w` here by `scale` instead of the usual
192+
# We're going to scale `w` here by `scale` instead of the usual
194193
# `1 / max(...)`. It will show up in a few places bbelow.
195194
w = scale ./ max.(1, B.u - yI)
196195
constraints = [
@@ -208,19 +207,18 @@ function minimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
208207
new_f = t_max + ϵ * sum(w[i] * (scalars[i] - yI[i]) for i in 1:n)
209208
MOI.set(model.inner, MOI.ObjectiveFunction{typeof(new_f)}(), new_f)
210209
MOI.optimize!(model.inner)
211-
if _is_scalar_status_optimal(model)
212-
X, Y = _compute_point(model, variables, model.f)
213-
obj = MOI.get(model.inner, MOI.ObjectiveValue())
214-
# We need to undo the scaling of the scalar objective. There's no
215-
# need to unscale `Y` because we have evaluated this explicitly from
216-
# the modified `model.f`.
217-
obj /= scale
218-
if (obj < 1) && all(yI .< B.u)
219-
push!(solutions, SolutionPoint(X, Y))
220-
_update!(L, Y, yI, yN)
221-
else
222-
deleteat!(L[k], i)
223-
end
210+
@assert _is_scalar_status_optimal(model)
211+
X, Y = _compute_point(model, variables, model.f)
212+
obj = MOI.get(model.inner, MOI.ObjectiveValue())
213+
# We need to undo the scaling of the scalar objective. There's no
214+
# need to unscale `Y` because we have evaluated this explicitly from
215+
# the modified `model.f`.
216+
obj /= scale
217+
if (obj < 1) && all(yI .< B.u)
218+
push!(solutions, SolutionPoint(X, Y))
219+
_update!(L, Y, yI, yN)
220+
else
221+
deleteat!(L[k], i)
224222
end
225223
MOI.delete.(model.inner, constraints)
226224
end

test/algorithms/DominguezRios.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ end
3838

3939
function test_vOptLib_runtests()
4040
model = MOA.Optimizer(HiGHS.Optimizer)
41+
MOI.set(model, MOI.RawOptimizerAttribute("presolve"), "off")
4142
MOI.set(model, MOA.Algorithm(), MOA.DominguezRios())
4243
MOI.set(model, MOI.Silent(), true)
43-
# TODO(odow): it doesn't terminate
44-
# vOptLib.run_tests(model)
44+
vOptLib.run_tests(model)
4545
return
4646
end
4747

0 commit comments

Comments
 (0)