// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // "eoIslandsEasyEA" // (c) OPAC Team, LIFL, 2002 /* 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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Cont act: cahon@lifl.fr */ #ifndef eoIslandsEasyEA_h #define eoIslandsEasyEA_h #include #include #include #include #include #include #include #include #include #include /** An island distributed easy evolutionary algorithm. It embeds an instance of easyEA. The behavior of this last one isn't modified. However, exchanges of individuals are performed with other EAs. */ template class eoIslandsEasyEA : public eoEasyEA { public : /** Constructor */ eoIslandsEasyEA (std::string _id, eoListener & _listen, eoConnectivity & _conn, eoEasyEA & _ea, eoContinue & _cont, eoSelect & _select, eoReplacement & _replace ) : id (_id), listen (_listen), conn (_conn), chkp (_ea.continuator), mig_upd (_listen, _conn, _cont, _select, _replace), eoEasyEA (chkp, _ea.eval, _ea.breed, _ea.replace ) { chkp.add (mig_upd) ; } virtual void operator () (eoPop & pop) { mig_upd (pop) ; // Sets pop. to send/receive EO listen.publish (id) ; eoEasyEA :: operator () (pop) ; listen.publish ("_") ; } private : // Internal components std::string id ; // String identifiant of this algorithm eoListener & listen ; // The neighbouring of concurrent algos eoConnectivity & conn ; // Communication topology eoCheckPoint chkp ; eoMigUpdater mig_upd ; } ; #endif