// evaluation_alg.h : // generic algorithm definition for algoritms for value function // (per state) experimental evaluation. template class Evaluation_Alg : public Learning_Alg { protected: State CurrState; int RunCount; // number of runs performd so far int StepCount; StateStats_M ValuesFunc; // statistics accumulated so fary double Lambda; void check_in_table (State newState) { // sets entry to 0 if it's not exists already const StateStats_M& valuesData = ValuesFunc; StateStats_I nextStepValI = valuesData.find (newState); if (nextStepValI == valuesData.end()) { ValuesFunc[newState] = 0; } } public: Evaluation_Alg(double lambdaVal = 1.0) { RunCount = 0; StepCount = 0; Lambda = lambdaVal; } // start new experiment in state virtual void start_run (State startState) { CurrState = startState; RunCount++; } // just prints values function estimation virtual void print_stats () { const StateStats_M& valuesData = ValuesFunc; cout << RunCount << " runs\n"; for (StateStats_I allVals = valuesData.begin(); allVals != valuesData.end(); ++allVals) cout << (*allVals).first << " : " << (*allVals).second << "\n"; cout << "\n"; } };