Genetic algorithm fitness function

3 ビュー (過去 30 日間)
esiotlab GEC
esiotlab GEC 2022 年 3 月 22 日
編集済み: Walter Roberson 2022 年 3 月 26 日
how to write a fitness function which takes an array and give the optimal value of x axis. I have a concave function.

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 3 月 23 日
編集済み: Walter Roberson 2022 年 3 月 26 日
I can think of several different things that you might intend.
  • If your function expects an array of trial model parameters, then you must instead expect to be passed a vector of trial model parameters, but your function can immediately reshape that into an array for internal use. The output from ga() would be a vector of model parameters, so you might need to reshape() it again afterwards for whatever presentation you want to do.
  • If your function expects a scalar or vector of trial model parameters, but also needs an array of other data (for example some kind of look-up table), then see http://www.mathworks.com/help/matlab/math/parameterizing-functions.html
  • Perhaps you have a function of one variable and you would like to pass in a number of trial values and have the genetic algorithm figure out which is optimal. If so then this is not a suitable task for genetic algorithms: the function is only passed in one set of model parameters at a time (unless 'UseVectorized' is true in the options)
  1 件のコメント
esiotlab GEC
esiotlab GEC 2022 年 3 月 26 日
thank you sir

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

カテゴリ

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