How to obtain the optimised decision variable in the lower-layer when using genetic algorithm for a two-layer optimisation problem?
3 views (last 30 days)
Show older comments
I have a two-layer optimisation problem with some decision variables, and the number of the lower-layer decision variables (DV_Low) is dependent on the upper-layer decision avriable (DV_Up). The structure of my function looks like this:
[DV_Up_Opt,Obj_Up_Opt] = ga(@Objective_function_Up,...);
function [Obj_Up] = Objective_function_Up(DV_Up)
[DV_Low_Opt,Obj_Low_Opt] = ga(@Objective_function_Low,...);
Obj_Up = Obj_Low_Opt;
function [Obj_Low] = Objective_function_Low(DV_Low);
... (the size of DV_Low is dependent on the values of DV_Up)
end
end
I want to know if there is any way for me to obtain the optimised lower-layer decision variables (DV_Low_Opt) that correspond to my optimised upper-layer decision variables (DV_Up_Opt)?
0 Comments
Accepted Answer
Alan Weiss
on 19 Jul 2023
You can write these to an array, if you like. Something like this:
function [DV_Up_Opt,Obj_Up_Opt,lowhistory] = myfun()
lowhistory = []; %%%
[DV_Up_Opt,Obj_Up_Opt] = ga(@(x)Objective_function_Up(x,lowhistory),...); %%%
function [Obj_Up,lowhistory] = Objective_function_Up(DV_Up,lowhistory)
[DV_Low_Opt,Obj_Low_Opt] = ga(@Objective_function_Low,...);
Obj_Up = Obj_Low_Opt;
lowhistory = [lowhistory;DV_Low_Opt]; %%%
function [Obj_Low] = Objective_function_Low(DV_Low);
... (the size of DV_Low is dependent on the values of DV_Up)
end
end
end
Alan Weiss
MATLAB mathematical toolbox documentation
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!