COPASI API  4.16.103
COptMethodEP.h
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/optimization/COptMethodEP.h,v $
3  $Revision: 1.9 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2011/03/07 19:31:25 $
7  End CVS Header */
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc. and EML Research, gGmbH.
16 // All rights reserved.
17 
18 #ifndef COPASI_COptMethodEP
19 #define COPASI_COptMethodEP
20 
22 
23 #include "utilities/CVector.h"
24 
25 class CRandom;
26 
27 class COptMethodEP: public COptMethod
28 {
30 
31  // Operations
32 private:
33 
34  /**
35  * Default Constructor
36  */
37  COptMethodEP(const CCopasiContainer * pParent = NULL);
38 
39  /**
40  * Initialize arrays and pointer.
41  * @return bool success
42  */
43  virtual bool initialize();
44 
45  /**
46  * Cleanup arrays and pointers.
47  * @return bool success
48  */
49  virtual bool cleanup();
50 
51  /**
52  * Evaluate the objective function for the current parameters
53  * @return const C_FLOAT64 & objectiveValue
54  */
55  bool evaluate(const CVector< C_FLOAT64 > & individual);
56 
57  /**
58  * Initialize contained objects.
59  */
60  void initObjects();
61 
62  /**
63  * Mutate one individual
64  * @param CVector< C_FLOAT64 > & individual
65  * @return bool success
66  */
67  bool mutate(size_t i);
68 
69  /**
70  * Swap individuals from and to
71  * @param size_t from
72  * @param size_t to
73  * @return bool success
74  */
75  bool swap(size_t from, size_t to);
76 
77  /**
78  * Replicate the individuals with crossover
79  * @return bool continue
80  */
81  bool replicate();
82 
83  /**
84  * Select surviving population
85  * @return bool success
86  */
87  bool select();
88 
89  /**
90  * Find the best individual at this generation
91  * @return size_t fittest
92  */
93  size_t fittest();
94 
95  /**
96  * Initialise the population
97  * @param size_t first
98  * @param size_t last (default: population size)
99  * @return bool continue
100  */
101  bool creation();
102 
103 public:
104  /**
105  * Copy Constructor
106  * @param const COptMethodEP & src
107  */
108  COptMethodEP(const COptMethodEP& src,
109  const CCopasiContainer * pParent = NULL);
110 
111  /**
112  * Destructor
113  */
114  virtual ~COptMethodEP();
115 
116  /**
117  * Execute the optimization algorithm calling simulation routine
118  * when needed. It is noted that this procedure can give feedback
119  * of its progress by the callback function set with SetCallback.
120  */
121  virtual bool optimise();
122 
123 private :
124  // variables
125 
126  /**
127  * number of generations
128  */
130 
131  /**
132  * size of the population
133  */
135 
136  /**
137  * Handle to the process report item "Current Generation"
138  */
140 
141  /**
142  * size of the population
143  */
145 
146  /**
147  * a pointer to the randomnumber generator.
148  */
150 
151  size_t mBestIndex;
152 
153  double tau1; // parameter for updating variances
154 
155  double tau2; // parameter for updating variances
156 
157  /**
158  * number of wins of each individual in the tournament
159  */
161 
162  /**
163  * The best value found so far.
164  */
166 
167  /**
168  * The value of the last evaluation.
169  */
171 
172  /**
173  * array of values of objective function f/ individuals
174  */
176 
177  /**
178  * number of parameters
179  */
181 
182  /**
183  * for array of individuals w/ candidate values for the parameters
184  */
185  std::vector< CVector < C_FLOAT64 > * > mIndividual;
186 
187  /**
188  * for array of variances w/ variance values for the parameters
189  */
190  std::vector< CVector < C_FLOAT64 > * > mVariance;
191 
192  /**
193  * The current iteration
194  */
196 
197  /**
198  * Pivot vector used for sorting
199  */
201 };
202 
203 #endif // COPASI_COptMethodEP
size_t fittest()
C_FLOAT64 mEvaluationValue
Definition: COptMethodEP.h:170
size_t mVariableSize
Definition: COptMethodEP.h:180
static COptMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::RandomSearch)
Definition: COptMethod.cpp:50
unsigned C_INT32 mPopulationSize
Definition: COptMethodEP.h:144
CRandom * mpRandom
Definition: COptMethodEP.h:149
virtual bool cleanup()
size_t mhGenerations
Definition: COptMethodEP.h:139
virtual bool optimise()
#define C_INT32
Definition: copasi.h:90
CVector< size_t > mPivot
Definition: COptMethodEP.h:200
virtual bool initialize()
CVector< size_t > mLosses
Definition: COptMethodEP.h:160
bool swap(size_t from, size_t to)
bool evaluate(const CVector< C_FLOAT64 > &individual)
virtual ~COptMethodEP()
COptMethodEP(const CCopasiContainer *pParent=NULL)
unsigned C_INT32 mCurrentIteration
Definition: COptMethodEP.h:195
bool mutate(size_t i)
std::vector< CVector< C_FLOAT64 > * > mVariance
Definition: COptMethodEP.h:190
#define C_FLOAT64
Definition: copasi.h:92
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodEP.h:185
C_FLOAT64 mBestValue
Definition: COptMethodEP.h:165
void initObjects()
size_t mBestIndex
Definition: COptMethodEP.h:151
unsigned C_INT32 mGeneration
Definition: COptMethodEP.h:134
CVector< C_FLOAT64 > mValue
Definition: COptMethodEP.h:175
unsigned C_INT32 mGenerations
Definition: COptMethodEP.h:129