How should I write the fitness function for a function(fun1) with double summation
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Nadeem Aamir
il 5 Mag 2020
Commentato: Star Strider
il 6 Mag 2020
M = 8;
N = 5;
5≤x(1) ≤ 20
7≤x(2) ≤ 15
0≤x(3) ≤ 1
5≤x(4) ≤ 20
7≤x(5) ≤ 15
0≤x(6) ≤ 1
fun1 = 
0 Commenti
Risposta accettata
Star Strider
il 5 Mag 2020
This seems straightforward (at least to me, unless there is more to this than is posted):
fcn = @(x,M,N) M*(x(1)/(x(2)+5)-x(3)) + N*(x(4)/(x(5)+5)-x(6));
then with ‘M’ and ‘N’ defined in the workspace, call it as:
ftns = @(x) fcn(x,M,N)
If you are using the ga (genetic algorithm) function, it is straightforward to constrain the parameters. See the documentation for that.
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Genetic Algorithm in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!