From ca9f059a4295db6269728b0b747036f995c777a9 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 8 Aug 2019 09:59:41 -0700 Subject: Added more features to the simulation. --- src/explicitsimulation.cpp | 10 ++++++++++ src/explicitsimulation.h | 2 ++ src/population.h | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) 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() return uMaxFitness; } +Genetic::PhenotypeId Genetic::ExplicitSimulation::getMaxFitnessId() const +{ + return uMaxFitness; +} + +Genetic::Phenotype *Genetic::ExplicitSimulation::getMaxFitnessPhenotype() const +{ + return xPop.getPhenotype( uMaxFitness ); +} + void Genetic::ExplicitSimulation::updateFitness() { 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 double getMinFitness() const { return dMinFitness; } double getMaxFitness() const { return dMaxFitness; } + Genetic::PhenotypeId getMaxFitnessId() const; + Genetic::Phenotype *getMaxFitnessPhenotype() const; double getFitness( Genetic::PhenotypeId id ) const { return hFitness.get( id ); } 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 int getSize() const { return hPhenotype.getSize(); } PhenotypeId addPhenotype( Phenotype *pNew ); - Phenotype *getPhenotype( PhenotypeId id ) + Phenotype *getPhenotype( PhenotypeId id ) const { return hPhenotype.get( id ); } bool hasProperty( PhenotypeId id, const Bu::String &sKey ) const; Bu::Variant getProperty( PhenotypeId id, const Bu::String &sKey ) const; -- cgit v1.2.3