diff options
author | Mike Buland <mike@xagasoft.com> | 2012-07-17 09:11:40 -0600 |
---|---|---|
committer | Mike Buland <mike@xagasoft.com> | 2012-07-17 09:11:40 -0600 |
commit | a2679e3bc2f407fae6b97908aeebb215c6678ebc (patch) | |
tree | ac220ef865dc38b6b4a10a03e5d48aad261cddd3 /src/tests | |
parent | a48556c1c5c01892cf493cd3eb4ff969a2f548fd (diff) | |
download | libgenetic-a2679e3bc2f407fae6b97908aeebb215c6678ebc.tar.gz libgenetic-a2679e3bc2f407fae6b97908aeebb215c6678ebc.tar.bz2 libgenetic-a2679e3bc2f407fae6b97908aeebb215c6678ebc.tar.xz libgenetic-a2679e3bc2f407fae6b97908aeebb215c6678ebc.zip |
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.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/maxima/fitnessfunctioneq.cpp | 5 | ||||
-rw-r--r-- | src/tests/maxima/fitnessfunctioneq.h | 1 | ||||
-rw-r--r-- | src/tests/maxima/main.cpp | 1 |
3 files changed, 7 insertions, 0 deletions
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 ) | |||
23 | return -1.8*(x*x*x*x) + 0.86*(x*x*x) + 4.0*(x*x); | 23 | return -1.8*(x*x*x*x) + 0.86*(x*x*x) + 4.0*(x*x); |
24 | } | 24 | } |
25 | 25 | ||
26 | Genetic::FitnessFunction *FitnessFunctionEq::clone() const | ||
27 | { | ||
28 | return new FitnessFunctionEq(); | ||
29 | } | ||
30 | |||
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: | |||
10 | virtual ~FitnessFunctionEq(); | 10 | virtual ~FitnessFunctionEq(); |
11 | 11 | ||
12 | virtual double operator()( Genetic::Phenotype *pTest ); | 12 | virtual double operator()( Genetic::Phenotype *pTest ); |
13 | virtual Genetic::FitnessFunction *clone() const; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | #endif | 16 | #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[] ) | |||
23 | 0.05 | 23 | 0.05 |
24 | ), | 24 | ), |
25 | new FitnessFunctionEq(), | 25 | new FitnessFunctionEq(), |
26 | 4, | ||
26 | 1000, | 27 | 1000, |
27 | .1, .1 | 28 | .1, .1 |
28 | ); | 29 | ); |