-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLEMO #6
Comments
Here is an example: using BilevelHeuristics
# upper-level objective function
function F(x, y)
F1 = y[1] - x[1] # objective function 1
F2 = y[2] # objective function 2
G1 = -1.0 - sum(y) # G(x,y) <= 0 is feasible
H1 = 0.0 # equality constraint
Fxy = [F1, F2]
Gxy = [G1]
Hxy = [H1]
return Fxy, Gxy, Hxy
end
# lower-level objective function
function f(x, y)
f1 = y[1] # objective function 1
f2 = y[2] # objective function 2
g1 = sum(y.^2) - x[1]^2 # g(x,y) <= 0 is feasible
h1 = 0.0 # equality constraint
fxy = [f1, f2]
gxy = [g1]
hxy = [h1]
return fxy, gxy, hxy
end
# boundaries by cols
bounds_ul = Matrix([0.0 1]')
bounds_ll = [-1.0 -1.0; 1.0 1.0]
# general options (settings)
options_ul = Options(iterations = 40, f_calls_limit=Inf, seed=1) # upper level
options_ll = Options(iterations = 40, f_calls_limit=Inf) # lower level
# Optimizer for each level
nsga2_ul = NSGA2(N = 400, p_m = 0.1, η_m = 20, η_cr = 15, p_cr = 0.9)
nsga2_ll = NSGA2(N = 40, p_m = 0.1, η_m = 20, η_cr = 15, p_cr = 0.9)
blemo = BLEMO(;ul = nsga2_ul, ll = nsga2_ll, options_ul, options_ll)
results = optimize(F, f, bounds_ul, bounds_ll, blemo);
# Get values saved in the archive
A_ul = map(s -> s[1], blemo.parameters.archive) # upper level
A_ll = map(s -> s[2], blemo.parameters.archive) # corresponding lower level
# get objective function values
Fxy = fvals(A_ul)
fxy = fvals(A_ll)
X = positions(A_ul)
Y = positions(A_ll)
You can save this code into See here for more details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If there is an example for bilevel multi-objective problem with constrained conditon using BLEMO algorithm.
The text was updated successfully, but these errors were encountered: