Optimising using a combination of linear equality constraints and no constraints
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Adam Handley
am 27 Jul. 2020
Kommentiert: Adam Handley
am 28 Jul. 2020
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);
0 Kommentare
Akzeptierte Antwort
Alan Weiss
am 27 Jul. 2020
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
7 Kommentare
Alan Weiss
am 28 Jul. 2020
Your problem needs to be better defined. Are you trying to minimize the mean of something? Then you need to take enough samples to have a good estimate of the mean. This might imply that your simulation should be run many, many times for each parameter, and the whole computation will then be slow.
I suspect that you need to think hard about what exactly you are attempting to do. What is the real objective function? The theoretical, deterministic thing that you are trying to optimize? Is there any way to calculate it, or can you only obtain samples from a distribution?
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!