GA optimization running endlessly

1 次查看(过去 30 天)
Qing Yang Tan
Qing Yang Tan 2020-3-18
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 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by