A class for genetic algorithm