Please i need help : getting Errors with my ga script

1 visualización (últimos 30 días)
Horace
Horace el 7 de Oct. de 2012
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

Respuestas (1)

Matt J
Matt J el 7 de Oct. de 2012
Editada: Matt J el 7 de Oct. de 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 comentario
Matt J
Matt J el 7 de Oct. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Debugging and Analysis en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by