Please i need help : getting Errors with my ga script
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Matt J
on 7 Oct 2012
Edited: Matt J
on 7 Oct 2012
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 Comment
Matt J
on 7 Oct 2012
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.
See Also
Categories
Find more on Debugging and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!