COPASI API  4.16.103
COptMethodDE.h
Go to the documentation of this file.
1 // Copyright (C) 2012 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 /**
7  * COptMethodDE class
8  */
9 
10 #ifndef COPASI_COptMethodDE
11 #define COPASI_COptMethodDE
12 #include <limits>
13 
15 #include "utilities/CVector.h"
16 
17 class CRandom;
18 class CPermutation;
19 
20 class COptMethodDE : public COptMethod
21 {
23 
24  // Operations
25 public:
26  /**
27  * Copy Constructor
28  * @param const COptMethodDE & src
29  * @param const CCopasiContainer * pParent (default: NULL)
30  */
31  COptMethodDE(const COptMethodDE & src,
32  const CCopasiContainer * pParent = NULL);
33 
34  /**
35  * Destructor
36  */
37  virtual ~COptMethodDE();
38 
39  /**
40  * Execute the optimization algorithm calling simulation routine
41  * when needed. It is noted that this procedure can give feedback
42  * of its progress by the callback function set with SetCallback.
43  * @ return success;
44  */
45  virtual bool optimise();
46 
47 private:
48  /**
49  * Default Constructor
50  * @param const CCopasiContainer * pParent (default: NULL)
51  */
52  COptMethodDE(const CCopasiContainer * pParent = NULL);
53 
54  /**
55  * Initialize contained objects.
56  */
57  void initObjects();
58 
59  /**
60  * Initialize arrays and pointer.
61  * @return bool success
62  */
63  virtual bool initialize();
64 
65  /**
66  * Cleanup arrays and pointers.
67  * @return bool success
68  */
69  virtual bool cleanup();
70 
71  /**
72  * Evaluate the fitness of one individual
73  * @param const CVector< C_FLOAT64 > & individual
74  * @return bool continue
75  */
76  bool evaluate(const CVector< C_FLOAT64 > & individual);
77 
78  /**
79  * Replicate the individuals with crossover
80  * @return bool continue
81  */
82  bool replicate();
83 
84  /**
85  * Find the best individual at this generation
86  * @return size_t fittest
87  */
88  size_t fittest();
89 
90  void boost();
91  /**
92  * Initialise the population
93  * @param size_t first
94  * @param size_t last (default: population size)
95  * @return bool continue
96  */
97  bool creation(size_t first, size_t last = std::numeric_limits<size_t>::max());
98 
99  // Attributes
100 private:
101  /**
102  * number of generations
103  */
105 
106  /**
107  * Handle to the process report item "Current Generation"
108  */
110 
111  /**
112  * size of the population
113  */
115 
116  /**
117  * a pointer to the randomnumber generator.
118  */
120 
121  /**
122  * number of parameters
123  */
125 
126  /**
127  * for array of individuals w/ candidate values for the parameters
128  */
129  std::vector< CVector < C_FLOAT64 > * > mIndividual;
130 
131  /**
132  * A permutation of integers used to for replication;
133  */
135 
136  /**
137  * The value of the last evaluation.
138  */
140 
141  /**
142  * array of values of objective function f/ individuals
143  */
145 
146  /**
147  * variance for mutations
148  */
150 
152  size_t mBestIndex;
154 };
155 
156 #endif // COPASI_COptMethodDE
virtual bool optimise()
virtual bool cleanup()
unsigned C_INT32 mPopulationSize
Definition: COptMethodDE.h:114
CPermutation * mpPermutation
Definition: COptMethodDE.h:134
static COptMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::RandomSearch)
Definition: COptMethod.cpp:50
size_t mBestIndex
Definition: COptMethodDE.h:152
C_FLOAT64 mBestValue
Definition: COptMethodDE.h:151
bool evaluate(const CVector< C_FLOAT64 > &individual)
bool creation(size_t first, size_t last=std::numeric_limits< size_t >::max())
virtual ~COptMethodDE()
#define C_INT32
Definition: copasi.h:90
size_t mVariableSize
Definition: COptMethodDE.h:124
unsigned C_INT32 mGenerations
Definition: COptMethodDE.h:104
size_t mhGenerations
Definition: COptMethodDE.h:109
bool replicate()
C_FLOAT64 mEvaluationValue
Definition: COptMethodDE.h:139
virtual bool initialize()
void initObjects()
#define C_FLOAT64
Definition: copasi.h:92
CRandom * mpRandom
Definition: COptMethodDE.h:119
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodDE.h:129
C_FLOAT64 mMutationVarians
Definition: COptMethodDE.h:149
unsigned C_INT32 mGeneration
Definition: COptMethodDE.h:153
COptMethodDE(const COptMethodDE &src, const CCopasiContainer *pParent=NULL)
size_t fittest()
CVector< C_FLOAT64 > mValue
Definition: COptMethodDE.h:144
#define max(a, b)
Definition: f2c.h:176