To create a GA with a specific GAModel, import this module, make a GAModel with the following interface functions: fitness (has default) genauxga (has default) crossover! (no default) mutation! (has identity function as default) selection (has default) randcreature (no default) printfitness (has default) savecreature (has default) stopcondition (has default)

ga function
x in each generation, the following is done
    - select parents from all creatures in population
    - create children using crossover
    - replace non-elites in population with children
    - mutate all creatures (both elites and children) in population
crossover!(z, x,y, model::GAModel, aux, rng)

Crosses over x and y to create a child. Optionally use space in z as a scratch space or to create the child. aux is more scratch space. rng is random number generator. model = GAM(G1,G2) aux = genauxga(model) x = randcreature(model,aux) y = randcreature(model,aux) z = randcreature(model,aux) child = crossover(z,x,y,model,aux,rng)


Fitness function. fitness(x) is maximized always To minimize x.objvalue, dispatch fitness(x) to -x.objvalue for your Creature Recommended to make this either x.objvalue to maximize or -x.objvalue to minimize

Since fitness(x) used for selecting the fittest creature, elites, and parents,
all the computationally expensive part of calculating the fitness value should
be implemented in the randcreature method.
genauxga(model::GAModel) :: GAModel auxiliary structure

Given model GAM <: GAModel, generate auxiliary scratch space for calculating fitness scores model = GAM(G1,G2) aux = genauxga(model) The purpose is to not allocate memory every time you calculate fitness for a new creature.


Logging * saves state every savestateiter iterations to file - restart using state = loadgastate(filename) & ga!(state) * outputs creature every savecreatureiter iterations to file * prints fitness value every printfitnessiter iterations to screen

print the fitness of fittest creature every n iteration
save the fittest creature to file every n iteration
save the entire state of the GA (i.e. this struct) to file every n iteration
prefix for the files to be save
randcreature(model::GAModel, aux)

Create a random instance of a creature, given a GAModel.
There is always a creature associated with a GAModel
selection(pop::Vector, n::Integer, rng)

Generate a vector of n tuples (i,j) where i and j are
indices into pop, and where pop[i] and pop[j] are the
selected parents.
Uses binary tournament selection by default.