Please i need help : getting Errors with my ga script

1 次查看(过去 30 天)
Please, I am trying to run a ga optimization script -- but always get the following error message:
* ??? Error using ==> constrValidate at 30
Constraint function must return real value.
Error in ==> gacommon at 130
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, ...
Error in ==> ga at 267
[x,fval,exitFlag,output,population,scores,FitnessFcn,nvars,Aineq,bineq,Aeq,beq,lb,ub, ...*
and line 30 reads
error(message('globaloptim:constrvalidate:confunNotReal'));
Please I need someone to tell me how to come our of this error.
Thanks for your usual support

回答(1 个)

Matt J
Matt J 2012-10-7
编辑:Matt J 2012-10-7
Use DBSTOP (or set breakpoints) to pause the program at the point where the error occurs. Then examine the values of the variables inside constrValidate() to see why they lead to a non-real constraint value.
  1 个评论
Matt J
Matt J 2012-10-7
Type "dbstop if error" at the command line and without the quotes. Then re-run your code. When the program stops at the K>> prompt, use the commands DBUP and DBDOWN in the command window to move up and down through the stack of function workspaces until you get to the workspace of ReinfBeamCon. You will then be able to inspect the state of all your variables inside ReinfBeamCon and see which ones aren't doing what you expect.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Debugging and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by