1 /* 2 * cPhenPlastGenotype.h 3 * Avida 4 * 5 * Created by Matthew Rupp on 7/27/07. 6 * Copyright 1999-2011 Michigan State University. All rights reserved. 7 * 8 * 9 * This file is part of Avida. 10 * 11 * Avida is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License 12 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 13 * 14 * Avida is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License along with Avida. 18 * If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 22 23 #ifndef cPhenPlastGenotype_h 24 #define cPhenPlastGenotype_h 25 26 #include "avida/core/Genome.h" 27 #include "avida/core/WorldDriver.h" 28 29 #include "cCPUMemory.h" 30 #include "cString.h" 31 #include "cStringList.h" 32 #include "cStringUtil.h" 33 #include "tArray.h" 34 #include "cPlasticPhenotype.h" 35 #include "cPhenotype.h" 36 #include "cHardwareManager.h" 37 #include "cWorld.h" 38 #include "cEnvironment.h" 39 40 #include <set> 41 #include <utility> 42 43 class cAvidaContext; 44 class cTestCPU; 45 class cWorld; 46 class cEnvironment; 47 48 using namespace Avida; 49 50 51 class cPhenPlastGenotype 52 { 53 private: 54 55 typedef set<cPhenotype*, cPhenotype::PhenotypeCompare > UniquePhenotypes; //Actually, these are cPlasticPhenotypes* 56 tList<cPlasticPhenotype> m_plastic_phenotypes; //This will store a list of our unique plastic phenotype pointers 57 Genome m_genome; 58 59 int m_num_trials; 60 UniquePhenotypes m_unique; 61 cWorld* m_world; 62 63 double m_max_fitness; 64 double m_avg_fitness; 65 double m_likely_fitness; 66 double m_phenotypic_entropy; 67 double m_max_freq; 68 double m_max_fit_freq; 69 double m_min_fit_freq; 70 double m_min_fitness; 71 double m_viable_probability; 72 tArray<double> m_task_probabilities; 73 74 75 76 void Process(cCPUTestInfo& test_info, cWorld* world, cAvidaContext& ctx); 77 78 public: 79 cPhenPlastGenotype(const Genome& in_genome, int num_trails, cCPUTestInfo& test_info, cWorld* world, cAvidaContext& ctx); 80 ~cPhenPlastGenotype(); 81 82 // Accessors GetNumPhenotypes()83 int GetNumPhenotypes() const { return m_unique.size(); } GetNumTrials()84 int GetNumTrials() const { return m_num_trials; } GetMaximumFitness()85 double GetMaximumFitness() const { return m_max_fitness; } GetMinimumFitness()86 double GetMinimumFitness() const { return m_min_fitness; } GetAverageFitness()87 double GetAverageFitness() const { return m_avg_fitness; } GetLikelyFitness()88 double GetLikelyFitness() const { return m_likely_fitness; } GetPhenotypicEntropy()89 double GetPhenotypicEntropy() const { return m_phenotypic_entropy; } GetMaximumFrequency()90 double GetMaximumFrequency() const { return m_max_freq; } GetMaximumFitnessFrequency()91 double GetMaximumFitnessFrequency() const {return m_max_fit_freq;} GetMinimumFitnessFrequency()92 double GetMinimumFitnessFrequency() const {return m_min_fit_freq;} 93 const cPlasticPhenotype* GetPlasticPhenotype(int num) const; 94 const cPlasticPhenotype* GetMostLikelyPhenotype() const; 95 const cPlasticPhenotype* GetHighestFitnessPhenotype() const; GetTaskProbabilities()96 tArray<double> GetTaskProbabilities() const { return m_task_probabilities; } GetViableProbability()97 double GetViableProbability() const { return m_viable_probability; } 98 }; 99 100 #endif 101 102