General Genetic Algorithm
x is a solution/individual in the problem domainf(x) is the fitness of x
g(x,i) is the genetic representation of x as a sequence of indexed attributes/loci
1. Generate random population as pop
2. Evaluate f(m) for each member m in pop
3. For each member as m in pop
4. Select pairs of m such that the sum of all f(m1) - f(m2) is minimized
5. With some probability C, cross over pairs of m to form new a offspring as off.
6. With some probability M, mutate off at each locus.
7. Place off in a new population as newPop for next iteration
8. If the goal is met return the solution (fittest member in newPop) otherwise return to step 2 with only the best of pop + newPop as pop.