diff options
| author | Mike Buland <mike@xagasoft.com> | 2012-08-02 15:20:58 -0600 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2012-08-02 15:20:58 -0600 |
| commit | 3cdf68e08d438a0ced0f5f8d957a6aafd68cb43a (patch) | |
| tree | a860e10dbd35766b05e4bec1bd7b648884f24a2d /src/tests | |
| parent | 299640ce5f6499e07c5799f48897ac5a77e72c54 (diff) | |
| download | libgenetic-3cdf68e08d438a0ced0f5f8d957a6aafd68cb43a.tar.gz libgenetic-3cdf68e08d438a0ced0f5f8d957a6aafd68cb43a.tar.bz2 libgenetic-3cdf68e08d438a0ced0f5f8d957a6aafd68cb43a.tar.xz libgenetic-3cdf68e08d438a0ced0f5f8d957a6aafd68cb43a.zip | |
New commit method
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/binary.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tests/binary.cpp b/src/tests/binary.cpp index 717c171..727feec 100644 --- a/src/tests/binary.cpp +++ b/src/tests/binary.cpp | |||
| @@ -13,24 +13,30 @@ int main( int argc, char *argv[] ) | |||
| 13 | Bu::Random::setGenerator<Bu::RandomCmwc>(); | 13 | Bu::Random::setGenerator<Bu::RandomCmwc>(); |
| 14 | Bu::Random::seed( time( NULL ) ); | 14 | Bu::Random::seed( time( NULL ) ); |
| 15 | 15 | ||
| 16 | Genetic::OperatorBasic op( new Genetic::PhenotypeBinary( 45 ), 0.1 ); | 16 | Genetic::OperatorBasic op( new Genetic::PhenotypeBinary( 422*1024 ), 0.0 ); |
| 17 | Genetic::Phenotype *pPb1 = op.random(); | 17 | Genetic::Phenotype *pPb1 = op.random(); |
| 18 | Genetic::Phenotype *pPb2 = op.random(); | 18 | Genetic::Phenotype *pPb2 = op.random(); |
| 19 | Genetic::Phenotype *pPb3; | 19 | Genetic::Phenotype *pPb3; |
| 20 | 20 | ||
| 21 | sio << pPb1->toString() << sio.nl; | 21 | // sio << pPb1->toString() << sio.nl; |
| 22 | sio << pPb2->toString() << sio.nl; | 22 | // sio << pPb2->toString() << sio.nl; |
| 23 | 23 | ||
| 24 | Genetic::PhenotypeList lParents; | 24 | Genetic::PhenotypeList lParents; |
| 25 | lParents.append( pPb1 ); | 25 | lParents.append( pPb1 ); |
| 26 | lParents.append( pPb2 ); | 26 | lParents.append( pPb2 ); |
| 27 | pPb3 = op.mate( lParents ); | ||
| 28 | 27 | ||
| 29 | sio << pPb3->toString() << sio.nl; | 28 | for( int j = 0; j < 1000; j++ ) |
| 29 | { | ||
| 30 | delete op.mate( lParents ); | ||
| 31 | } | ||
| 32 | |||
| 33 | // pPb3 = pPb1->makeEmptyOffspring(); | ||
| 34 | // pPb3->copyFrom( *pPb1, 4, 88 ); | ||
| 35 | // sio << pPb3->toString() << sio.nl; | ||
| 30 | 36 | ||
| 31 | delete pPb1; | 37 | delete pPb1; |
| 32 | delete pPb2; | 38 | delete pPb2; |
| 33 | delete pPb3; | 39 | // delete pPb3; |
| 34 | 40 | ||
| 35 | return 0; | 41 | return 0; |
| 36 | } | 42 | } |
