GAFramework.GAModelType

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)

Base.iterateFunction
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
GAFramework.crossover!Method
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)

GAFramework.fitnessMethod

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.
GAFramework.genauxgaMethod
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.

GAFramework.printfitnessMethod

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
    print_fitness_iter::Int
save the fittest creature to file every n iteration
    save_creature_iter::Int
save the entire state of the GA (i.e. this struct) to file every n iteration
    save_state_iter::Int
prefix for the files to be save
    file_name_prefix::AbstractString
GAFramework.randcreatureMethod
randcreature(model::GAModel, aux)

Create a random instance of a creature, given a GAModel.
There is always a creature associated with a GAModel
GAFramework.selectionMethod
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.