Implemented third algorithm, adding adaptation to the genetic algorithm.