#ifndef __SGENGINE_H_
#define __SGENGINE_H_

#include "Definitions.h"
#include "Logger.h"
#include "ProblemDomain.h"
#include "Population.h"

#include <string>
#include <boost/noncopyable.hpp>

class SgEngine : boost::noncopyable {
  private:
    ProblemDomain * const problem;
    Population population;
    FloatType bestFitness;
    AlleleType * const bestIndividual;
    AlleleType * const individualOne;
    AlleleType * const individualTwo;
    AlleleType * const incomingIndividual;
    const size_t sizeOfIndividual;

    static std::string getChromosomeString( AlleleType *chromosome );

  public:
    SgEngine( ProblemDomain *p );
    ~SgEngine();
    void printBestIndividual( bool withChromosome, bool isNew, Logger::LogLevel logLevel, const char *prefix = "" ) const;
    const AlleleType * getBestIndividual() const;
    FloatType getBestFitness() const;
    bool hasBestIndividual() const;
    AlleleType * getSpaceForSolutionCandidate();
    bool testSolutionCandidate();
    Population * getPopulation();

    void doOneGeneration();
    void doMoreGenerations( unsigned int howMany );
};

#endif /* __SGENGINE_H_ */
