using genetic algorithm optimizer to figure out points that satisfy the imposed constraints

2 ビュー (過去 30 日間)
I want to find points that satisfy a set of constraints only using GA. It is not necessary to be optimal points. Some of the constraints depend on simulation evaluations. I did it by providing a constant fitness function(e.g., f(x) = 1), but it gave me the following error: Failure in user-supplied fitness function evaluation. Cannot continue. Failure in initial user-supplied fitness function evaluation. GA cannot continue. any idea?

回答 (2 件)

Renee Coetsee
Renee Coetsee 2017 年 4 月 14 日
There are couple reasons that you could be getting this error.
- This error occurs when the objective function produces a NaN output. To fix this, edit the function so that it does not produces NaN values, or set constraints on the function's inputs to prevent the objective function from producing NaN outputs.
- If you have nonlinear constraints, make sure that you are following this note in the documentation page for "ga":
"Note: Passing Extra Parameters (Optimization Toolbox) explains how to pass extra parameters to the objective function and nonlinear constraint functions, if necessary."
  1 件のコメント
Mustafa Al-tekreeti
Mustafa Al-tekreeti 2017 年 4 月 16 日
The objective function is a trivial function, f(x) = 1, and I am not passing any parameters.

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


Alan Weiss
Alan Weiss 2017 年 4 月 19 日
You did not show us how you defined your objective function. Here is one that will work:
fun = @(x)1;
Alan Weiss
MATLAB mathematical toolbox documentation

カテゴリ

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