Clear Filters
Clear Filters

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

2 views (last 30 days)
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?

Answers (2)

Renee Coetsee
Renee Coetsee on 14 Apr 2017
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."

Alan Weiss
Alan Weiss on 19 Apr 2017
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

Community Treasure Hunt

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

Start Hunting!