Error in Matlab Genetic Algorithm optimization

Hi,
I am using GA App in Matlab but by writing my own functions for Population creation, Crossover and Mutation. My population individuals are nxn matrices with 0 and 1 as elements. These matrices are evaluated by my Fitness function which returns a vector of scalar scores ( Vectorized = 'On' ).
In the GA App I choose the options ' Proportional ' for FitnessScaling and ' Roulette ' for Selection .
My problem is that after the scores calculation at the FitnessFcn the Optimization stops with the error " Conversion to double from cell is not possible " . And I do not understand where this error come from, either during Scaling or Selection . Is there anyway to identify the error source? I suspect that it is related to the fact that my population are matrices stored in cell arrays.
Does this mean that I also have to write my own Scaling and Selection functions? Or is there any other way to tackle it?
Thanks!

 채택된 답변

Sean de Wolski
Sean de Wolski 2014년 4월 3일
dbstop if error
And look around

댓글 수: 3

Iro
Iro 2014년 4월 3일
Hi Sean,
thanks for your answer.
I actually run the ga from the command line and have seen that my error was actually due to some inconsistency with the plot functions. For now I have postponed to solve this by unchecking all the plots in GA app in order to first make sure that my main functions work properly. But I did not understand where I should put the piece of code that you wrote above in case I need it?
Just run the above at the command line. It turns on the debugger to stop automatically whenever an error is thrown. You can then see everything as it is at the time of the error. The bad function line/variable will probably stand out at this point.
Iro
Iro 2014년 4월 6일
편집: Iro 2014년 4월 6일
Thanks Sean!
I wonder if you also have a hint to this question:
Best!
Iro

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

Iro
2014년 4월 3일

편집:

Iro
2014년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by