예제 #1
0
  void ExperimentRun::setupExperimentInProgressUseDat(string _datFile, string populationFileName,string _outputFileName)
  {
    outputFileName = _outputFileName;
    //datFile = _datFile;
    PRINT(populationFileName);
    {
      TiXmlDocument doc(populationFileName);
			
      bool loadStatus;
			
      if (iends_with(populationFileName,".gz"))
        {
          loadStatus = doc.LoadFileGZ();
        }
      else
        {
          loadStatus = doc.LoadFile();
        }
			
      if (!loadStatus)
        {
          cerr << "Error trying to load the XML file!" << endl;
          throw CREATE_LOCATEDEXCEPTION_INFO("Error trying to load the XML file!");
        }
			
      TiXmlElement *element = doc.FirstChildElement();
			
      NEAT::Globals* globals = NEAT::Globals::init(element);
      (void) globals; //to get rid of unused variable warning
			
      NEAT::Globals::getSingleton()->overrideParametersFromFile(_datFile);
      NEAT::Globals::getSingleton()->setOutputFilePrefix(outputFileName); //set the name of the outputPrefixFile                                                                                                                                                                                               
			
      //Destroy the document
    }
		
    int experimentType = int(NEAT::Globals::getSingleton()->getParameterValue("ExperimentType")+0.001);
		
    cout << "Loading Experiment: " << experimentType << endl;
		
    setupExperiment(experimentType,_outputFileName);
		
    cout << "Experiment set up.  Creating population...\n";
		
    createPopulation(populationFileName);
		
    cout << "Population Created\n";
  }
예제 #2
0
    void ExperimentRun::setupExperimentInProgress(
        string populationFileName,
        string _outputFileName
    )
    {
        outputFileName = _outputFileName;

        {
            TiXmlDocument *doc = new TiXmlDocument(populationFileName);
            
            cout << "Loading population\n";

            bool loadStatus;

            if (iends_with(populationFileName,".gz"))
            {
                loadStatus = doc->LoadFileGZ();
            }
            else
            {
                loadStatus = doc->LoadFile();
            }

            if (!loadStatus)
            {
                throw CREATE_LOCATEDEXCEPTION_INFO("Error trying to load the XML file!");
            }

            TiXmlElement *element = doc->FirstChildElement();

            NEAT::Globals* globals = NEAT::Globals::init(element);
            
            //Destroy the document
            delete doc;
            
            cout << "Population loaded\n";


        }


        int experimentType = int(NEAT::Globals::getSingleton()->getParameterValue("ExperimentType")+0.001);

        NEAT::Globals::getSingleton()->seedRandom((unsigned int)(NEAT::Globals::getSingleton()->getParameterValue("ActualRandomSeed")+0.001));

        cout << "Loading Experiment: " << experimentType << endl;

        setupExperiment(experimentType,_outputFileName);

        cout << "Experiment set up.  Creating population...\n";

        createPopulation(populationFileName);

        cout << "Population Created\n";
        
        /*cout << "Cleaning up old generations\n";
        
		population->cleanupOld(population->getGenerationCount()-1);
		
		cout << "Done cleaning\n";*/
		
    }