summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2019-08-08 09:59:41 -0700
committerMike Buland <eichlan@xagasoft.com>2019-08-08 09:59:41 -0700
commitca9f059a4295db6269728b0b747036f995c777a9 (patch)
tree849844f91121dfe0c9a6d974838ffa2220cd67f8
parente9cfcc6dfc8427904ab227eea2452ccddd8f295c (diff)
downloadlibgenetic-ca9f059a4295db6269728b0b747036f995c777a9.tar.gz
libgenetic-ca9f059a4295db6269728b0b747036f995c777a9.tar.bz2
libgenetic-ca9f059a4295db6269728b0b747036f995c777a9.tar.xz
libgenetic-ca9f059a4295db6269728b0b747036f995c777a9.zip
Added more features to the simulation.
-rw-r--r--src/explicitsimulation.cpp10
-rw-r--r--src/explicitsimulation.h2
-rw-r--r--src/population.h2
3 files changed, 13 insertions, 1 deletions
diff --git a/src/explicitsimulation.cpp b/src/explicitsimulation.cpp
index 95b721b..3e4edc3 100644
--- a/src/explicitsimulation.cpp
+++ b/src/explicitsimulation.cpp
@@ -140,6 +140,16 @@ Genetic::PhenotypeId Genetic::ExplicitSimulation::selectWeighted()
140 return uMaxFitness; 140 return uMaxFitness;
141} 141}
142 142
143Genetic::PhenotypeId Genetic::ExplicitSimulation::getMaxFitnessId() const
144{
145 return uMaxFitness;
146}
147
148Genetic::Phenotype *Genetic::ExplicitSimulation::getMaxFitnessPhenotype() const
149{
150 return xPop.getPhenotype( uMaxFitness );
151}
152
143void Genetic::ExplicitSimulation::updateFitness() 153void Genetic::ExplicitSimulation::updateFitness()
144{ 154{
145 mFitness.lock(); 155 mFitness.lock();
diff --git a/src/explicitsimulation.h b/src/explicitsimulation.h
index 78cb904..9869053 100644
--- a/src/explicitsimulation.h
+++ b/src/explicitsimulation.h
@@ -28,6 +28,8 @@ namespace Genetic
28 28
29 double getMinFitness() const { return dMinFitness; } 29 double getMinFitness() const { return dMinFitness; }
30 double getMaxFitness() const { return dMaxFitness; } 30 double getMaxFitness() const { return dMaxFitness; }
31 Genetic::PhenotypeId getMaxFitnessId() const;
32 Genetic::Phenotype *getMaxFitnessPhenotype() const;
31 double getFitness( Genetic::PhenotypeId id ) const 33 double getFitness( Genetic::PhenotypeId id ) const
32 { return hFitness.get( id ); } 34 { return hFitness.get( id ); }
33 35
diff --git a/src/population.h b/src/population.h
index c2d1bec..4c7d435 100644
--- a/src/population.h
+++ b/src/population.h
@@ -26,7 +26,7 @@ namespace Genetic
26 int getSize() const { return hPhenotype.getSize(); } 26 int getSize() const { return hPhenotype.getSize(); }
27 27
28 PhenotypeId addPhenotype( Phenotype *pNew ); 28 PhenotypeId addPhenotype( Phenotype *pNew );
29 Phenotype *getPhenotype( PhenotypeId id ) 29 Phenotype *getPhenotype( PhenotypeId id ) const
30 { return hPhenotype.get( id ); } 30 { return hPhenotype.get( id ); }
31 bool hasProperty( PhenotypeId id, const Bu::String &sKey ) const; 31 bool hasProperty( PhenotypeId id, const Bu::String &sKey ) const;
32 Bu::Variant getProperty( PhenotypeId id, const Bu::String &sKey ) const; 32 Bu::Variant getProperty( PhenotypeId id, const Bu::String &sKey ) const;