Skip to content

Commit ba4fdf4

Browse files
committed
Update
1 parent a028157 commit ba4fdf4

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/algorithms/TambyVanderpooten.jl

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,13 @@ function _minimize_multiobjective!(
193193
) for (i, f_i) in enumerate(scalars)
194194
]
195195
obj_constants = MOI.constant.(scalars)
196-
# U_N:
197-
# keys: upper bound vectors
198-
# values: a vector with n elements, U_N[u][k] is a vector of y
199196
U_N = Dict{Vector{Float64},Vector{Vector{Vector{Float64}}}}(
200197
# The nadir point, except for the ideal point in position k
201198
yN => [[_get_child(yN, yI, k)] for k in 1:n],
202199
)
203200
V = [Tuple{Vector{Float64},Vector{Float64}}[] for k in 1:n]
204201
status = MOI.OPTIMAL
205-
sum_f = sum(1.0 * s for s in scalars)
202+
sum_f = MOI.Utilities.operate(+, Float64, scalars...)
206203
while !isempty(U_N)
207204
if (ret = _check_premature_termination(model)) !== nothing
208205
status = ret
@@ -219,14 +216,12 @@ function _minimize_multiobjective!(
219216
set = MOI.LessThan(u_i - 1.0 - obj_constants[i])
220217
MOI.set(inner, MOI.ConstraintSet(), ε_constraints[i], set)
221218
end
222-
# The isapprox is another way of saying does U_N[u][k] exist
223-
if warm_start_supported && !isapprox(u[k], yN[k]; atol = 1e-6)
219+
if warm_start_supported && !isempty(solutions)
224220
for (x_i, start_i) in solutions[last(U_N[u][k])]
225221
MOI.set(inner, MOI.VariablePrimalStart(), x_i, start_i)
226222
end
227223
end
228-
optimize_inner!(model)
229-
# We don't log this first-stage subproblem.
224+
optimize_inner!(model) # We don't log this first-stage subproblem.
230225
status = MOI.get(inner, MOI.TerminationStatus())
231226
if !_is_scalar_status_optimal(status)
232227
break
@@ -260,15 +255,14 @@ end
260255
# loop over u′ is the same, but we break the inner `foreach k` loop up into
261256
# separate loops so that we don't need to loop over all `V` if one of the u′ has
262257
# reached the ideal point.
263-
#
264-
# TODO: this loop is a good candidate for parallelisation.
265-
#
266-
# TODO: we could probably also be cleverer here, and just do a partial update
267-
# based on the most recent changes to V. Do we need to keep re-checking
268-
# everything?
269258
function _clean_search_region(U_N, yI, V, k)
270-
for u′ in keys(U_N)
271-
if _clean_search_region_inner(u′, U_N, yI, V, k)
259+
map_keys = collect(enumerate(keys(U_N)))
260+
to_delete = fill(false, length(map_keys))
261+
Threads.@threads for (i, u′) in map_keys
262+
to_delete[i] = _clean_search_region_inner(u′, U_N, yI, V, k)
263+
end
264+
for (i, u′) in map_keys
265+
if to_delete[i]
272266
delete!(U_N, u′)
273267
end
274268
end

0 commit comments

Comments
 (0)