1- function _halfspaces (IPS:: Vector{Vector{Float64}} )
2- error (" MOA.Sandwiching requires Polyhedra.jl to be loaded" )
1+ function _halfspaces (IPS)
2+ return error (" MOA.Sandwiching requires Polyhedra.jl to be loaded" )
33end
44
55mutable struct Sandwiching <: AbstractAlgorithm
@@ -80,7 +80,7 @@ function optimize_multiobjective!(algorithm::Sandwiching, model::Optimizer)
8080 @info " yI: $(yI) "
8181 @info " yUB: $(yUB) "
8282 IPS = [yUB, keys (anchors)... ]
83- OPS = Tuple{Vector{Float64}, Float64}[]
83+ OPS = Tuple{Vector{Float64},Float64}[]
8484 for i in 1 : n
8585 e_i = Float64 .(1 : n .== i)
8686 push! (OPS, (e_i, yI[i])) # e_i' * y >= yI_i
@@ -90,17 +90,13 @@ function optimize_multiobjective!(algorithm::Sandwiching, model::Optimizer)
9090 @info " OPS: $(OPS) "
9191 u = MOI. add_variables (model. inner, n)
9292 u_constraints = [ # u_i >= 0 for all i = 1:n
93- MOI. add_constraint (
94- model. inner,
95- u_i,
96- MOI. GreaterThan {Float64} (0 ),
97- )
93+ MOI. add_constraint (model. inner, u_i, MOI. GreaterThan {Float64} (0 ))
9894 for u_i in u
9995 ]
10096 f_constraints = [ # f_i + u_i <= yUB_i for all i = 1:n
10197 MOI. Utilities. normalize_and_add_constraint (
10298 model. inner,
103- scalars[i] + u[i],
99+ scalars[i] + u[i],
104100 MOI. LessThan (yUB[i]),
105101 ) for i in 1 : n
106102 ]
@@ -116,7 +112,7 @@ function optimize_multiobjective!(algorithm::Sandwiching, model::Optimizer)
116112 @info " Selected halfspace: w: $(w) , b: $(b) "
117113 @info " δ: $(δ) "
118114 if δ - tol > ε # added some convergence tolerance
119- # would not terminate when precision is set to 0
115+ # would not terminate when precision is set to 0
120116 new_f = sum (w[i] * (scalars[i] + u[i]) for i in 1 : n) # w' * (f(x) + u)
121117 MOI. set (model. inner, MOI. ObjectiveFunction {typeof(new_f)} (), new_f)
122118 MOI. optimize! (model. inner)
@@ -142,4 +138,4 @@ function optimize_multiobjective!(algorithm::Sandwiching, model::Optimizer)
142138 MOI. delete .(model. inner, u_constraints)
143139 MOI. delete .(model. inner, u)
144140 return MOI. OPTIMAL, [SolutionPoint (X, Y) for (Y, X) in solutions]
145- end
141+ end
0 commit comments