GA optimization running endlessly
1 view (last 30 days)
Show older comments
I have been trying to use the Genetic Algorithm to find the lowerest point in of an output over a range of value (variable i) in simulink. Please note that variable i is feed into 3 different blocks (all normalised).
Attached in my matlab code:
function[Mdot]=FYPoptver1()
v=linspace(0,1,3);
i=[t,v]; % i is a range of input into the simulink model
lb = [0];
ub = [1];
rng default % For reproducibility
options = simset('SrcWorkspace','base','ReturnWorkspaceOutputs','on','DstWorkspace','current');
Mdot=sim('FYPver6',380); %Simulink model, time final
[fuelburn,fval] = ga(@FYPoptver1,1,lb,ub) %not quite sure if nvars = 1 but only but i assume as there is only input i in the simulink model hence 1
end
As the simulation is seemingly taking endless time, my guess is its probably because there are 4 'to workspace' in the simulink model. Is there any way to specify the exact output to find the lowest value? If not, is there anything else that I can do/done wrongly?
I have also read this discussion (below) that suggest that GA might not the right tool to use in this case. If so, I only have 1 more question, how do I set the condition where the solver will stop?
0 Comments
Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!