필터 지우기
필터 지우기

passing variable through pattern search iterations

조회 수: 7 (최근 30일)
Andrea Agosti
Andrea Agosti 2020년 3월 30일
편집: Venus liria silva mendes 2021년 5월 5일
Hi everyone!
I'm using pattern search to solve a minmax problem. I know that pattern search:
1) Starts witha a polling phase where it polls the points in the current mesh by computing their objective function values,
2) it groups all the values of the objective functions and it select the mesh case with highest objective function value,
3) it moves the mesh in the last successful poll point (or it leaves the central mesh point as before) and starts again from 1),
4) this continues untill convergence is reached (possibly).
My question is: Is it possible to pass a variable from the best objective function (point 2) to the next polling phase (point 3)?
Many thanks!
  댓글 수: 3
Andrea Agosti
Andrea Agosti 2020년 3월 31일
Dear Ameer,
thanks for your answer. Yes you understood correctly, between each iteration of the pattern search I want to be able to read with the value of the objective function, also another variable. This variable will be later passed for the next iteration of pattern search.
Thanks for your help
Venus liria silva mendes
Venus liria silva mendes 2021년 5월 4일
편집: Venus liria silva mendes 2021년 5월 5일
Hi everyone
%% Modify options setting
my example problem:
[combination, custototal, exitFlag, Output, population, scores] = ga (@ smc09v7AG_01, n_vars, A, b, Aeq, beq, LB, UB, NON_linear, Integral_variables, settings)
'' population '' I'm not sure if all individuals from all generations or just the last one return. And the "scores" returns the evaluations of each one.
Hope it works!
https://www.mathworks.com/help/gads/genetic-algorithm-options.html

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 3월 31일
Following code shows how to get the information from each iteration of patternsearch
global x_iterations y_iterations
x_iterations = [];
y_iterations = [];
obj_fun = @(x) sum(x.^2.*exp(x.^2).*abs(log(x+1)));
opts = optimoptions('patternsearch', 'OutputFcn', @myOutFcn);
[x_final, f_final] = patternsearch(obj_fun, rand(1,10), [], [], [], [], [], [], [], opts);
function [stop, options, optchanged] = myOutFcn(optimvalues, options, flag)
global x_iterations y_iterations
x_iterations = [x_iterations; optimvalues.x];
y_iterations = [y_iterations; optimvalues.fval];
stop = false;
optchanged = false;
end
This page show how to define the outputFcn to get more detail for each iteration of the optimization algorithm: https://www.mathworks.com/help/gads/pattern-search-options.html#f14623
  댓글 수: 4
Zakaria
Zakaria 2020년 4월 6일
Does this methodology work with Genetic Algorithm optimizioation ?
I noticed that the structure of the OutputFcn is not the same.
Ameer Hamza
Ameer Hamza 2020년 4월 6일
Yes, it is different. Please check my answer on your question.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by