38 AnnealAdapter::AnnealAdapter() :
42 AnnealAdapter::~AnnealAdapter(){};
46 numberOfActions=configdata.getDoubleValue(
"numberOfActions");
47 numberOfStates=configdata.getDoubleValue(
"numberOfStates");
48 numberOfControllers=configdata.getDoubleValue(
"numberOfControllers");
52 this->annealEvo = evo;
55 currentControllers = this->annealEvo->nextSetOfControllers();
59 currentControllers = this->annealEvo->nextSetOfControllers();
60 for(
int i=0;i<currentControllers.size();i++)
63 ss << annealEvo->
resourcePath <<
"logs/bestParameters-" << this->annealEvo->suffix <<
"-" << i <<
".nnw";
64 currentControllers[i]->loadFromFile(ss.str().c_str());
68 errorOfFirstController=0.0;
71 vector<vector<double> > AnnealAdapter::step(
double deltaTimeSeconds,vector<double> state)
73 totalTime+=deltaTimeSeconds;
75 vector< vector<double> > actions;
77 for(
int i=0;i<currentControllers.size();i++)
79 vector<double> tmpAct;
80 for(
int j=0;j<currentControllers[i]->statelessParameters.size();j++)
82 tmpAct.push_back(currentControllers[i]->statelessParameters[j]);
84 actions.push_back(tmpAct);
90 void AnnealAdapter::endEpisode(vector<double> scores)
94 vector< double > tmp(1);
96 annealEvo->updateScores(tmp);
97 cout<<
"Exploded"<<endl;
101 cout<<
"Dist Moved: "<<scores[0]<<
" energy: "<<scores[1]<<endl;
103 annealEvo->updateScores(scores);
A class to read a learning configuration from a .ini file.
A series of functions to assist with file input/output.
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)