Please i need help : getting Errors with my ga script

1 visualizzazione (ultimi 30 giorni)
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

Risposte (1)

Matt J
Matt J il 7 Ott 2012
Modificato: Matt J il 7 Ott 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 Commento
Matt J
Matt J il 7 Ott 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.

Accedi per commentare.

Categorie

Scopri di più su Debugging and Analysis in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by