Please i need help : getting Errors with my ga script

조회 수: 1 (최근 30일)
Horace
Horace 2012년 10월 7일
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