RATS 11.1
RATS 11.1

Statistics and Algorithms / Non-Linear Optimization /

Genetic algorithm (general optimization)

Home Page

← Previous Next →

Genetic algorithms are designed to handle difficult optimization problems by applying lots of compute power and a stylized model of "evolution," with random "mutations." RATS applies a variation of this called differential evolution. Given a "population" of parameter vectors, at each iteration each vector is compared with a possible successor. Whichever is the "fitter" of the two (the one with the better function value) is retained, the other discarded. There are a number of schemes for generating successors, all of which require that at least one parameter be "mutated," that is, have some random number added to it. In differential evolution, the size of a mutation in a parameter is determined from the difference between that parameter in two randomly selected elements of the population. If a particular parameter takes values which are still fairly widely dispersed throughout the population, then mutations will be large. If, on the other hand, it becomes clear that an individual parameter is fairly well determined, so that its values are tightly bunched, future changes in it will be small.

 

METHOD=GENETIC (and PMETHOD=GENETIC, which is what is more typically used) are available on BOXJENK, CVMODEL, DLM, FIND, GARCH, MAXIMIZE and NLLS. Aside from the ITERATIONS (PITERS for the PMETHOD option) on the instructions themselves, which control the number of batches of mutations, there are four options on NLPAR which govern the genetic algorithm:
 

MUTATE=SIMPLE/[SHRINK]/BEST/RANDOM

CROSSOVER=probability of taking mutated parameter [.5]

SCALEFACTOR=scale factor for mutations [.7]

POPULATE=scale for population size [6]

 

The POPULATE option is the simplest of these to explain—it just indicates the factor by which the number of parameters is multiplied to get the population size. Note, however, that the population size is never allowed to be below 20. As mentioned above, at each iteration, each of the parameter vectors in the population is compared against a trial vector, to be replaced if the trial vector is better. The other three options govern how this trial vector is generated. One existing parameter vector is chosen as the base for this. Two other parameter vectors are chosen at random and their difference is taken. In the SIMPLE form of mutation, this difference is multiplied by SCALEFACTOR and added to the base. A binomial trial is performed for each component. With probability equal to the CROSSOVER, the trial value is chosen; otherwise the original value is retained. A large value of SCALEFACTOR (bigger than one) is useful if you need to search a wide area. The SHRINK form for mutation is similar but, instead of using a randomly selected base vector, it uses a linear combination of the original vector and the best vector from the previous iteration.


Alternative methods for doing broad searches are simulated annealing and genetic annealing, both of which allow for parameters to be chosen which are actually worse than the one being replaced. (The genetic algorithm strictly moves "upwards"). Those may be more useful (though substantially slower) if you are unsure whether your guess values are in the right region.


 


Copyright © 2026 Thomas A. Doan