@@ -98,15 +98,13 @@ function optimize_multiobjective!(
98
98
# Add epsilon constraint
99
99
sense = MOI. get (model. inner, MOI. ObjectiveSense ())
100
100
variables = MOI. get (model. inner, MOI. ListOfVariableIndices ())
101
- SetType, bound, direction = if sense == MOI. MIN_SENSE
102
- MOI. LessThan{Float64}, right, - 1.0
101
+ SetType, bound = if sense == MOI. MIN_SENSE
102
+ MOI. LessThan{Float64}, right
103
103
else
104
- MOI. GreaterThan{Float64}, left, 1.0
104
+ MOI. GreaterThan{Float64}, left
105
105
end
106
106
ci = MOI. add_constraint (model, f1, SetType (bound))
107
- # Set a finite upper bound on the number of iterations so that we don't loop
108
- # forever.
109
- for i in 1 : ceil (Int, abs (right - left) / ε + 3 )
107
+ while true
110
108
MOI. set (model, MOI. ConstraintSet (), ci, SetType (bound))
111
109
MOI. optimize! (model. inner)
112
110
if ! _is_scalar_status_optimal (model)
@@ -116,7 +114,11 @@ function optimize_multiobjective!(
116
114
if isempty (solutions) || ! (Y ≈ solutions[end ]. y)
117
115
push! (solutions, SolutionPoint (X, Y))
118
116
end
119
- bound = Y[1 ] + direction * ε
117
+ if sense == MOI. MIN_SENSE
118
+ bound = min (Y[1 ] - ε, bound - ε)
119
+ else
120
+ bound = max (Y[1 ] + ε, bound + ε)
121
+ end
120
122
end
121
123
MOI. delete (model, ci)
122
124
return MOI. OPTIMAL, filter_nondominated (sense, solutions)
0 commit comments