/* The Evolving Distribution Objects framework (EDO) is a template-based, ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Copyright (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2001 Copyright (C) 2010 Thales group */ /* Authors: todos@geneura.ugr.es Marc Schoenauer Martin Keijzer Johann Dréo Caner Candan */ #ifndef _edoPopStat_h #define _edoPopStat_h #include /** Thanks to MS/VC++, eoParam mechanism is unable to handle std::vectors of stats. This snippet is a workaround: This class will "print" a whole population into a std::string - that you can later send to any stream This is the plain version - see eoPopString for the Sorted version Note: this Stat should probably be used only within eoStdOutMonitor, and not inside an eoFileMonitor, as the eoState construct will work much better there. */ template class edoPopStat : public eoStat { public: using eoStat::value; /** default Ctor, void std::string by default, as it appears on the description line once at beginning of evolution. and is meaningless there. _howMany defaults to 0, that is, the whole population*/ edoPopStat(std::string _desc ="") : eoStat("", _desc) {} /** Fills the value() of the eoParam with the dump of the population. */ void operator()(const eoPop& _pop) { std::ostringstream os; os << _pop; value() = os.str(); } }; #endif // !_edoPopStat_h