Forecasting via Genetic Algorithm: Part 5
Evolutionary Computation, Genetic Algorithm, Matlab No Comments »Part 5: Programming Issues
I wrote code for the Genetic Algorithm in MATLAB and it is terribly slow. A run for 50 Generations averages to about 1 second per generation. Here are some performance measures obtained using Matlab Profiler:

The FitnessFunction function is the biggest culprit and takes almost 100% of the total simulation time. Evaluation of the fitness function is the most time consuming part in the Genetic Algorithm. This is generally the case even with simpler fitness functions because on a relative scale, operators such as crossover and mutation require very little algebraic manipulation. Looking at the function itself we get more detail:
We find that evaluations for alpha and beta take the most time. I shall attempt to speed up the algorithm by writing a MEX function. In doing so we expect the simulation time to drop by many orders of magnitude as compiled MEX code would not need to run under Matlab’s interpreted mode.
