how can i solve "Error using constrValidate" in genetic algorithm?
古いコメントを表示
I'm trying to minimaze a non linear function with non linear costraints with a ga (i have attached the files with the functions), but whenever i run the code i have the following errors:
Error using constrValidate (line 59)
Constraint function must return real value.
Error in gacommon (line 125)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, ...
Error in ga (line 363)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, ...
Error in main (line 28)
[x, fval] = ga(ObjFcn,nvars,A, b, Aeq, beq, [], [], CostraintFunction);
How can i fix that?
Thanks for helping
1 件のコメント
This line in the error message is highly suggestive:
Constraint function must return real value.
Have you verified whether it is returning a real value? A good way to trap non-real values is to set a conditional breakpoint in the constraint function.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Genetic Algorithm についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!