@@ -98,15 +98,13 @@ function optimize_multiobjective!(
9898 # Add epsilon constraint
9999 sense = MOI. get (model. inner, MOI. ObjectiveSense ())
100100 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
103103 else
104- MOI. GreaterThan{Float64}, left, 1.0
104+ MOI. GreaterThan{Float64}, left
105105 end
106106 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
110108 MOI. set (model, MOI. ConstraintSet (), ci, SetType (bound))
111109 MOI. optimize! (model. inner)
112110 if ! _is_scalar_status_optimal (model)
@@ -116,7 +114,11 @@ function optimize_multiobjective!(
116114 if isempty (solutions) || ! (Y ≈ solutions[end ]. y)
117115 push! (solutions, SolutionPoint (X, Y))
118116 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
120122 end
121123 MOI. delete (model, ci)
122124 return MOI. OPTIMAL, filter_nondominated (sense, solutions)
0 commit comments