フィルターのクリア

About termination of genetic algorithm

1 回表示 (過去 30 日間)
dimitris
dimitris 2012 年 9 月 6 日
I have set the options of the ga as shown:
options=gaoptimset(options,'Generations',100);
The algorithm terminates after 6 generations. I would like to ask how i will make the algorithm terminate at 100th generation. Thank you in advance.

採用された回答

Alan Weiss
Alan Weiss 2012 年 9 月 7 日
ga would normally not exit until at least 50 generations. Therefore, either you have nonlinear constraints, or your options are not what you say they are.
Can you please show us your real options settings (the line you gave assumes that some options have already been created), your real function call, and your real output?
Alan Weiss
MATLAB mathematical toolbox documentation
  5 件のコメント
Sean de Wolski
Sean de Wolski 2012 年 9 月 7 日
Yes, you need to pass in the empty set:
[x,y,exitflag,output]=ga(@(x) obj_opt(x),n,A,b,Aeq,beq,LB,UB,[],options)
dimitris
dimitris 2012 年 9 月 7 日
That was the problem. Now it works fine. Thank you very much sir.

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

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 9 月 6 日
編集済み: Sean de Wolski 2012 年 9 月 6 日
What is the exitflag returnmed from ga()?
This will tell us a lot about what is causing it to exit...
More From doc:
Without nonlinear constraints — Average cumulative change in value of the fitness function over StallGenLimit generations is less than TolFun, and the constraint violation is less than TolCon.
With nonlinear constraints — Magnitude of the complementarity measure (see Definitions) is less than sqrt(TolCon), the subproblem is solved using a tolerance less than TolFun, and the constraint violation is less than TolCon.
So I would recommend starting with those settings.
  2 件のコメント
dimitris
dimitris 2012 年 9 月 6 日
編集済み: dimitris 2012 年 9 月 6 日
Of course, i should have posted it before, exitflag=1. I don't have any nonlinear constraints.
Sean de Wolski
Sean de Wolski 2012 年 9 月 6 日
see more

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

カテゴリ

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