summaryrefslogtreecommitdiff
path: root/src/population.h
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2012-07-09 12:01:50 -0600
committerMike Buland <mike@xagasoft.com>2012-07-09 12:01:50 -0600
commit1f7c135934b6604c5409d4b6f34861105c0a64cb (patch)
treecc421e2e8620b72e202f0eddf2cd5f1478d3bc06 /src/population.h
parent40ee7ad5aeadeb9823e1cd6e1218a1999c608a65 (diff)
downloadlibgenetic-1f7c135934b6604c5409d4b6f34861105c0a64cb.tar.gz
libgenetic-1f7c135934b6604c5409d4b6f34861105c0a64cb.tar.bz2
libgenetic-1f7c135934b6604c5409d4b6f34861105c0a64cb.tar.xz
libgenetic-1f7c135934b6604c5409d4b6f34861105c0a64cb.zip
It works well enough to solve polynomial maxima.
Diffstat (limited to 'src/population.h')
-rw-r--r--src/population.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/population.h b/src/population.h
index 0fdad32..c2d1bec 100644
--- a/src/population.h
+++ b/src/population.h
@@ -1,13 +1,49 @@
1#ifndef GENETIC_POPULATION_H 1#ifndef GENETIC_POPULATION_H
2#define GENETIC_POPULATION_H 2#define GENETIC_POPULATION_H
3 3
4#include <bu/string.h>
5#include <bu/hash.h>
6#include <bu/mutex.h>
7
8#include "genetic/config.h"
9
4namespace Genetic 10namespace Genetic
5{ 11{
12 class Phenotype;
13
6 class Population 14 class Population
7 { 15 {
8 public: 16 public:
9 Population(); 17 Population();
10 virtual ~Population(); 18 virtual ~Population();
19
20 typedef Bu::Hash<PhenotypeId, Phenotype *> PhenotypeHash;
21 typedef PhenotypeHash::iterator iterator;
22 typedef PhenotypeHash::const_iterator const_iterator;
23
24 iterator begin() { return hPhenotype.begin(); }
25 const_iterator begin() const { return hPhenotype.begin(); }
26 int getSize() const { return hPhenotype.getSize(); }
27
28 PhenotypeId addPhenotype( Phenotype *pNew );
29 Phenotype *getPhenotype( PhenotypeId id )
30 { return hPhenotype.get( id ); }
31 bool hasProperty( PhenotypeId id, const Bu::String &sKey ) const;
32 Bu::Variant getProperty( PhenotypeId id, const Bu::String &sKey ) const;
33 void setProperty( PhenotypeId id, const Bu::String &sKey,
34 Bu::Variant vValue );
35 void delPhenotype( PhenotypeId id );
36 Phenotype *takePhenotype( PhenotypeId id );
37 void clear();
38
39 PhenotypeId timestep();
40 PhenotypeId time() const;
41
42 private:
43 PhenotypeId uNextId;
44 PhenotypeId uTime;
45 PhenotypeHash hPhenotype;
46 mutable Bu::Mutex mGeneral;
11 }; 47 };
12}; 48};
13 49