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

1 回表示 (過去 30 日間)
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 '
please help me
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)

採用された回答

Star Strider
Star Strider 2020 年 8 月 28 日
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 件のコメント
ad aymen
ad aymen 2020 年 9 月 9 日
Can the ''y'' value be improved to be the maximum value ?

サインインしてコメントする。

その他の回答 (1 件)

Gifari Zulkarnaen
Gifari Zulkarnaen 2020 年 8 月 28 日
Make the fitness function to be 1/f(x) where f(x) is your original maximization.

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by