How to obtain the optimised decision variable in the lower-layer when using genetic algorithm for a two-layer optimisation problem?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Alan Weiss
2023년 7월 19일
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
Alan Weiss
2023년 8월 1일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!