@@ -24,37 +24,30 @@ function MOA.minimize_multiobjective!(
2424 # Storage we need for the algorithm.
2525 weights, solutions = Weight[], MOA. SolutionPoint[]
2626 n_obj = MOI. output_dimension (model. f)
27+ existing_sol = Dict {Vector{Int},Int} ()
2728 # First, search for an initial primal feasible point.
28- init_sol_idx = 0
29- status, solution = nothing , nothing
3029 for i in 1 : n_obj
3130 w = zeros (Float64, n_obj)
3231 w[i] = 1.0
3332 status, solution = MOA. _solve_weighted_sum (model, alg, w)
34- if solution ! == nothing
35- init_sol_idx = i
36- push! (solutions, solution)
37- break
33+ if solution = == nothing
34+ # One of the subproblems failed to solve. This means something went
35+ # really wrong. A common reason is that the problem is unbounded.
36+ return status, nothing
3837 end
38+ push! (solutions, solution)
39+ model. ideal_point[i] = solution. y[i]
3940 end
40- if length (solutions) == 0
41- return status, nothing
42- end
43- # Initialize the weights. There is one weight vector for each objective, and
44- # the weight is set to 1.0 for each objective. We use the current solution
45- # obtained by minimizing the 1st objective as the reference.
41+ solution = solutions[1 ]
42+ existing_sol[_round (solution. y; atol)] = 1
4643 for i in 1 : n_obj
4744 w = zeros (Float64, n_obj)
4845 w[i] = 1.0
4946 z = w' * solution. y
5047 adj_bnd = Int[- j for j in 1 : n_obj if j != i]
51- tested = i <= init_sol_idx
52- removed = i < init_sol_idx
53- push! (weights, Weight (w, z, adj_bnd, [1 ], tested, removed))
48+ push! (weights, Weight (w, z, adj_bnd, [1 ], i == 1 , false ))
5449 end
55- # Prevent solution duplicates: existing_sol maps an rounded objective vector
56- # to its index in `solutions::Vector{MOA.SolutionPoint}`.
57- existing_sol = Dict (_round (solution. y; atol) => 1 )
50+ status = MOI. OPTIMAL
5851 n_removed = 0
5952 while length (solutions) < MOI. get (alg, MOA. SolutionLimit ())
6053 if (ret = MOA. _check_premature_termination (model)) != = nothing
0 commit comments