本文整理汇总了C++中Globals::initRandom方法的典型用法代码示例。如果您正苦于以下问题:C++ Globals::initRandom方法的具体用法?C++ Globals::initRandom怎么用?C++ Globals::initRandom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::initRandom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HyperNEAT_main
int HyperNEAT_main(int argc,char **argv) {
CommandLineParser commandLineParser(argc,argv);
// Quit if we don't have I/O/G
if (!commandLineParser.HasSwitch("-I") ||
!commandLineParser.HasSwitch("-O") ||
!commandLineParser.HasSwitch("-G")) {
cout << "./atari_generate [-R (seed)] -I (datafile) -O (outputfile) -G (ROMFile) [-P (populationfile) -F (fitnessprefix) [-E (evaluationFile)] ]\n";
cout << "\t(datafile) experiment data file - typically data/AtariExperiment.dat\n";
cout << "\t(outputfile) the next generation file to be created - typically generationXX.xml\n";
cout << "\t(populationfile) the current generation file (required when outputfile is > generation0) - typically generationXX(-1).xml.gz\n";
cout << "\t(fitnessprefix) used to locate the fitness files for individuals in the current generation (required for generation > 0) - typically fitness.XX.\n";
cout << "\t(evaluationfile) populationfile + fitness + speciation (output only - not required for next cycle) - typicall generationXX(-1).eval.xml\n";
return 0;
}
Globals *globals = Globals::init(commandLineParser.GetArgument("-I",0));
// Setup the experiment
int experimentType = int(globals->getParameterValue("ExperimentType") + 0.001);
HCUBE::ExperimentRun experimentRun;
string out_file = commandLineParser.GetArgument("-O",0);
experimentRun.setupExperiment(experimentType, out_file);
string rom_file = commandLineParser.GetArgument("-G",0);
// Is this an experiment in progress? If so we should load the current experiment
if (commandLineParser.HasSwitch("-P") &&
commandLineParser.HasSwitch("-F")) {
string populationFile = commandLineParser.GetArgument("-P",0);
string fitnessFunctionPrefix = commandLineParser.GetArgument("-F",0);
string evaluationFile = commandLineParser.GetSafeArgument("-E",0,"");
cout << "[HyperNEAT core] Population for existing generation created from: " << populationFile << endl;
experimentRun.createPopulationFromCondorRun(populationFile, fitnessFunctionPrefix, evaluationFile, rom_file);
} else {
cout << "[HyperNEAT core] Population for first generation created" << endl;
shared_ptr<Experiment> e = experimentRun.getExperiment();
if (experimentType == 30 || experimentType == 35 || experimentType == 36) {
shared_ptr<AtariExperiment> exp = static_pointer_cast<AtariExperiment>(e);
exp->initializeExperiment(rom_file.c_str());
} else if (experimentType == 31 || experimentType == 39 || experimentType == 40) {
shared_ptr<AtariNoGeomExperiment> exp = static_pointer_cast<AtariNoGeomExperiment>(e);
exp->initializeExperiment(rom_file.c_str());
} else if (experimentType == 32 || experimentType == 37 || experimentType == 38) {
shared_ptr<AtariFTNeatExperiment> exp = static_pointer_cast<AtariFTNeatExperiment>(e);
exp->initializeExperiment(rom_file.c_str());
} else if (experimentType == 33) {
// This is the Hybrid experiment but always starts as HyperNEAT
shared_ptr<AtariExperiment> exp = static_pointer_cast<AtariExperiment>(e);
exp->initializeExperiment(rom_file.c_str());
} else if (experimentType == 34) {
shared_ptr<AtariIntrinsicExperiment> exp = static_pointer_cast<AtariIntrinsicExperiment>(e);
exp->initializeExperiment(rom_file.c_str());
} else if (experimentType == 41) {
shared_ptr<AtariCMAExperiment> exp = static_pointer_cast<AtariCMAExperiment>(e);
exp->setResultsPath(out_file);
exp->initializeExperiment(rom_file.c_str());
}
experimentRun.createPopulation();
}
if (commandLineParser.HasSwitch("-R")) {
double seed = stringTo<double>(commandLineParser.GetArgument("-R",0));
globals->setParameterValue("RandomSeed",seed);
globals->initRandom();
}
experimentRun.startCondor();
NEAT::Globals::deinit();
}