|
"Priyanshu Agarwal" wrote in message <ik114a$a4e$1@fred.mathworks.com>...
> Hi,
>
> I'm applying GA for minimizing an objective function evaluated from images. When I run MATLAB for the first time and execute the program GA is able to obtain the global minima. However, when I run the program once again, GA fails to find the minima. The above is true no matter how many times I do the same. It seems that the problem lies in the random number generation required for GA. How can I randomize the random number stream being used internally by GA?
>
> Regards,
> Priyanshu
To reproduce the results, save the random number generator stream to reproduce the results.
stream = RandStream.getDefaultStream;
strmstate = stream.State;
% Run GA
stream.State = strmstate;
% Run GA again to get the same results.
It seems that the GA parameter is too sensitive to the options settings or starting population. I would suggest to let GA run longer (change stopping criteria) and/or increase the population size.
In general at least one of the results from 3-4 runs of GA should get you the minimum, if not then change the parameters again.
Hth,
Rakesh
|