ECF 1.5
IntGenotype.h
1#include <ecf/ECF.h>
2#include <ecf/ECF_base.h>
3#include <cmath>
4#include <sstream>
5
6#include "IntGenotypeCrxOp.h"
7#include "IntGenotypeMutOp.h"
8
9#pragma once
10
11namespace IntGenotype
12{
13 class IntGenotype : public Genotype
14 {
15 public:
16 int minValue_, maxValue_;
17 uint nSize_;
18 std::vector<int> intValues;
19
21 {
22 name_ = "IntGenotype";
23 }
24
26 {
27 IntGenotype *newObject = new IntGenotype(*this);
28 return newObject;
29 }
30
32 double getLBound()
33 {
34 return minValue_;
35 }
36
38 double getUBound()
39 {
40 return maxValue_;
41 }
42 std::vector<CrossoverOpP> getCrossoverOp()
43 {
44 std::vector<CrossoverOpP> crx;
45 crx.push_back(static_cast<CrossoverOpP> (new IntGenotypeCrxOp));
46 return crx;
47 }
48
49 std::vector<MutationOpP> getMutationOp()
50 {
51 std::vector<MutationOpP> mut;
52 mut.push_back(static_cast<MutationOpP> (new IntGenotypeMutOp));
53 return mut;
54 }
55
56 void registerParameters(StateP state);
57
58 bool initialize(StateP state);
59
60 void write(XMLNode &xIntGenotype);
61
62 // mandatory if running parallel ECF or reading population from a milestone file
63 void read(XMLNode& xIntGenotype);
64 };
65}
66
67typedef boost::shared_ptr<IntGenotype::IntGenotype> IntGenotypeP;
Genotype base class.
Definition: Genotype.h:36
double getLBound()
return lower bound of the defined interval
Definition: IntGenotype.h:32
std::vector< MutationOpP > getMutationOp()
Create and return a vector of mutation operators.
Definition: IntGenotype.h:49
IntGenotype * copy()
Create an identical copy of the genotype object.
Definition: IntGenotype.h:25
double getUBound()
return upper bound of the defined interval
Definition: IntGenotype.h:38
std::vector< CrossoverOpP > getCrossoverOp()
Create and return a vector of crossover operators.
Definition: IntGenotype.h:42