Using patternsearch to calculate 4 variables - Optimisation toolbox

Hi all,
I'm trying to use either a genetic (GA) or pattern search (PS) optimisation to calculate x,y (coordinates of the centre),a (semi-major axis) and theeta (orientation), four variables which define the position and shape of the elliptical delamination most likely to propagate on a composite plate. x,y,a and theeta are then written into a .dat file which is used by the SAMCEF finite element package to calculate the frequency shift under its first four resonance modes between an undamaged and a damaged plate. This process is repeated until the position of the maximum frequency shift (or min 1/df for the minimising algorithms) is found.
When I use the GA, the process works fine and the values are input into the .dat file and read by samcef. The values change in the dat file on each loop. However, upon trying it with PS the intial values are input to the .dat file and don't ever change. Hence every loop repeats the exact same calculation.
Both PS and GA work fine when I use a circular ellipse (i.e. only 2 variables - x,y)
My lines of code are as follows,
% GA
options=gaoptimset('Display','final','PopulationSize',20,'Generations',50,'StallGenLimit',5,'TolFun',1e-3); [x,fval,exitflag,output,population] = ga(@fmin,4,[],[],[],[],[0.0101,0,0.018,0.018],[0.016,180,0.182,0.182],@nonlin,options);
% PS options=psoptimset('Display','final','CompletePoll','on','Searchmethod',@searchlhs,'CompleteSearch','on','cache','on','TolFun',1.e-3,'TolX',1.e-3); [x,fval,exitflag,output] = patternsearch(@fmin,[0.0101,0,0.018,0.182],[],[],[],[],[0.0101,0,0.018,0.018],[0.016,180,0.182,0.182],@nonlin,options);
@fmin is the SAMCEF finite element calculation Could someone please tell me how to get PS to work using 4 variables rather than 2?
Thanks a lot for your help. I hope I've been able to explain my problem well enough.
Cheers!

 Accepted Answer

Because of your very tight bounds, I suspect that your TolX and TolFun settings are stopping things too early. I suggest that you try patternsearch optimization using no search method, and using the default options, except perhaps keep CompletePoll = 'on'.

1 Comment

Cheers Alan,
That seems to work. However, lets see if it varies the semi major axis and the orientation as I want it to.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!