How to obtain the optimised decision variable in the lower-layer when using genetic algorithm for a two-layer optimisation problem?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Xuming Yuan
il 19 Lug 2023
Commentato: Xuming Yuan
il 2 Ago 2023
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 Commenti
Risposta accettata
Alan Weiss
il 19 Lug 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
3 Commenti
Alan Weiss
il 1 Ago 2023
That is a very interesting finding. I am not sure how the nested objective function behaves with the lowhistory data passed the way you do it.
As you probably know, ga in parallel distributes the objective function to various workers to evaluate. When doing so, it packages lowhistory as data along with the evaluation point. Because of the way you pass lowhistory as input and output from Objective_function_Up, I am not completely sure what happens, whether things are getting passed the way you want to the various workers, or whether things somehow get mixed up because the workers have different versions of lowhistory. I do not have time right now to investigate, sorry, but it might be worth trying to figure out what you want lowhistory to represent in a parallel computation. Do you want the workers to have different versions of lowhistory? How do you want to recombine them into a sensible history? Or do I misunderstand entirely?
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Genetic Algorithm in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!