genetic algorithm updated to generic version