eoSymCrossover.h

00001 /*          
00002  *             Copyright (C) 2005 Maarten Keijzer
00003  *
00004  *          This program is free software; you can redistribute it and/or modify
00005  *          it under the terms of version 2 of the GNU General Public License as 
00006  *          published by the Free Software Foundation. 
00007  *
00008  *          This program is distributed in the hope that it will be useful,
00009  *          but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  *          GNU General Public License for more details.
00012  *
00013  *          You should have received a copy of the GNU General Public License
00014  *          along with this program; if not, write to the Free Software
00015  *          Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016  */
00017 
00018 #ifndef EOSYMCROSSOVER_H
00019 #define EOSYMCROSSOVER_H
00020 
00021 class NodeSelector;
00022 class Sym;
00023 
00024 #include <eoOp.h>
00025     
00026 extern bool subtree_quad(Sym& a, Sym& b, NodeSelector& select);
00027 template <class EoType>
00028 class eoQuadSubtreeCrossover : public eoQuadOp<EoType> {
00029     NodeSelector& node_selector;
00030     
00031     public:
00032     eoQuadSubtreeCrossover(NodeSelector& _node_selector) : node_selector(_node_selector) {}
00033     
00034     bool operator()(EoType& a, EoType& b) { return subtree_quad(a,b, node_selector); }
00035 };
00036 
00037 
00038 extern bool subtree_bin(Sym& a, const Sym& b, NodeSelector& select);
00039 template <class EoType>
00040 class eoBinSubtreeCrossover : public eoBinOp<EoType> {
00041     NodeSelector& node_selector;
00042 
00043     public :
00044 
00045     eoBinSubtreeCrossover(NodeSelector& _node_selector) : node_selector(_node_selector) {}
00046 
00047     bool operator()(EoType& a, const EoType& b) { return subtree_bin(a, b, node_selector); }
00048 };
00049 
00053 extern bool homologous_bin(Sym& a, const Sym& b);
00054 template <class EoType>
00055 class eoBinHomologousCrossover : public eoBinOp<EoType> {
00056     public:
00057         bool operator()(EoType& a, const EoType& b) {
00058             return homologous_bin(a,b);
00059         }
00060 };
00061 
00062 
00063 #endif
00064 

Generated on Thu Oct 19 05:06:38 2006 for EO by  doxygen 1.3.9.1