Return Functions and conditional execution in GA.

2 次查看(过去 30 天)
Hi, I am trying to change my code to work with ga. Formerly I had to create another function file that puts in all my variables in a loop. This was cumberomse and time consuming.
Unfortunatel I had to ask this question again but this time I have attached all the files. Hopefully it will help to understand
When using ga, the file works however it takes a very long time hence my doubts if fitness functions such as this is recommended.
Also the NaN might not be a good idea but I am not sure if the if condition below (full code is attached) can be depicted as a contraint. Any form of guidance will be appreciated.
Thank you
(Here below are bits of the function file)
function lcoe = taggered(X)
XC_GA = X;
X(1) = round(X(1));
LW = sqrt(XC_GA(2));
LH = sqrt(XC_GA(2));
XC_GA(6) = XC_GA(6).* DM;
...
HeliostatCost = (145.* HeliostatCount .* XC_GA(2)) ;
TowerCost = 3000000 .* exp(0.0113.* (XC_GA(3) - (XC_GA(5)./2) +((sqrt(XC_GA(2))./2))));
ReceiverCost = 103000000 * ((2.* pi* XC_GA(4) .* XC_GA(5))./1571).^0.7;
Total_Cost = ReceiverCost + TowerCost + HeliostatCost;
if Power >= (PowerLimit-0.05) && Power <= (PowerLimit+0.05)
lcoe = Total_Cost/Annual_power1
else
lcoe = NaN;
end
end

回答(0 个)

类别

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

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by