From b2de3403a622e66cff6d7949254a1b09c47cf6c9 Mon Sep 17 00:00:00 2001 From: maartenkeijzer Date: Wed, 21 Jan 2004 19:57:19 +0000 Subject: [PATCH] Added define NO_GNUPLOT to disable gnuplot extensions Needed for win32 (well, at least for me) --- eo/config.cache | 4 +- eo/src/pyeo/Makefile | 19 ---------- eo/src/pyeo/test/test_transform.py | 61 ++++++++++++++++++++++++++++++ eo/src/pyeo/valueParam.cpp | 1 + eo/src/utils/eoGnuplot.h | 5 ++- eo/src/utils/eoGnuplot1DMonitor.h | 2 + eo/src/utils/eoGnuplot1DSnapshot.h | 2 + 7 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 eo/src/pyeo/test/test_transform.py diff --git a/eo/config.cache b/eo/config.cache index bb2c1689..e125cf21 100644 --- a/eo/config.cache +++ b/eo/config.cache @@ -24,12 +24,12 @@ ac_cv_lib_eoutils_main=${ac_cv_lib_eoutils_main=no} ac_cv_lib_m_main=${ac_cv_lib_m_main=yes} ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'} ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'} -ac_cv_prog_CXX=${ac_cv_prog_CXX=/opt/intel/compiler70/ia32/bin/icpc} +ac_cv_prog_CXX=${ac_cv_prog_CXX=c++} ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'} ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib} ac_cv_prog_cxx_cross=${ac_cv_prog_cxx_cross=no} ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g=yes} ac_cv_prog_cxx_works=${ac_cv_prog_cxx_works=yes} -ac_cv_prog_gxx=${ac_cv_prog_gxx=no} +ac_cv_prog_gxx=${ac_cv_prog_gxx=yes} ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes} ac_cv_type_size_t=${ac_cv_type_size_t=yes} diff --git a/eo/src/pyeo/Makefile b/eo/src/pyeo/Makefile index 11587b13..3bf2977c 100644 --- a/eo/src/pyeo/Makefile +++ b/eo/src/pyeo/Makefile @@ -2,27 +2,8 @@ # # You need: # Python 2.2 -# Stlport # Boost.Python v2 # -# -# On my debian (unstable), I used libstlport_gcc.so.4.5 -# and libboost_python.so.1.29.0 -# -# Obviously together with python2.2 (as Boost.Python.v2 needs that) -# -# I'm pretty sure any stlport will do, but less convinced about boost.python -# That lib seems to be pretty much under development (as I found out, the hard way) -# but this version 1.29 seems to work for me. -# -# My version of boost was found in /usr/include, modify INC to your system -# -# For you happy Debian unstable users, just install -# -# apt-get install libstlport4.5 -# apt-get install libboost-python-dev -# apt-get install libboost-python1.29.0 -# CXX = g++ #-3.2 CXXFLAGS = -DHAVE_SSTREAM#-g #-DNDEBUG diff --git a/eo/src/pyeo/test/test_transform.py b/eo/src/pyeo/test/test_transform.py new file mode 100644 index 00000000..67d892e6 --- /dev/null +++ b/eo/src/pyeo/test/test_transform.py @@ -0,0 +1,61 @@ +"""Test script for the eoSGATranform class""" + +from copy import deepcopy +from PyEO import * +from maxone import * + +pop = eoPop() +for i in range(10): + eo = EO() + init(eo) + evaluate(eo) + pop.push_back(eo) + +transform = eoSGATransform(xover, 0.8, mutate, 0.2) + +def test1(pop, transform): + pop = deepcopy(pop) + print "test 1" + print "Initial population:" + print pop + + transform(pop) + + print "GM pop:" + print pop + +def test2(pop, transform): + pop = deepcopy(pop) + + print "test 2" + print "Initial population" + print pop + + checkpoint = eoCheckPoint(eoGenContinue(50)) + select = eoSelectNumber(eoDetTournamentSelect(3), 10) + replace = eoGenerationalReplacement() + + algo = eoEasyEA(checkpoint, evaluate, select, transform, replace) + algo(pop) + + print "Evoluated pop:" + print pop + +if __name__ == "__main__": + try: + test1(pop, transform) + except: + import sys + print + print "Caught an exception:" + print sys.exc_type, sys.exc_value + print + + try: + test2(pop, transform) + except: + import sys + print + print "Caught an exception:" + print sys.exc_type, sys.exc_value + print diff --git a/eo/src/pyeo/valueParam.cpp b/eo/src/pyeo/valueParam.cpp index 1e201770..c648df5f 100644 --- a/eo/src/pyeo/valueParam.cpp +++ b/eo/src/pyeo/valueParam.cpp @@ -178,6 +178,7 @@ void valueParam() define_valueParam("Float"); define_valueParam, numeric::array >("Vec"); define_valueParam< std::pair, tuple >("Pair"); + //define_valueParam< object, object >("Py"); class_ >("eoValueParam", init<>()) //.def(init()) diff --git a/eo/src/utils/eoGnuplot.h b/eo/src/utils/eoGnuplot.h index b06cba51..4498c1e1 100644 --- a/eo/src/utils/eoGnuplot.h +++ b/eo/src/utils/eoGnuplot.h @@ -21,6 +21,7 @@ Contact: Marc.Schoenauer@polytechnique.fr */ //----------------------------------------------------------------------------- +#ifndef NO_GNUPLOT #ifndef _eoGnuplot_H #define _eoGnuplot_H @@ -149,7 +150,7 @@ inline void eoGnuplot::initGnuPlot(std::string _title, std::string _extra) * Created......: Mon Mar 13 13:50:11 1995 * Description..: Communication par pipe bidirectionnel avec un autre process * - * Ident........: $Id: eoGnuplot.h,v 1.8 2003-03-21 02:39:09 maartenkeijzer Exp $ + * Ident........: $Id: eoGnuplot.h,v 1.9 2004-01-21 19:57:19 maartenkeijzer Exp $ * ---------------------------------------------------------------------- */ @@ -301,5 +302,5 @@ inline int PipeComWaitFor( PCom *from, char *what ) return 1; } - +#endif #endif diff --git a/eo/src/utils/eoGnuplot1DMonitor.h b/eo/src/utils/eoGnuplot1DMonitor.h index 8ab8082a..aa24a286 100644 --- a/eo/src/utils/eoGnuplot1DMonitor.h +++ b/eo/src/utils/eoGnuplot1DMonitor.h @@ -23,6 +23,7 @@ mkeijzer@dhi.dk */ //----------------------------------------------------------------------------- +#ifndef NO_GNUPLOT #ifndef _eoGnuplot1DMonitor_H #define _eoGnuplot1DMonitor_H @@ -129,3 +130,4 @@ inline void eoGnuplot1DMonitor::FirstPlot() } #endif +#endif diff --git a/eo/src/utils/eoGnuplot1DSnapshot.h b/eo/src/utils/eoGnuplot1DSnapshot.h index 0e208321..983b634e 100644 --- a/eo/src/utils/eoGnuplot1DSnapshot.h +++ b/eo/src/utils/eoGnuplot1DSnapshot.h @@ -23,6 +23,7 @@ mkeijzer@dhi.dk */ //----------------------------------------------------------------------------- +#ifndef NO_GNUPLOT #ifndef _eoGnuplot1DSnapshot_H #define _eoGnuplot1DSnapshot_H @@ -156,3 +157,4 @@ inline eoMonitor& eoGnuplot1DSnapshot::operator() (void) } #endif +#endif