#ifndef EVOLUTION_H
#define EVOLUTION_H

#include "result_table.h"
#include "../rand/randomc.h"
#include "individual.h"
#include "population.h"

#define EV_STALE_GENERATION 500
#define EV_DEFAULT_GENERATIONS 2000

#define SEL_TYPE_TOURNAMENT 0
#define SEL_TYPE_ROULETTE 1

class evolution {
  RANDOM_GENERATOR *rg;
  result_table *rt;

  population *tournament_selection(population *, population *, int);
  population *roulette_selection(population *, population *);
  population *get_mating_population(population *, int, char, int);

  population *get_new_population(population *, int, char, float,
      float);
public:
  evolution(unsigned long);
  ~evolution() { delete rg; delete rt; }

  individual *get_solution(int, char, int, float, float, float, int,
      float, float, int, char, char, bool);

  float print_generation(bool, int, population *, int);
  void reset_results();
  void flush_results(char *p_filename = 0);
};

#endif /* EVOLUTION_H */

