#ifndef __POPULATION_H_
#define __POPULATION_H_

#include "Definitions.h"
#include <boost/multi_array.hpp>
#include <boost/dynamic_bitset.hpp>

class Random;
class Population {
  private:
    typedef boost::multi_array<FloatType, 2> MatrixType;
		static const FloatType limitProbabilityMin, limitProbabilityMax;

    unsigned numberOfGenes;
    AlleleType *numberOfAlleles;
    unsigned maxAlleles;
    MatrixType *data;
		boost::dynamic_bitset<> convergedAlleles;

		AlleleType getRandomAllele( unsigned locus, Random *random ) const;
		AlleleType getProportionateAllele( unsigned locus, Random *random ) const ;
    void adjustProbabilities( const AlleleType *phenoType, FloatType epsilon );

  public:
    Population( unsigned numberOfGenes, AlleleType *numberOfAlleles );
    virtual ~Population();
    void selectIndividual( AlleleType *destination ) const;
    void rewardGenes( const AlleleType *phenoType );
    void penalizeGenes( const AlleleType *phenoType );
		void print() const;
		unsigned getNumberOfConvergedAlleles() const;
};

#endif /* __POPULATION_H_ */
