00001 #ifndef STATCALC_H_
00002 #define STATCALC_H_
00003
00008 class StatCalc : public Operator
00009 {
00010 private:
00011 uint statNo;
00012 std::vector<double> average_;
00013 std::vector<double> stdDev_;
00014 std::vector<double> max_;
00015 std::vector<double> min_;
00016 std::vector<uint> sampleSize_;
00017 std::vector<uint> time_;
00018 std::vector<uint> evaluations_;
00019 uint nEvaluations_;
00020 StateP state_;
00021 std::string statsFileName_;
00022 std::ofstream statsFile_;
00023
00024 public:
00025 StatCalc();
00026
00027 bool operate(StateP)
00028 { return false; }
00029
00030 bool operate(const std::vector<IndividualP>&);
00031 void registerParameters(StateP);
00032 bool initialize(StateP);
00033 bool update(std::vector<double>);
00034 void log(int generation = -1);
00035 std::vector<double> getStats(int generation = -1);
00036 void output(uint step);
00037 void copyStats(StatCalcP);
00038
00039 double getFitnessMin(int generation = -1);
00040 double getFitnessMax(int generation = -1);
00041
00045 uint increaseEvaluations(uint eval = 1)
00046 {
00047 nEvaluations_ += eval;
00048 return nEvaluations_;
00049 }
00050
00054 void setEvaluations(uint eval)
00055 { nEvaluations_ = eval; }
00056
00060 uint getEvaluations()
00061 { return nEvaluations_; }
00062
00063 };
00064 typedef boost::shared_ptr<StatCalc> StatCalcP;
00065
00066 #endif