canonical genetic algorithm implementation