00001 #ifndef STATCALC_H_
00002 #define STATCALC_H_
00003
00007 class StatCalc : public Operator
00008 {
00009 private:
00010 uint statNo;
00011 std::vector<double> average_;
00012 std::vector<double> stdDev_;
00013 std::vector<double> max_;
00014 std::vector<double> min_;
00015 std::vector<uint> sampleSize_;
00016 std::vector<uint> time_;
00017 StateP state_;
00018 std::string statsFileName_;
00019 std::ofstream statsFile_;
00020
00021 public:
00022 StatCalc();
00023
00024 bool operate(StateP)
00025 { return false; }
00026
00030 bool operate(const std::vector<IndividualP>&);
00031
00032 void registerParameters(StateP);
00033
00034 bool initialize(StateP);
00035
00039 bool update(std::vector<double>);
00040
00044 void log(int generation = -1);
00045
00049 std::vector<double> getStats(int generation = -1);
00050
00051 void output(uint step);
00052
00056 double getFitnessMin(int generation = -1);
00057
00061 double getFitnessMax(int generation = -1);
00062 };
00063 typedef boost::shared_ptr<StatCalc> StatCalcP;
00064
00065 #endif