Return Functions and conditional execution in GA.

2 vues (au cours des 30 derniers jours)
Zaharaddeen Hussaini
Zaharaddeen Hussaini le 8 Avr 2019
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

Réponses (0)

Catégories

En savoir plus sur Agriculture dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by