Added code for genetic algorithm