GAMin:

--------------------------------------------------------------------------
   Applies a genetic algorithm to minimizing a function. 
   The initial state is xand d is a data structure containing tuning parameters. 
   Uses an elitist model and terminates after a set number of generations.

   Since version 7.
--------------------------------------------------------------------------
   Form:
   [x, fBest, fPlot] = GAMin( fun, x, d, s )
 
   where:

   errMag = fun( x, d )

--------------------------------------------------------------------------

   ------
   Inputs
   ------
   fun       (1,:)  Cost function name or handle
   x         (m,1)  Initial state
   d         (1,1)  Data structure to pass to fun
   s         (1,1)  Data structure for genetic algorithm
                    .nI           (1,1)  Number of individuals
                    .nG           (1,1)  Number of generations
                    .bounds       (n,2)  Variable bounds, rows of [min max]
                    .fncMutate     (:)   Function for mutations
                    .optMutate    (1,:)  Options for mutation function
                    .fncSelect     (:)   Function for selection
                    .optSelect    (1,:)  Options for selection function
                    .fncXOver      (:)   Function for cross-overs
                    .optXOver     (1,:)  Options for cross-over function

   -------
   Outputs
   -------
   x          (m,1)  Best state
   fBest      (1,1)  Best (lowest) cost
   fPlot      (1,:)  Cost vs. generation

--------------------------------------------------------------------------

Children:

Common: General/IsVersionAfter
Common: Graphics/Plot2D