diff --git a/eo/Tutorial/Makefile.am b/eo/Tutorial/Makefile.am index 61d590dd..9b55dd8b 100644 --- a/eo/Tutorial/Makefile.am +++ b/eo/Tutorial/Makefile.am @@ -1,5 +1,5 @@ -if USE_PARADISEO -SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 ParadisEO -else +#if USE_PARADISEO +#SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 ParadisEO +#else SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 -endif +#endif diff --git a/eo/src/eo b/eo/src/eo index 3c07b82c..3f5ca98b 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -139,8 +139,6 @@ #include #include -// Cellular parallel evolutionary algorithm -#include //----------------------------------------------------------------------------- // to be continued ... diff --git a/eo/src/eoToricCellularEasyEA.h b/eo/src/eoToricCellularEasyEA.h deleted file mode 100644 index 1710cec6..00000000 --- a/eo/src/eoToricCellularEasyEA.h +++ /dev/null @@ -1,88 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoToricCellularEasyEA.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoToricCellularEasyEA_h -#define eoToricCellularEasyEA_h - -#include - -#include - -template class eoToricCellularEasyEA : public eoCellularEasyEA { - -public : - - eoToricCellularEasyEA (eoContinue & _cont, - eoEvalFunc & _eval, - eoSelectOne & _sel_neigh, - eoBinOp & _cross, - eoMonOp & _mut, - eoSelectOne & _sel_repl - ) : - eoCellularEasyEA (_cont, - _eval, - _sel_neigh, - _cross, - _mut, - _sel_repl) { - - } - - eoToricCellularEasyEA (eoContinue & _cont, - eoEvalFunc & _eval, - eoSelectOne & _sel_neigh, - eoQuadOp & _cross, - eoMonOp & _mut, - eoSelectOne & _sel_child, - eoSelectOne & _sel_repl - ) : - eoCellularEasyEA (_cont, - _eval, - _sel_neigh, - _cross, - _mut, - _sel_child, - _sel_repl) { - - } - - // Take care :-). The size of the population must be a square number ! (9, 16, ...) - - virtual eoPop neighbours (const eoPop & pop, int rank) { - - int dim2 = pop.size () ; - int dim = (int) std::sqrt ( (double) dim2) ; - int j = rank ; - - eoPop neigh ; - neigh.push_back (pop [j < dim ? dim2 - dim + j : j - dim]) ; - neigh.push_back (pop [(j + dim) % dim2]) ; - neigh.push_back (pop [(j + 1) % dim != 0 ? j + 1 : j + 1 - dim]) ; - neigh.push_back (pop [j % dim != 0 ? j - 1 : j + dim - 1]) ; - - return neigh ; - } - -} ; - -#endif diff --git a/eo/src/paradisEO/Makefile.am b/eo/src/paradisEO/Makefile.am deleted file mode 100644 index dcf813f1..00000000 --- a/eo/src/paradisEO/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -SUBDIRS = comm eval island - -pkginclude_HEADERS = eoPopAgent.h eoSolAgent.h - -### Makefile.am ends here diff --git a/eo/src/paradisEO/comm/Makefile.am b/eo/src/paradisEO/comm/Makefile.am deleted file mode 100644 index 62654d8f..00000000 --- a/eo/src/paradisEO/comm/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -SUBDIRS = messages - -pkginclude_HEADERS = eoListener.h eoLocalListener.h - -### Makefile.am ends here diff --git a/eo/src/paradisEO/comm/eoListener.h b/eo/src/paradisEO/comm/eoListener.h deleted file mode 100644 index 1f085e1e..00000000 --- a/eo/src/paradisEO/comm/eoListener.h +++ /dev/null @@ -1,148 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoListener.h" - -// (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 eoListener_h -#define eoListener_h - -#include -#include - -#include -#include -#include - -/** - Necessary for any use of a distributed model. - It makes it possible to have a total state of - that one. -*/ - -// In the near future ... Enabling different kinds of EO to send/receive .. - -template class eoListener : public std::vector > { - -public : - - /** - Constructor. - */ - - eoListener (int argc, char ** argv) : comm (MPI :: COMM_WORLD) { - - // Mpi requires it ! - MPI :: Init (argc, argv) ; - - // Who and how many ? - rank = MPI :: COMM_WORLD.Get_rank () ; - len = MPI :: COMM_WORLD.Get_size () ; - - // To build local listeners algorithms - for (int i = 0 ; i < len ; i ++) { - eoLocalListener loc_listen (i) ; - push_back (loc_listen) ; - } - } - - /** - Destructor. - */ - - ~ eoListener () { - - MPI :: Finalize () ; - } - - /** - A reference to the current listener - */ - - eoLocalListener & here () { - - return operator [] (rank) ; - } - - /** - To import messages ... - */ - - void update () { - - for (int i = 0 ; i < size () ; i ++) - operator [] (i).update () ; - } - - /** - To broadcast the std::string identifier of the local process to the - whole neighbouring ... - */ - - void publish (std::string label) { - - eoPublishMessTo mess (label) ; - for (int i = 0 ; i < size () ; i ++) - if (i != rank) - mess (operator [] (i)) ; - here ().label () = label ; // Nothing to send ! - } - - /** - Blocking. Waits for at least one 'eoLocalListener' to - receive any eoPop ... - */ - - void wait () { - - bool b = false ; - - do { - comm.Probe (MPI :: ANY_SOURCE, 0) ; - update () ; - for (int i = 0 ; i < size () ; i ++) - if (! operator [] (i).empty ()) - b = true ; - - } while (! b) ; - } - - void destroy (std::string label) { - - eoKillMessTo mess ; - for (int i = 0 ; i < len ; i ++) { - if (operator [] (i).label () == label) - mess (operator [] (i)) ; - } - } - -private : - - int rank, len ; // Rank of current process, and number of distributed processes - - MPI :: Comm & comm ; // Communicator - - -} ; - -#endif - - - diff --git a/eo/src/paradisEO/comm/eoLocalListener.h b/eo/src/paradisEO/comm/eoLocalListener.h deleted file mode 100644 index 0c2d7916..00000000 --- a/eo/src/paradisEO/comm/eoLocalListener.h +++ /dev/null @@ -1,170 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoLocalListener.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoLocalListener_h -#define eoLocalListener_h - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/** - A local listener to pack any coming message or, on contrary, to - send any data to another distributed process. - */ - -// Well, not very nice, but necessary for multiples header inclusions :-/ - -template class eoHeaderMessFrom ; -template class eoMessFrom ; -template class eoMessTo ; -template class eoEOReceiveMessFrom ; -template class eoEOSendMessFrom ; -template class eoPublishMessFrom ; -template class eoKillMessFrom ; - -template class eoLocalListener : public std::queue > { - -public : - - /** - Constructor - */ - - eoLocalListener (int _num_id) : - - num_id (_num_id), - comm (& MPI :: COMM_WORLD), // Shared communicator ... - req_EO (false) { - - gethostname (host_name, 255) ; // Host ? - } - - /** - Any distributed algorithm or agent has its own integer - identifiant, which lets us to distinguish them. - */ - - bool operator == (eoLocalListener & loc_listen) { - - return loc_listen.num_id == num_id ; - } - - /** - To import awaiting messages from other algorithms. - For each one, an action may be performed. - */ - - void update () { - - while (comm -> Iprobe (num_id, 0)) { - // While any more messages - - eoHeaderMessFrom header (* this) ; - eoMessFrom * mess ; - - /* The header identifies the kind of messages. - Currently, only four are necessary and so defined */ - - if (header == "eoEOReceiveMessTo") - mess = new eoEOReceiveMessFrom (* this) ; - else if (header == "eoEOSendMessTo") - mess = new eoEOSendMessFrom (* this) ; - else if (header == "eoPublishMessTo") - mess = new eoPublishMessFrom (* this) ; - else { - mess = new eoKillMessFrom (* this) ; - } - // Any side effects ? - mess -> operator () () ; - delete mess ; - } - } - - void wait () { - - bool b = false ; - - do { - comm -> Probe (num_id, 0) ; - update () ; - if (! empty ()) - b = true ; - - } while (! b) ; - } - - /** - String identifier of this algo/agent ? - */ - - std::string & label () { - - return name_id ; - } - - bool & need_immigration () { - - return req_EO ; - } - - int number () { - - return num_id ; - } - - void destroy () { - - std::cout << "Agent [" << name_id << "] stopped ..." << std::endl ; - MPI :: Finalize () ; - exit (0) ; - } - - char host_name [255] ; // Host std::string identifier - -private : - - MPI :: Comm * comm ; // MPI Communicator - - std::string name_id ; // String id. - int num_id ; // MPI id. - bool req_EO ; - - // Friendly classes - friend class eoMessFrom ; - friend class eoMessTo ; - -} ; - -#endif - - - diff --git a/eo/src/paradisEO/comm/messages/Makefile.am b/eo/src/paradisEO/comm/messages/Makefile.am deleted file mode 100644 index c3caa886..00000000 --- a/eo/src/paradisEO/comm/messages/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -SUBDIRS = from to - -pkginclude_HEADERS = eoMessFrom.h eoMessTo.h - - -### Makefile.am ends here diff --git a/eo/src/paradisEO/comm/messages/eoMessFrom.h b/eo/src/paradisEO/comm/messages/eoMessFrom.h deleted file mode 100644 index f0d8f575..00000000 --- a/eo/src/paradisEO/comm/messages/eoMessFrom.h +++ /dev/null @@ -1,66 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoMessFrom.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoMessFrom_h -#define eoMessFrom_h - -#include -#include - -/** - An abstract class for any kind of coming message. - Common features are declared. - */ - -template class eoLocalListener ; - -template class eoMessFrom { - -public : - - /** - Constructor - */ - - eoMessFrom (eoLocalListener & _loc_listen) : - loc_listen (_loc_listen), - comm (MPI :: COMM_WORLD) { - } - - /** - Well ... - */ - - virtual void operator () () = 0 ; - -protected : - - MPI :: Comm & comm ; // Communicator - eoLocalListener & loc_listen ; // Transmitter - -} ; - -#endif - - - diff --git a/eo/src/paradisEO/comm/messages/eoMessTo.h b/eo/src/paradisEO/comm/messages/eoMessTo.h deleted file mode 100644 index 913f99a2..00000000 --- a/eo/src/paradisEO/comm/messages/eoMessTo.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoMessTo.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoMessTo_h -#define eoMessTo_h - -#include -#include -#include - -/** - An abstract class for any sending message. - Common features are declared. - */ - -template class eoLocalListener ; - -template class eoMessTo { - -public : - - /** - Constructor. A std::string identifier, being defined in subclasses - is given for any kind of messages. - */ - - eoMessTo (std::string _label) : - - label (_label), - comm (MPI :: COMM_WORLD) { - } - - /** - Must be called in sub-classes ... - */ - - void operator () (eoLocalListener & loc_listen) { - - eoHeaderMessTo header (label) ; - header (loc_listen) ; - } - -protected : - - MPI :: Comm & comm ; // MPI Communicator - - std::string label ; // String identifier of the message - -} ; - -#endif - - - - diff --git a/eo/src/paradisEO/comm/messages/from/Makefile.am b/eo/src/paradisEO/comm/messages/from/Makefile.am deleted file mode 100644 index 94a772db..00000000 --- a/eo/src/paradisEO/comm/messages/from/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -pkginclude_HEADERS = eoEOReceiveMessFrom.h \ - eoEOSendMessFrom.h \ - eoHeaderMessFrom.h \ - eoKillMessFrom.h \ - eoPublishMessFrom.h - -### Makefile.am ends here diff --git a/eo/src/paradisEO/comm/messages/from/eoEOReceiveMessFrom.h b/eo/src/paradisEO/comm/messages/from/eoEOReceiveMessFrom.h deleted file mode 100644 index 299e60e7..00000000 --- a/eo/src/paradisEO/comm/messages/from/eoEOReceiveMessFrom.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoEOReceiveMessFrom.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoEOReceiveMessFrom_h -#define eoEOReceiveMessFrom_h - -#include -#include -#include - -/** - A message expressing the need of immigration of EO ... - */ - -template class eoEOReceiveMessFrom : public eoMessFrom { - -public : - - /** - Constructor - */ - - eoEOReceiveMessFrom (eoLocalListener & _loc_listen) : - eoMessFrom (_loc_listen) { - - // Nothing else to receive :-) - } - - void operator () () { - - loc_listen.need_immigration () = true ; - } - -} ; - -#endif - - - - - - - - diff --git a/eo/src/paradisEO/comm/messages/from/eoEOSendMessFrom.h b/eo/src/paradisEO/comm/messages/from/eoEOSendMessFrom.h deleted file mode 100644 index 442c9bcb..00000000 --- a/eo/src/paradisEO/comm/messages/from/eoEOSendMessFrom.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoEOSendMessFrom.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoEOSendMessFrom_h -#define eoEOSendMessFrom_h - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#ifdef HAVE_SSTREAM -#include -#else -#include -#endif - -#include - - - -/** - A message embeding a set of immigrants ... -*/ -template class eoEOSendMessFrom : public eoMessFrom -{ -public: - - /** - Constructor - */ - eoEOSendMessFrom (eoLocalListener & _loc_listen) - : eoMessFrom (_loc_listen) { - MPI :: Status stat ; - comm.Probe (loc_listen.number (), 0, stat) ; - int len = stat.Get_count (MPI :: CHAR) ; - char buff [len] ; - comm.Recv(buff, len, MPI::CHAR, loc_listen.number (), 0) ; -#ifdef HAVE_SSTREAM - std::istringstream f(buff); -#else - istrstream f(buff); -#endif - _pop.readFrom(f); - } - - - - void operator() () { - loc_listen.push (_pop) ; - // std::cout << "Reception de " << pop.size () << "individus " << std::endl ; - } - - -protected: - - eoPop _pop ; // New immigrants ! -}; - -#endif diff --git a/eo/src/paradisEO/comm/messages/from/eoHeaderMessFrom.h b/eo/src/paradisEO/comm/messages/from/eoHeaderMessFrom.h deleted file mode 100644 index bd30c04a..00000000 --- a/eo/src/paradisEO/comm/messages/from/eoHeaderMessFrom.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoHeaderMessFrom.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoHeaderMessFrom_h -#define eoHeaderMessFrom_h - -#include -#include - -template class eoLocalListener ; - -/** - A header is an identifier for the kind of - message to be then received ... -*/ - -template class eoHeaderMessFrom : public std::string { - -public : - - /** - Second constructor. On contrary, the header is - waited for and built from the local listener. - It comes before a message. - */ - - eoHeaderMessFrom (eoLocalListener & loc_listen) : - comm (MPI :: COMM_WORLD) { - - MPI :: Status stat ; - comm.Probe (loc_listen.number (), 0, stat) ; // Blocking - int len = stat.Get_count (MPI :: CHAR) ; - char buff [len] ; // Temp. buffer - comm.Recv (buff, len, MPI :: CHAR, loc_listen.number (), 0) ; - assign (buff) ; - } - -private : - - MPI :: Comm & comm ; // Communicator - -} ; - -#endif - diff --git a/eo/src/paradisEO/comm/messages/from/eoKillMessFrom.h b/eo/src/paradisEO/comm/messages/from/eoKillMessFrom.h deleted file mode 100644 index 2a8d7c09..00000000 --- a/eo/src/paradisEO/comm/messages/from/eoKillMessFrom.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoKillMessFrom.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoKillMessFrom_h -#define eoKillMessFrom_h - -#include -#include -#include - -/** - To destroy current process ... - */ - -template class eoKillMessFrom : public eoMessFrom { - -public : - - /** - Constructor - */ - - eoKillMessFrom (eoLocalListener & _loc_listen) : - eoMessFrom (_loc_listen) { - - // Nothing else to receive :-) - } - - void operator () () { - - loc_listen.destroy () ; - } - -} ; - -#endif - - - - - - - - diff --git a/eo/src/paradisEO/comm/messages/from/eoPublishMessFrom.h b/eo/src/paradisEO/comm/messages/from/eoPublishMessFrom.h deleted file mode 100644 index 4521fa7c..00000000 --- a/eo/src/paradisEO/comm/messages/from/eoPublishMessFrom.h +++ /dev/null @@ -1,68 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoPublishMessFrom.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoPublishMessFrom_h -#define eoPublishMessFrom_h - -#include -#include -#include - -/** - To be notified of the lauch of a new kind of process somewhere ... - */ - -template class eoPublishMessFrom : public eoMessFrom { - -public : - - /** - Constructor - */ - - eoPublishMessFrom (eoLocalListener & _loc_listen) : - eoMessFrom (_loc_listen) { - - MPI :: Status stat ; - comm.Probe (loc_listen.number (), 0, stat) ; - int len = stat.Get_count (MPI :: CHAR) ; - char buff [len] ; - comm.Recv (buff, len, MPI :: CHAR, loc_listen.number (), 0) ; - label.assign (buff) ; - } - - void operator () () { - - loc_listen.label () = label ; - } - -private : - - std::string label ; // String identifier ... - -} ; - -#endif - - - diff --git a/eo/src/paradisEO/comm/messages/to/Makefile.am b/eo/src/paradisEO/comm/messages/to/Makefile.am deleted file mode 100644 index 0a8259bf..00000000 --- a/eo/src/paradisEO/comm/messages/to/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -pkginclude_HEADERS = eoEOReceiveMessTo.h \ - eoEOSendMessTo.h \ - eoHeaderMessTo.h \ - eoKillMessTo.h \ - eoPublishMessTo.h - -### Makefile.am ends here diff --git a/eo/src/paradisEO/comm/messages/to/eoEOReceiveMessTo.h b/eo/src/paradisEO/comm/messages/to/eoEOReceiveMessTo.h deleted file mode 100644 index e9c33f03..00000000 --- a/eo/src/paradisEO/comm/messages/to/eoEOReceiveMessTo.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoEOReceiveMessTo.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -/** - A message expressing an immigration need. -*/ - -#ifndef eoEOReceiveMessTo_h -#define eoEOReceiveMessTo_h - -#include -#include - -template class eoEOReceiveMessTo : public eoMessTo { - -public : - - /** - Constructor ... - */ - - eoEOReceiveMessTo () : eoMessTo ("eoEOReceiveMessTo") { - - } - - // Nothing else ! :-) - -} ; - -#endif - - diff --git a/eo/src/paradisEO/comm/messages/to/eoEOSendMessTo.h b/eo/src/paradisEO/comm/messages/to/eoEOSendMessTo.h deleted file mode 100644 index a5f4dfa7..00000000 --- a/eo/src/paradisEO/comm/messages/to/eoEOSendMessTo.h +++ /dev/null @@ -1,79 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoEOSendMessTo.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - - -#ifndef eoEOSendMessTo_h -#define eoEOSendMessTo_h - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#ifdef HAVE_SSTREAM -#include -#else -#include -#endif -#include -#include - - -/** A message embeding immigrants to send to ... */ -template class eoEOSendMessTo : public eoMessTo { - -public : - - /** - Constructor ... - */ - - eoEOSendMessTo (eoPop & _pop ) - : eoMessTo ("eoEOSendMessTo"), - pop (_pop) - {} - - /** - To send the given population ... - */ - void operator () (eoLocalListener & loc_listen) { - eoMessTo :: operator () (loc_listen) ; -#ifdef HAVE_SSTREAM - std::ostringstream f; - pop.printOn(f); - comm.Send(f.str().c_str(), f.str().size(), MPI::CHAR, loc_listen.number(), 0); -#else - std::ostrstream f; - pop.printOn (f); - comm.Send (f.str(), f.pcount(), MPI::CHAR, loc_listen.number(), 0); -#endif - loc_listen.need_immigration () = false; - } - - -protected: - - eoPop & pop ; // The set of EO to send. -} ; - -#endif diff --git a/eo/src/paradisEO/comm/messages/to/eoHeaderMessTo.h b/eo/src/paradisEO/comm/messages/to/eoHeaderMessTo.h deleted file mode 100644 index a7f368e4..00000000 --- a/eo/src/paradisEO/comm/messages/to/eoHeaderMessTo.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoHeaderMessTo.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoHeaderMessTo_h -#define eoHeaderMessTo_h - -#include - -#include - -template class eoLocalListener ; - -/** - A header is an identifier for the kind of - message to be then sent ... -*/ - -template class eoHeaderMessTo : public std::string { - -public : - - /** - Constructor. - The std::string identifiant id given in parameter. - */ - - eoHeaderMessTo (std::string label) : - - std::string (label), - comm (MPI :: COMM_WORLD) { - - } - - /** - Emission of the header to the next process. The body message - should then follow ... - */ - - void operator () (eoLocalListener & loc_listen) { - - comm.Send (c_str (), size () + 1, MPI :: CHAR, loc_listen.number (), 0) ; - } - -private : - - MPI :: Comm & comm ; // Communicator - -} ; - -#endif - diff --git a/eo/src/paradisEO/comm/messages/to/eoKillMessTo.h b/eo/src/paradisEO/comm/messages/to/eoKillMessTo.h deleted file mode 100644 index 5d0597c1..00000000 --- a/eo/src/paradisEO/comm/messages/to/eoKillMessTo.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoKillMessTo.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -/** - To destroy a distant agent ... -*/ - -#ifndef eoKillMessTo_h -#define eoKillMessTo_h - -#include -#include - -template class eoKillMessTo : public eoMessTo { - -public : - - /** - Constructor ... - */ - - eoKillMessTo () : eoMessTo ("eoKillMessTo") { - - } - - // Nothing else ! :-) - -} ; - -#endif - - diff --git a/eo/src/paradisEO/comm/messages/to/eoPublishMessTo.h b/eo/src/paradisEO/comm/messages/to/eoPublishMessTo.h deleted file mode 100644 index 0b7f8134..00000000 --- a/eo/src/paradisEO/comm/messages/to/eoPublishMessTo.h +++ /dev/null @@ -1,66 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoPublishMessTo.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -/** - To let know from distributed algos the std::string identifier - of the home process ... -*/ - -#ifndef eoPublishMessTo_h -#define eoPublishMessTo_h - -#include -#include -#include -#include - -template class eoPublishMessTo : public eoMessTo { - -public : - - /** - Constructor - */ - - eoPublishMessTo (std::string & _label - ) : - eoMessTo ("eoPublishMessTo"), - label (_label) { - - } - - void operator () (eoLocalListener & loc_listen) { - - eoMessTo :: operator () (loc_listen) ; - comm.Send (label.c_str (), label.size () + 1, MPI :: CHAR, loc_listen.number (), 0) ; - } - -private : - - std::string label ; // String identifier to send ... - -} ; - -#endif - - diff --git a/eo/src/paradisEO/eoPopAgent.h b/eo/src/paradisEO/eoPopAgent.h deleted file mode 100644 index 093fca23..00000000 --- a/eo/src/paradisEO/eoPopAgent.h +++ /dev/null @@ -1,89 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoPopAgent.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoPopAgent_h -#define eoPopAgent_h - -#include -#include -#include - -#include - -/** - A popAgent is waiting for any populations that are queued. - For each one, a processing is performed. -*/ - -template class eoPopAgent { - -public : - - /** - Constructor - */ - - eoPopAgent (std::string _label, - eoListener & _listen, - eoPopAlgo & _algo - ) : - label (_label), - listen (_listen), - algo (_algo) { - - } - - // Waiting for eoPop reception and then ... - - void operator () () { - - listen.publish (label) ; // To be known by everyone ... - - while (true) { - - listen.wait () ; // While no neighbour sends any eoPop ... - - for (int i = 0 ; i < listen.size () ; i ++) { - - while (! listen [i].empty ()) { - - eoPop & pop = listen [i].front () ; - std::cout << "Agent [" << label << "] on " << listen.here ().host_name << " : Receiving " << pop.size () << " individuals ..." << std::endl ; - algo (pop) ; - eoEOSendMessTo mess (pop) ; - mess (listen [i]) ; // Coming back ... - listen [i].pop () ; - } - } - } - } - -private : - - std::string label ; // std::string identifier - eoListener & listen ; // EO's listener - eoPopAlgo & algo ; // Local supplied algo - -} ; - -#endif diff --git a/eo/src/paradisEO/eoSolAgent.h b/eo/src/paradisEO/eoSolAgent.h deleted file mode 100644 index 96683bbd..00000000 --- a/eo/src/paradisEO/eoSolAgent.h +++ /dev/null @@ -1,91 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoSolAgent.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoSolAgent_h -#define eoSolAgent_h - -#include -#include -#include - -#include - -/** - A solAgent is waiting for any solutions that are queued. - For each one, a processing is performed. -*/ - -template class eoSolAgent { - -public : - - /** - Constructor - */ - - eoSolAgent (std::string _label, - eoListener & _listen, - eoSolAlgo & _algo - ) : - label (_label), - listen (_listen), - algo (_algo) { - - } - - // Waiting for eoPop reception and then ... - - void operator () () { - - listen.publish (label) ; // To be known by everyone ... - - while (true) { - - listen.wait () ; // While no neighbour sends any eoPop ... - - for (int i = 0 ; i < listen.size () ; i ++) { - - while (! listen [i].empty ()) { - - EOT & sol = listen [i].front () ; - std::cout << "Agent [" << label << "] on " << listen.here ().host_name << " : Receiving one individual ..." << std::endl ; - algo (sol) ; - eoPop pop ; - pop.push_back (sol) ; - eoEOSendMessTo mess (pop) ; - mess (listen [i]) ; // Coming back ... - listen [i].pop () ; - } - } - } - } - -private : - - std::string label ; // std::string identifier - eoListener & listen ; // EO's listener - eoSolAlgo & algo ; // Local supplied algo - -} ; - -#endif diff --git a/eo/src/paradisEO/eval/Makefile.am b/eo/src/paradisEO/eval/Makefile.am deleted file mode 100644 index a6947edf..00000000 --- a/eo/src/paradisEO/eval/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -pkginclude_HEADERS = eoDistEvalEasyEA.h \ - eoDistEvalEasyEA.h \ - eoDistPopEvalFunc.h \ - eoEvaluator.h \ - eoPopEval.h - -### Makefile.am ends here diff --git a/eo/src/paradisEO/eval/eoDistEvalEasyEA.h b/eo/src/paradisEO/eval/eoDistEvalEasyEA.h deleted file mode 100644 index 49395fcc..00000000 --- a/eo/src/paradisEO/eval/eoDistEvalEasyEA.h +++ /dev/null @@ -1,63 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoDistEvalEasyEA.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoDistEvalEasyEA_h -#define eoDistEvalEasyEA_h - -#include -#include -#include - -/** - Intended for evaluation CPU cost evolutionnary algorithm ... - */ - -template class eoDistEvalEasyEA : public eoEasyEA { - -public : - - /** - Constructor. Caution ! The provided label is the one - of distributed evaluators to search for and not those of - the master program, which is isn't necessary. - */ - - eoDistEvalEasyEA (eoListener & _listen, - eoEasyEA & _ea, - std::string _label - ) : - pop_eval (eoDistPopEvalFunc (_listen, _label, _ea.eval)), - eoEasyEA (_ea.continuator, - pop_eval, - _ea.breed, - _ea.replace - ) { - } - -private : - - eoDistPopEvalFunc pop_eval ; - -} ; - -#endif diff --git a/eo/src/paradisEO/eval/eoDistPopEvalFunc.h b/eo/src/paradisEO/eval/eoDistPopEvalFunc.h deleted file mode 100644 index 00170c03..00000000 --- a/eo/src/paradisEO/eval/eoDistPopEvalFunc.h +++ /dev/null @@ -1,127 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoDistPopEvalFunc.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoDistPopEvalFunc_h -#define eoDistPopEvalFunc_h - -#include -#include - -template class eoDistPopEvalFunc : public eoPopEvalFunc { - -public : - - /** - Constructor - */ - - eoDistPopEvalFunc (eoListener & _listen, - std::string & _label, - eoEvalFunc & _eval - ) : - listen (_listen), - label (_label), - eval (_eval) { - - } - - void operator () (eoPop & _parents, eoPop & _offspring) { - - int num_eval = 0 ; // How many distributed evaluators ? - int old_size = _offspring.size () ; - - do { - listen.update () ; - for (int i = 0 ; i < listen.size () ; i ++) { - if (listen [i].label () == label) - num_eval ++ ; - } - - if (num_eval == 0) { - std::cout << "No [" << label << "] available ..." << std::endl ; - std::cout << "Waiting for a few seconds ..." << std::endl ; - sleep (2) ; - } - } while (num_eval == 0) ; - - - // Partitioning ... - - int j = 0, l = 0 ; - - bool t [listen.size ()] ; - for (int i = 0 ; i < listen.size () ; i ++) - t [i] = false ; - - for (int i = 0 ; i < num_eval ; i ++) { - - eoPop pop ; - for (int k = 0 ; k < old_size / num_eval ; k ++) - pop.push_back (_offspring [j ++]) ; - - if (i < old_size % num_eval) - pop.push_back (_offspring [j ++]) ; - - // Next evaluator ... - while (listen [l].label () != label) { - - l ++ ; - } - - eoEOSendMessTo mess (pop) ; - mess (listen [l]) ; - t [l ++] = true ; - } - - // On standby of the returns - _offspring.clear () ; - - // while (_offspring.size () != old_size) { - - // listen.wait () ; - - for (int i = 0 ; i < listen.size () ; i ++) - if (t [i]) { - listen [i].wait () ; - //while (! listen [i].empty ()) { - - eoPop & pop = listen [i].front () ; - - for (int m = 0 ; m < pop.size () ; m ++) - _offspring.push_back (pop [m]) ; - - listen [i].pop () ; - - //} - //} - } - } - -private : - - eoListener & listen ; - std::string label ; // String identifier of evaluators - eoEvalFunc & eval ; -} ; - -#endif diff --git a/eo/src/paradisEO/eval/eoEvaluator.h b/eo/src/paradisEO/eval/eoEvaluator.h deleted file mode 100644 index eb2a98e6..00000000 --- a/eo/src/paradisEO/eval/eoEvaluator.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoEvaluator.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoEvaluator_h -#define eoEvaluator_h - -#include -#include -#include - -#include - -/** - A special pop. based agent, applied to eval sub_populations. - Rather intended for evolutionnary algorithms, with evaluations - performed remotely. -*/ - -template class eoEvaluator : public eoPopAgent { - -public : - - /** - Constructor - */ - - eoEvaluator (std::string _label, - eoListener & _listen, - eoEvalFunc & _eval - ) : - pop_eval (_eval), - eoPopAgent (_label, - _listen, - pop_eval) { - - } - -private : - - eoPopEval pop_eval ; - -} ; - -#endif diff --git a/eo/src/paradisEO/eval/eoPopEval.h b/eo/src/paradisEO/eval/eoPopEval.h deleted file mode 100644 index 78f28e92..00000000 --- a/eo/src/paradisEO/eval/eoPopEval.h +++ /dev/null @@ -1,66 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoPopEval.h" - -// (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 - - Contact: cahon@lifl.fr -*/ - -#ifndef eoPopEval_h -#define eoPopEval_h - -#include -#include -#include - -/** - An evaluator which computes fitnesses of a given population in a - sequentially manner. - */ - -template class eoPopEval : public eoPopAlgo { - -public : - - /** - Constructor - */ - - eoPopEval (eoEvalFunc & _eval) : eval(_eval) { - - } - - /** - Values sequentially each EO from the pop. given in parameter. - */ - - void operator () (eoPop & _pop) { - - for (unsigned i = 0 ; i < _pop.size () ; i ++) - _pop [i].invalidate () ; - - apply (eval, _pop) ; - } - -private : - - eoEvalFunc & eval ; -} ; - -#endif - diff --git a/eo/src/paradisEO/island/Makefile.am b/eo/src/paradisEO/island/Makefile.am deleted file mode 100644 index 96c78619..00000000 --- a/eo/src/paradisEO/island/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -SUBDIRS = topologies - -pkginclude_HEADERS = eoConnectivity.h \ - eoCyclicGenContinue.h \ - eoIslandsEasyEA.h \ - eoMigUpdater.h - -### Makefile.am ends here diff --git a/eo/src/paradisEO/island/eoConnectivity.h b/eo/src/paradisEO/island/eoConnectivity.h deleted file mode 100644 index fdfdd83e..00000000 --- a/eo/src/paradisEO/island/eoConnectivity.h +++ /dev/null @@ -1,88 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoConnectivity.h" - -// (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 eoConnectivity_h -#define eoConnectivity_h - -#include -#include -#include - -/** - It defines the entering and outgoing channels of communication - towards the other considered agents. -*/ - -template class eoConnectivity { - -public : - - /** - Constructor. Names of others processes to consider in the topology are given - in parameter. - */ - - eoConnectivity (eoListener & _listen, - std::vector & _sel_neigh - ) : - listen (_listen), - sel_neigh (_sel_neigh) { - - } - - /** - Computes the subset of neighbours to receive - immigrants from ... - */ - - virtual std::vector *> from () = 0 ; - - /** - Computes the subset of neighbours to send - emigrants to ... - */ - - virtual std::vector *> to () = 0 ; - -protected : - - eoListener & listen ; - - std::vector sel_neigh ; - - bool selected (std::string & id) { - - for (int i = 0 ; i < sel_neigh.size () ; i ++) - if (sel_neigh [i] == id) - return true ; - return false ; - } - -} ; - -#endif - - - - diff --git a/eo/src/paradisEO/island/eoCyclicGenContinue.h b/eo/src/paradisEO/island/eoCyclicGenContinue.h deleted file mode 100644 index cb7d7973..00000000 --- a/eo/src/paradisEO/island/eoCyclicGenContinue.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoCyclicGenContinue.h" - -// (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 eoCyclicGenContinue_h -#define eoCyclicGenContinue_h - -#include -#include - -/** - This continuator returns false in a periodic way during generations. -*/ - -template class eoCyclicGenContinue: public eoContinue { - -public: - - /** - Constructor. The frequency is given in parameter. - */ - - eoCyclicGenContinue (unsigned _freq, - unsigned init_count = 0) : - freq (_freq), - count (init_count) { - } - - /** - Return true only if the current number of performed generations - modulo the frequency equals none. - */ - - virtual bool operator () (const eoPop & pop) { - - count ++ ; - return (count % freq) != 0 ; - } - -private: - - unsigned count, freq ; -} ; - -#endif - diff --git a/eo/src/paradisEO/island/eoIslandsEasyEA.h b/eo/src/paradisEO/island/eoIslandsEasyEA.h deleted file mode 100644 index df747151..00000000 --- a/eo/src/paradisEO/island/eoIslandsEasyEA.h +++ /dev/null @@ -1,97 +0,0 @@ -// -*- 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 diff --git a/eo/src/paradisEO/island/eoMigUpdater.h b/eo/src/paradisEO/island/eoMigUpdater.h deleted file mode 100644 index bfdbf3db..00000000 --- a/eo/src/paradisEO/island/eoMigUpdater.h +++ /dev/null @@ -1,141 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoMigUpdater.h" - -// (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 eoMigUpdater_h -#define eoMigUpdater_h - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - An updater. After any evolution of an evolutionnary algorithm, it - moves some EO from/into the current population from/to a subset - of the neighbouring algos. -*/ - -template class eoMigUpdater : public eoUpdater { - -public : - - /** - Constructor. Some features which should be specified. - - The neighbouring interface, - - The communication topology, - - Which EO instancies from the given population should be sent ? - - How integrate new immigrants ? - - Then, an event to determine the time to ask neighbouring sources - for sending sets of EO. - */ - - eoMigUpdater (eoListener & _listen, - eoConnectivity & _conn, - eoContinue & _cont, - eoSelect & _select, - eoReplacement & _replace) : - listen (_listen), - conn (_conn), - cont (_cont), - select (_select), - replace (_replace) { - - } - - /** - Sets the given population to be the one to receive and/or send EO - */ - - void operator () (eoPop & _pop) { - - pop = & _pop ; - } - - /** - Should be often called. (after each local evolution ?) - */ - - virtual void operator () () { - - listen.update () ; - // listen.display () ; - - std::vector *> src = conn.from (), dest = conn.to () ; - - // Any coming immigrants ? - for (int i = 0 ; i < src.size () ; i ++) { - src [i] -> update () ; - while (! src [i] -> empty ()) { - replace (* pop, src [i] -> front ()) ; - std::cout << "[" << listen.here ().host_name << "] Arrival of " << src [i] -> front ().size () << " individuals ..." << std::endl ; - src [i] -> pop () ; - } - } - - // Any request ? - for (int i = 0 ; i < dest.size () ; i ++) - if (dest [i] -> need_immigration ()) { - eoPop emm ; // Emmigrants - select (* pop, emm) ; - eoEOSendMessTo mess (emm) ; - mess (* (dest [i])) ; - } - - // Any request to submit ? - if (! cont (* pop)) - for (int i = 0 ; i < src.size () ; i ++) { - eoEOReceiveMessTo mess ; - mess (* (src [i])) ; - } - } - -private : - - eoConnectivity & conn ; // The used topology - - eoContinue & cont ; /* The 'event' which determines - need of immigration */ - - eoSelect & select ; /* In order to select emmigrants - from the current population */ - - eoReplacement & replace ; // The replacement procedure - - eoPop * pop ; // The population considered - - eoListener & listen ; // A reference to the neighbouring - -} ; - -#endif - - - - - - diff --git a/eo/src/paradisEO/island/topologies/Makefile.am b/eo/src/paradisEO/island/topologies/Makefile.am deleted file mode 100644 index 946d9d9c..00000000 --- a/eo/src/paradisEO/island/topologies/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2004 Jochen Küpper - -pkginclude_HEADERS = eoFullConnectivity.h\ - eoRingConnectivity.h - -### Makefile.am ends here diff --git a/eo/src/paradisEO/island/topologies/eoFullConnectivity.h b/eo/src/paradisEO/island/topologies/eoFullConnectivity.h deleted file mode 100644 index 9ee3d78d..00000000 --- a/eo/src/paradisEO/island/topologies/eoFullConnectivity.h +++ /dev/null @@ -1,102 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoFullConnectivity.h" - -// (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 eoFullConnectivity_h -#define eoFullConnectivity_h - -#include - -/** - Each algorithm is also connected to the whole neighbouring ... -*/ - -template class eoFullConnectivity : public eoConnectivity { - -public : - - /** - Constructor - */ - - eoFullConnectivity (eoListener & _listen, - std::vector & _sel_neigh - ) : eoConnectivity (_listen, _sel_neigh) { - } - - virtual std::vector *> from () { - - listen.update () ; - - std::vector *> v ; - - for (int i = 0 ; i < listen.size () ; i ++) - if (i != listen.here ().number () && selected (listen [i].label ())) - v.push_back (& listen [i]) ; - - return v ; - } - - virtual std::vector *> to () { - - listen.update () ; - - std::vector *> v ; - - for (int i = 0 ; i < listen.size () ; i ++) - if (i != listen.here ().number () && selected (listen [i].label ())) - v.push_back (& listen [i]) ; - - return v ; - } - -} ; - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eo/src/paradisEO/island/topologies/eoRingConnectivity.h b/eo/src/paradisEO/island/topologies/eoRingConnectivity.h deleted file mode 100644 index b2f654ec..00000000 --- a/eo/src/paradisEO/island/topologies/eoRingConnectivity.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "eoRingConnectivity.h" - -// (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 eoRingConnectivity_h -#define eoRingConnectivity_h - -#include - -/** - Each algorithm has a single std::pair of entering and outgoing - neighbours, so that the unit constitutes a circular topology. -*/ - -template class eoRingConnectivity : public eoConnectivity { - -public : - - /** - Constructor - */ - - eoRingConnectivity (eoListener & _listen, - std::vector & _sel_neigh - ) : eoConnectivity (_listen, _sel_neigh) { - } - - virtual std::vector *> from () { - - listen.update () ; - - std::vector *> v ; - int i, k = listen.size () ; - - for (i = 0 ; i < k ; i ++) { - if (listen [i] == listen.here ()) - break ; - } - - for (int j = (i - 1 + k) % k ; j != i ; j = (j - 1 + k) % k) - if (selected (listen [j].label ())) { - v.push_back (& listen [j]) ; - break ; - } - - return v ; - } - - /** - - */ - - virtual std::vector *> to () { - - listen.update () ; - - std::vector *> v ; - int i, k = listen.size () ; - - for (i = 0 ; i < k ; i ++) - if (listen [i] == listen.here ()) - break ; - - for (int j = (i + 1) % k ; j != i ; j = (j + 1) % k) - if (selected (listen [j].label ())) { - v.push_back (& listen [j]) ; - break ; - } - - return v ; - } - -} ; - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - -