37 AnnealAdapter::AnnealAdapter() :
41 AnnealAdapter::~AnnealAdapter(){};
45 numberOfActions=configdata.getDoubleValue(
"numberOfActions");
46 numberOfStates=configdata.getDoubleValue(
"numberOfStates");
47 numberOfControllers=configdata.getDoubleValue(
"numberOfControllers");
51 this->annealEvo = evo;
54 currentControllers = this->annealEvo->nextSetOfControllers();
58 currentControllers = this->annealEvo->nextSetOfControllers();
59 for(
int i=0;i<currentControllers.size();i++)
62 ss<<
"logs/bestParameters-"<<this->annealEvo->suffix<<
"-"<<i<<
".nnw";
63 currentControllers[i]->loadFromFile(ss.str().c_str());
67 errorOfFirstController=0.0;
70 vector<vector<double> > AnnealAdapter::step(
double deltaTimeSeconds,vector<double> state)
72 totalTime+=deltaTimeSeconds;
74 vector< vector<double> > actions;
76 for(
int i=0;i<currentControllers.size();i++)
78 vector<double> tmpAct;
79 for(
int j=0;j<currentControllers[i]->statelessParameters.size();j++)
81 tmpAct.push_back(currentControllers[i]->statelessParameters[j]);
83 actions.push_back(tmpAct);
89 void AnnealAdapter::endEpisode(vector<double> scores)
93 vector< double > tmp(1);
95 annealEvo->updateScores(tmp);
96 cout<<
"Exploded"<<endl;
100 cout<<
"Dist Moved: "<<scores[0]<<
" energy: "<<scores[1]<<endl;
102 annealEvo->updateScores(scores);
A class to read a learning configuration from a .ini file.
Defines a class AnnealAdapter to pass parameters from AnnealEvolution to a controller. Adapting NeuroEvolution to do Simulated Annealing.
void initialize(AnnealEvolution *evo, bool isLearning, configuration config)