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?
0 个评论
回答(2 个)
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."
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 Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!