From a2679e3bc2f407fae6b97908aeebb215c6678ebc Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 17 Jul 2012 09:11:40 -0600 Subject: It all works multi-threaded. It restarts the threads every generation. Maybe not the worst thing every, but it seems like it would be better to stay in the thread and notify the main thread that they're done with that iteration. --- src/tests/maxima/fitnessfunctioneq.cpp | 5 +++++ src/tests/maxima/fitnessfunctioneq.h | 1 + src/tests/maxima/main.cpp | 1 + 3 files changed, 7 insertions(+) (limited to 'src/tests/maxima') diff --git a/src/tests/maxima/fitnessfunctioneq.cpp b/src/tests/maxima/fitnessfunctioneq.cpp index 5694507..c64e87a 100644 --- a/src/tests/maxima/fitnessfunctioneq.cpp +++ b/src/tests/maxima/fitnessfunctioneq.cpp @@ -23,3 +23,8 @@ double FitnessFunctionEq::operator()( Genetic::Phenotype *pTest ) return -1.8*(x*x*x*x) + 0.86*(x*x*x) + 4.0*(x*x); } +Genetic::FitnessFunction *FitnessFunctionEq::clone() const +{ + return new FitnessFunctionEq(); +} + diff --git a/src/tests/maxima/fitnessfunctioneq.h b/src/tests/maxima/fitnessfunctioneq.h index 7139532..d1a64c5 100644 --- a/src/tests/maxima/fitnessfunctioneq.h +++ b/src/tests/maxima/fitnessfunctioneq.h @@ -10,6 +10,7 @@ public: virtual ~FitnessFunctionEq(); virtual double operator()( Genetic::Phenotype *pTest ); + virtual Genetic::FitnessFunction *clone() const; }; #endif diff --git a/src/tests/maxima/main.cpp b/src/tests/maxima/main.cpp index ec02a41..db11f66 100644 --- a/src/tests/maxima/main.cpp +++ b/src/tests/maxima/main.cpp @@ -23,6 +23,7 @@ int main( int argc, char *argv[] ) 0.05 ), new FitnessFunctionEq(), + 4, 1000, .1, .1 ); -- cgit v1.2.3