EvolvingObjects
breeders.cpp
00001 /*
00002     PyEO
00003 
00004     Copyright (C) 2003 Maarten Keijzer
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00020 
00021 #include <eoBreed.h>
00022 #include <eoGeneralBreeder.h>
00023 #include <eoOneToOneBreeder.h>
00024 
00025 #include "PyEO.h"
00026 #include "def_abstract_functor.h"
00027 
00028 using namespace boost::python;
00029 
00030 #define DEF3(x, i1, i2)                         \
00031     class_<x<PyEO>, bases<eoBreed<PyEO > > >    \
00032     (#x,                                        \
00033      init<i1, i2 >()                            \
00034      [                                          \
00035       with_custodian_and_ward<1,2,              \
00036       with_custodian_and_ward<1,3               \
00037       >                                         \
00038       >                                         \
00039      ()                                         \
00040      ]                                          \
00041      )                                          \
00042     .def("__call__", &eoBreed<PyEO>::operator())
00043 
00044 void breeders()
00045 {
00046     def_abstract_functor<eoBreed<PyEO> >("eoBreed");
00047 
00048     DEF3(eoSelectTransform, eoSelect<PyEO>&, eoTransform<PyEO>&);
00049 
00050     DEF3(eoGeneralBreeder, eoSelectOne<PyEO>&, eoGenOp<PyEO>&)
00051         .def( init<eoSelectOne<PyEO>&, eoGenOp<PyEO>&, double>()[WC2])
00052         .def( init<eoSelectOne<PyEO>&, eoGenOp<PyEO>&, double, bool>()[WC2] )
00053         .def( init<eoSelectOne<PyEO>&, eoGenOp<PyEO>&, eoHowMany>() );
00054 
00055 
00056     DEF3(eoOneToOneBreeder, eoGenOp<PyEO>&, eoEvalFunc<PyEO>&)
00057         .def( init<eoGenOp<PyEO>&, eoEvalFunc<PyEO>&, double>()[WC2] )
00058         .def( init<eoGenOp<PyEO>&, eoEvalFunc<PyEO>&, double, eoHowMany>()[WC2] );
00059 }
 All Classes Namespaces Files Functions Variables Typedefs Friends