Added sawtooth wave generation
Adjusted termination conditions for the genetic algorithm
Simplified code
Improved performance
Reorganized code