MATLAB: Optimising using a combination of linear equality constraints and no constraints

optimizationpatternsearch

Hi,
I am currently trying to optimise at 18 variable input. 13 of my variables don't require any constraints on them except for ub and lb. 5 of the variables are summed to 1. I tried using simulannealbnd and normalising these weightings to each other. I have tried using patternsearch but patternsearch only seemed to consider the variables in the linear equality.
Does any one have any advise on what optimiser to use?
% set upper and lower bounds for time (s), PID and Error:
LB=[0.15,...%time delay

0,0,0,0,0,...%noise

0,0,0,0,0,0,0,...%gains

0,0,0,0,0]; %weights to sum to 1

UB=[0.15,...%time delay
1/10000,1/10000,1/1000,1/1000,1/1000,...%noise
10,10,500,1500,500,2,2,...%gains
1,1,1,1,1];%weights to sum to 1
INPUT=(LB+UB)/2; %set initial guess in the middle
Aeq=[zeros(1,13),ones(1,5)];
ObjectiveFunction=@(x) NN_v1_2_Parfor(INPUT,setup);
[x,fval,exitFlag,output] = patternsearch(ObjectiveFunction,INPUT,[],[],Aeq,1,LB,UB);

Best Answer

I don't know whether your objective function is smooth or not. If it is smooth (differentiable), I would suggest that you use fmincon as your solver. If it is not smooth, then use patternsearch with the following option change:
options = optimoptions('patternsearch','PollMethod','GSSPositiveBasis2N');
Be sure to pass options in your solver call.
I also suggest that you remove variable 1 from the problem entirely, so your problem is 17 variables. And I suggest that you rescale your variables so that all are of the same order. Your objective function internally should divide the first five variables by 1000, and the upper bound for the first five variables should be 1. Similarly, the new variables 8, 9, and 10 should internally be multiplied by 500, 1500, and 500 respectively, and the corresponding upper bounds should all be 1.
Alan Weiss
MATLAB mathematical toolbox documentation