# Help !! How to use Genetic Algorithm for maximisation process as it is used for minimisation process?

1 Ansicht (letzte 30 Tage)
ad aymen am 28 Aug. 2020
Kommentiert: ad aymen am 9 Sep. 2020
How to use Genetic Algorithm for maximisation process as it is used for minimisation process?
There are those who tell you other than the sign equation
but I can't change it cos it is an equation preserved by neural networks
This work improves the linear actuator so that it is sandwiched between LB and LU
I want the most value for ' y '
fitness=@fen;
nvars=2; % Number of variables
LB=[... ...]; %LB Lower bound on x
UB=[... ...]; %UB Upper bound on x
[x,y] = ga(fitness,nvars,[],[],[],[],LB,UB)
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Star Strider am 28 Aug. 2020
Negate the fitness function to select for the maximum:
[x,y] = ga(@(x)-fitness(x),nvars,[],[],[],[],LB,UB)
Note that this assumes ‘fitness’ has only one argument.
If you are passing extra parameters, this works:
[x,y] = ga(@(x)-fitness(x,a,b),nvars,[],[],[],[],LB,UB)
where ‘a’ and ‘b’ (and perhaps others) are the extra parameters.
##### 3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Star Strider am 28 Aug. 2020
As always, my pleasure!
ad aymen am 9 Sep. 2020
Can the ''y'' value be improved to be the maximum value ?

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Gifari Zulkarnaen am 28 Aug. 2020
Make the fitness function to be 1/f(x) where f(x) is your original maximization.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
ad aymen am 28 Aug. 2020
thank you

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by