COPASI API  4.16.103
COptMethodSRES.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 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 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2006 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include <cmath>
16 
17 #include "copasi.h"
18 
19 #include "COptMethodSRES.h"
20 #include "COptProblem.h"
21 #include "COptItem.h"
22 #include "COptTask.h"
23 
26 #include "utilities/CSort.h"
28 
29 #ifdef RANDOMIZE
30 # undef RANDOMIZE
31 #endif
32 
33 #define childrate 7
34 
36  COptMethod(CCopasiTask::optimization, CCopasiMethod::SRES, pParent),
37  mGenerations(0),
38  mPopulationSize(0),
39  mpRandom(NULL),
40  mVariableSize(0),
41  mIndividual(0),
42  mEvaluationValue(std::numeric_limits< C_FLOAT64 >::max()),
43  mValue(0),
44  mBestValue(std::numeric_limits< C_FLOAT64 >::max()),
45  mGeneration(0)
46 
47 {
48  addParameter("Number of Generations", CCopasiParameter::UINT, (unsigned C_INT32) 200);
49  addParameter("Population Size", CCopasiParameter::UINT, (unsigned C_INT32) 20);
50  addParameter("Random Number Generator", CCopasiParameter::UINT, (unsigned C_INT32) CRandom::mt19937);
51  addParameter("Seed", CCopasiParameter::UINT, (unsigned C_INT32) 0);
52  addParameter("Pf", CCopasiParameter::DOUBLE, (C_FLOAT64) 0.475); //*****ADDED for SR
53 
54  initObjects();
55 }
56 
58  const CCopasiContainer * pParent):
59  COptMethod(src, pParent),
60  mGenerations(0),
61  mPopulationSize(0),
62  mpRandom(NULL),
63  mVariableSize(0),
64  mIndividual(0),
65  mEvaluationValue(std::numeric_limits< C_FLOAT64 >::max()),
66  mValue(0),
67  mBestValue(std::numeric_limits< C_FLOAT64 >::max()),
68  mGeneration(0)
69 {initObjects();}
70 
72 {cleanup();}
73 
74 // evaluate the fitness of one individual
75 bool COptMethodSRES::evaluate(const CVector< C_FLOAT64 > & /* individual */)
76 {
77  bool Continue = true;
78 
79  // We do not need to check whether the parametric constraints are fulfilled
80  // since this method allows for parameters outside the bounds
81 
82  // evaluate the fitness
83  Continue = mpOptProblem->calculate();
84 
85  // We do not need to check whether the functional constraints are fulfilled
86  // since this method allows for solutions outside the bounds.
87 
89 
90  return Continue;
91 }
92 
93 bool COptMethodSRES::swap(size_t from, size_t to)
94 {
95  CVector< C_FLOAT64 > * pTmp = mIndividual[to];
96  mIndividual[to] = mIndividual[from];
97  mIndividual[from] = pTmp;
98 
99  pTmp = mVariance[to];
100  mVariance[to] = mVariance[from];
101  mVariance[from] = pTmp;
102 
103  C_FLOAT64 dTmp = mValue[to];
104  mValue[to] = mValue[from];
105  mValue[from] = dTmp;
106 
107  dTmp = mPhi[to];
108  mPhi[to] = mPhi[from];
109  mPhi[from] = dTmp;
110 
111  return true;
112 }
113 
115 {
116  bool Continue = true;
117 
118  size_t Parent;
119  size_t i, j;
120 
121  std::vector< CVector < C_FLOAT64 > * >::iterator itSrc = mIndividual.begin();
122  std::vector< CVector < C_FLOAT64 > * >::iterator endSrc = itSrc + mPopulationSize;
123  std::vector< CVector < C_FLOAT64 > * >::iterator itTarget = endSrc;
124 
125  std::vector< CVector < C_FLOAT64 > * >::iterator itSrcVariance = mVariance.begin();
126  std::vector< CVector < C_FLOAT64 > * >::iterator itTargetVariance = itSrcVariance + mPopulationSize;
127 
128  C_FLOAT64 * pVariance, * pVarianceEnd, * pParentVariance;
129 
130  // iterate over parents
131  for (i = 0; itSrc != endSrc && Continue; ++itSrc, ++itSrcVariance, ++i)
132  {
133  // iterate over the child rate - 1 since the first child is the
134  // parent.
135  for (j = 1; j < childrate; ++j, ++itTarget, ++itTargetVariance)
136  {
137  // first just copy the individuals
138  **itTarget = **itSrc;
139  **itTargetVariance = **itSrcVariance;
140 
141  // do recombination on the sigma
142  // since sigmas already have one parent's component
143  // need only average with the sigmas of the other parent
144  Parent = (i + mpRandom->getRandomU(mPopulationSize - 1)) % mPopulationSize;
145 
146  pVariance = (*itTargetVariance)->array();
147  pVarianceEnd = pVariance + mVariableSize;
148  pParentVariance = mVariance[Parent]->array();
149 
150  for (; pVariance != pVarianceEnd; ++pVariance, ++pParentVariance)
151  *pVariance = (*pVariance + *pParentVariance) * .5;
152  }
153  }
154 
155  Continue &= mutate();
156 
157  return Continue;
158 }
159 
160 //mutate one individual
162 {
163  std::vector< CVector < C_FLOAT64 > * >::iterator it = mIndividual.begin() + mPopulationSize;
164  std::vector< CVector < C_FLOAT64 > * >::iterator end = mIndividual.end();
165  std::vector< CVector < C_FLOAT64 > * >::iterator itVariance = mVariance.begin() + mPopulationSize;
166 
167  C_FLOAT64 * pVariable, * pVariableEnd, * pVariance, * pMaxVariance;
168  C_FLOAT64 * pPhi = mPhi.array() + mPopulationSize;
169  C_FLOAT64 * pValue = mValue.array() + mPopulationSize;
170 
171  bool Continue = true;
172  size_t i, j;
173  C_FLOAT64 v1;
174 
175  // Mutate each new individual
176  for (i = mPopulationSize; it != end && Continue; ++it, ++itVariance, ++i)
177  {
178  pVariable = (*it)->array();
179  pVariableEnd = pVariable + mVariableSize;
180  pVariance = (*itVariance)->array();
181  pMaxVariance = mMaxVariance.array();
182 
183  v1 = mpRandom->getRandomNormal01();
184 
185  for (j = 0; pVariable != pVariableEnd; ++pVariable, ++pVariance, ++pMaxVariance, ++j)
186  {
187  C_FLOAT64 & mut = *pVariable;
188  C_FLOAT64 Store = mut;
189 
190  COptItem & OptItem = *(*mpOptItem)[j];
191 
192  size_t l = C_INVALID_INDEX;
193 
194  try
195  {
196  // update the parameter for the variances
197  *pVariance =
198  std::min(*pVariance * exp(mTauPrime * v1 + mTau * mpRandom->getRandomNormal01()), *pMaxVariance);
199 
200  for (l = 0; l < 10; l++)
201  {
202  // calculate the mutated parameter
203  mut = Store + *pVariance * mpRandom->getRandomNormal01();
204 
205  if (OptItem.checkConstraint(mut) == 0)
206  break;
207  }
208  }
209 
210  catch (...)
211  {
212  mut = (*OptItem.getUpperBoundValue() + *OptItem.getLowerBoundValue()) * 0.5;
213  }
214 
215  if (l == 10)
216  mut = Store;
217 
218  // We need to set the value here so that further checks take
219  // account of the value.
220  (*(*mpSetCalculateVariable)[j])(mut);
221  }
222 
223  // calculate its fitness
224  Continue = evaluate(**it);
225  *pValue++ = mEvaluationValue;
226  *pPhi++ = phi(i);
227  }
228 
229  return Continue;
230 }
231 
232 // select mPopulationSize individuals
234 {
235  size_t i, j;
236  size_t TotalPopulation = mIndividual.size();
237  bool wasSwapped;
238  size_t sweepNum = TotalPopulation; // This is default based on paper
239 
240  // Selection Method for Stochastic Ranking
241  // stochastic ranking "bubble sort"
242 
243  for (i = 0; i < sweepNum; i++) // Here sweepNum is optimal number of sweeps from paper
244  {
245  wasSwapped = false;
246 
247  // :TODO: since we are only interested in mPopulationSize highest ranked
248  // individuals the upper limit of the loop can be improved.
249  for (j = 0; j < TotalPopulation - 1; j++) // lambda is number of individuals
250  {
251  if ((mPhi[j] == 0 && mPhi[j + 1] == 0) || // within bounds
252  (mpRandom->getRandomOO() < mPf)) // random chance to compare values outside bounds
253  {
254  // compare obj fcn using mValue alternative code
255  if (mValue[j] > mValue[j + 1])
256  {
257  swap(j, j + 1);
258  wasSwapped = true;
259  }
260  }
261  else
262  {
263  if (mPhi[j] > mPhi[j + 1]) // j further outside then j+1
264  {
265  swap(j, j + 1);
266  wasSwapped = true;
267  }
268  }
269  }
270 
271  // if nothing was swapped, then they're ordered!
272  if (wasSwapped == false) break;
273  }
274 }
275 
276 // check the best individual at this generation
278 {
279  size_t i, BestIndex = C_INVALID_INDEX;
281 
282  for (i = 0; i < mPopulationSize; i++)
283  if (mValue[i] < BestValue && mPhi[i] == 0)
284  {
285  BestIndex = i;
286  BestValue = mValue[i];
287  }
288 
289  return BestIndex;
290 }
291 
292 // Initialize the population
293 bool COptMethodSRES::creation(size_t first)
294 {
295  size_t i;
296  size_t j;
297 
298  C_FLOAT64 mn;
299  C_FLOAT64 mx;
300  C_FLOAT64 la;
301 
302  bool Continue = true;
303 
304  std::vector< CVector < C_FLOAT64 > * >::iterator it =
305  mIndividual.begin() + first;
306  std::vector< CVector < C_FLOAT64 > * >::iterator end =
307  mIndividual.begin() + mPopulationSize;
308  std::vector< CVector < C_FLOAT64 > * >::iterator itVariance =
309  mVariance.begin() + first;
310 
311  C_FLOAT64 * pVariable, * pVariableEnd, * pVariance, * pMaxVariance;
312  C_FLOAT64 * pPhi = mPhi.array() + first;
313  C_FLOAT64 * pValue = mValue.array() + first;
314 
315  // set the first individual to the initial guess
316  if (it == mIndividual.begin())
317  {
318  pVariable = (*it)->array();
319  pVariableEnd = pVariable + mVariableSize;
320  pVariance = (*itVariance)->array();
321  pMaxVariance = mMaxVariance.array();
322 
323  for (j = 0; pVariable != pVariableEnd; ++pVariable, ++pVariance, ++pMaxVariance, ++j)
324  {
325  C_FLOAT64 & mut = *pVariable;
326  COptItem & OptItem = *(*mpOptItem)[j];
327 
328  mut = OptItem.getStartValue();
329 
330  // force it to be within the bounds
331  switch (OptItem.checkConstraint(mut))
332  {
333  case - 1:
334  mut = *OptItem.getLowerBoundValue();
335 
336  if (!OptItem.checkLowerBound(mut)) // Inequality
337  {
338  if (mut == 0.0)
340  else
341  mut += mut * std::numeric_limits< C_FLOAT64 >::epsilon();
342  }
343 
344  break;
345 
346  case 1:
347  mut = *OptItem.getUpperBoundValue();
348 
349  if (!OptItem.checkUpperBound(mut)) // Inequality
350  {
351  if (mut == 0.0)
353  else
354  mut -= mut * std::numeric_limits< C_FLOAT64 >::epsilon();
355  }
356 
357  break;
358  }
359 
360  // We need to set the value here so that further checks take
361  // account of the value.
362  (*(*mpSetCalculateVariable)[j])(mut);
363 
364  // Set the variance for this parameter.
365  *pVariance = std::min(*OptItem.getUpperBoundValue() - mut, mut - *OptItem.getLowerBoundValue()) / sqrt(double(mVariableSize));
366  }
367 
368  Continue = evaluate(**it);
369  *pValue++ = mEvaluationValue;
370  *pPhi++ = phi(0);
371 
372  ++it;
373  ++itVariance;
374  ++first;
375  }
376 
377  for (i = first; it < end ; ++it, ++itVariance, ++i)
378  {
379  pVariable = (*it)->array();
380  pVariableEnd = pVariable + mVariableSize;
381  pVariance = (*itVariance)->array();
382  pMaxVariance = mMaxVariance.array();
383 
384  for (j = 0; pVariable != pVariableEnd; ++pVariable, ++pVariance, ++pMaxVariance, ++j)
385  {
386  C_FLOAT64 & mut = *pVariable;
387  COptItem & OptItem = *(*mpOptItem)[j];
388 
389  // calculate lower and upper bounds
390  mn = *OptItem.getLowerBoundValue();
391  mx = *OptItem.getUpperBoundValue();
392 
393  try
394  {
395  // First determine the location of the intervall
396  // Secondly determine whether to distribute the parameter linearly or not
397  // depending on the location and act uppon it.
398  if (0.0 <= mn) // the interval [mn, mx) is in [0, inf)
399  {
400  la = log10(mx) - log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min()));
401 
402  if (la < 1.8 || !(mn > 0.0)) // linear
403  mut = mn + mpRandom->getRandomCC() * (mx - mn);
404  else
405  mut = pow(10.0, log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min())) + la * mpRandom->getRandomCC());
406  }
407  else if (mx > 0) // 0 is in the interval (mn, mx)
408  {
409  la = log10(mx) + log10(-mn);
410 
411  if (la < 3.6) // linear
412  mut = mn + mpRandom->getRandomCC() * (mx - mn);
413  else
414  {
415  C_FLOAT64 mean = (mx + mn) * 0.5;
416  C_FLOAT64 sigma = mean * 0.01;
417 
418  do
419  {
420  mut = mpRandom->getRandomNormal(mean, sigma);
421  }
422  while ((mut < mn) || (mut > mx));
423  }
424  }
425  else // the interval (mn, mx] is in (-inf, 0]
426  {
427  // Switch lower and upper bound and change sign, i.e.,
428  // we can treat it similarly as location 1:
429  mx = - *OptItem.getLowerBoundValue();
430  mn = - *OptItem.getUpperBoundValue();
431 
432  la = log10(mx) - log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min()));
433 
434  if (la < 1.8 || !(mn > 0.0)) // linear
435  mut = - (mn + mpRandom->getRandomCC() * (mx - mn));
436  else
437  mut = - pow(10.0, log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min())) + la * mpRandom->getRandomCC());
438  }
439  }
440 
441  catch (...)
442  {
443  mut = (mx + mn) * 0.5;
444  }
445 
446  // force it to be within the bounds
447  switch (OptItem.checkConstraint(mut))
448  {
449  case - 1:
450  mut = *OptItem.getLowerBoundValue();
451 
452  if (!OptItem.checkLowerBound(mut)) // Inequality
453  {
454  if (mut == 0.0)
456  else
457  mut += mut * std::numeric_limits< C_FLOAT64 >::epsilon();
458  }
459 
460  break;
461 
462  case 1:
463  mut = *OptItem.getUpperBoundValue();
464 
465  if (!OptItem.checkUpperBound(mut)) // Inequality
466  {
467  if (mut == 0.0)
469  else
470  mut -= mut * std::numeric_limits< C_FLOAT64 >::epsilon();
471  }
472 
473  break;
474  }
475 
476  // We need to set the value here so that further checks take
477  // account of the value.
478  (*(*mpSetCalculateVariable)[j])(mut);
479 
480  // Set the variance for this parameter.
481  *pVariance = std::min(*OptItem.getUpperBoundValue() - mut, mut - *OptItem.getLowerBoundValue()) / sqrt(double(mVariableSize));
482  }
483 
484  // calculate its fitness
485  Continue = evaluate(**it);
486  *pValue++ = mEvaluationValue;
487  *pPhi++ = phi(i);
488  }
489 
490  return Continue;
491 }
492 
494 {
496 }
497 
499 {
500  cleanup();
501 
502  size_t i;
503 
504  if (!COptMethod::initialize()) return false;
505 
506  mGenerations = * getValue("Number of Generations").pUINT;
507  mGeneration = 0;
508 
509  if (mpCallBack)
510  mhGenerations =
511  mpCallBack->addItem("Current Generation",
512  mGeneration,
513  & mGenerations);
514 
515  mGeneration++;
516 
517  mPopulationSize = * getValue("Population Size").pUINT;
518 
519  mPf = *(C_FLOAT64*) getValue("Pf").pDOUBLE;
520 
521  if (mPf < 0.0 || 1.0 < mPf)
522  {
523  mPf = 0.475;
524  setValue("Pf", mPf);
525  }
526 
527  mpRandom =
528  CRandom::createGenerator(* (CRandom::Type *) getValue("Random Number Generator").pUINT,
529  * getValue("Seed").pUINT);
530 
531  mVariableSize = mpOptItem->size();
532 
534 
535  for (i = 0; i < childrate * mPopulationSize; i++)
537 
538  mVariance.resize(childrate * mPopulationSize);
539 
540  for (i = 0; i < childrate * mPopulationSize; i++)
542 
544 
545  for (i = 0; i < mVariableSize; i++)
546  {
547  COptItem & OptItem = *(*mpOptItem)[i];
548 
549  try
550  {
551  mMaxVariance[i] =
552  (*OptItem.getUpperBoundValue() - *OptItem.getLowerBoundValue()) / sqrt(double(mVariableSize));
553  }
554  catch (...)
555  {
556  mMaxVariance[i] = 1.0e3;
557  }
558  }
559 
560  mValue.resize(childrate * mPopulationSize);
561  mValue = std::numeric_limits<C_FLOAT64>::infinity();
562  mBestValue = std::numeric_limits<C_FLOAT64>::infinity();
563 
564  mPhi.resize(childrate * mPopulationSize);
565 
566  try
567  {
568  /*
569  C_FLOAT64 alpha = 0.2;
570  C_FLOAT64 chi = 1 / (2 * sqrt(double(mVariableSize))) + 1 / (2 * double(mVariableSize));
571  C_FLOAT64 varphi = sqrt(2/chi * log(1/alpha) *exp(chi/2 -(1-alpha)));
572  */
573 
574  C_FLOAT64 varphi = 1;
575  mTau = varphi / sqrt(2 * sqrt(double(mVariableSize)));
576  mTauPrime = varphi / sqrt(2 * double(mVariableSize));
577  }
578  catch (...)
579  {
580  mTau = mTauPrime = 1;
581  }
582 
583  return true;
584 }
585 
587 {
588  size_t i;
589 
590  pdelete(mpRandom);
591 
592  for (i = 0; i < mIndividual.size(); i++)
593  {
594  pdelete(mIndividual[i]);
595  pdelete(mVariance[i]);
596  }
597 
598  return true;
599 }
600 
601 // evaluate the distance of parameters and constraints to boundaries
603 {
604  C_FLOAT64 phiVal = 0.0;
605  C_FLOAT64 phiCalc;
606 
607  std::vector< COptItem * >::const_iterator it = mpOptItem->begin();
608  std::vector< COptItem * >::const_iterator end = mpOptItem->end();
609  C_FLOAT64 * pValue = mIndividual[indivNum]->array();
610 
611  for (; it != end; ++it, pValue++)
612  {
613  switch ((*it)->checkConstraint())
614  {
615  case - 1:
616  phiCalc = *(*it)->getLowerBoundValue() - *pValue;
617  phiVal += phiCalc * phiCalc;
618  break;
619 
620  case 1:
621  phiCalc = *pValue - *(*it)->getUpperBoundValue();
622  phiVal += phiCalc * phiCalc;
623  break;
624  }
625  }
626 
627  it = mpOptContraints->begin();
628  end = mpOptContraints->end();
629 
630  for (; it != end; ++it)
631  {
632  phiCalc = (*it)->getConstraintViolation();
633 
634  if (phiCalc > 0.0)
635  phiVal += phiCalc * phiCalc;
636  }
637 
638  return phiVal;
639 }
640 
642 {
643  bool Continue = true;
644  size_t BestIndex = C_INVALID_INDEX;
645 
646 #ifdef RANDOMIZE
647  // Counters to determine whether the optimization process has stalled
648  // They count the number of generations without advances.
649  size_t Stalled10, Stalled20, Stalled40, Stalled80;
650  Stalled10 = Stalled20 = Stalled40 = Stalled80 = 0;
651 #endif // RANDOMIZE
652 
653  if (!initialize())
654  {
655  if (mpCallBack)
657 
658  return false;
659  }
660 
661  // initialise the population
662  Continue = creation(0);
663 
664  // get the index of the fittest
665  BestIndex = fittest();
666 
667  if (BestIndex != C_INVALID_INDEX)
668  {
669  // and store that value
670  mBestValue = mValue[BestIndex];
671  Continue = mpOptProblem->setSolution(mBestValue, *mIndividual[BestIndex]);
672 
673  // We found a new best value lets report it.
675  }
676 
677  if (!Continue)
678  {
679  if (mpCallBack)
681 
682  cleanup();
683  return true;
684  }
685 
686  // ITERATE FOR gener GENERATIONS
687 #ifdef RANDOMIZE
688 
689  for (mGeneration = 2;
690  mGeneration <= mGenerations && Continue;
691  mGeneration++, Stalled10++, Stalled20++, Stalled40++, Stalled80++)
692  {
693  // perturb the population if we have stalled for a while
694  if (Stalled80 > 80)
695  {
696  Continue = creation((size_t)(mPopulationSize * 0.2));
697  Stalled10 = Stalled20 = Stalled40 = Stalled80 = 0;
698  }
699  else if (Stalled40 > 40)
700  {
701  Continue = creation((size_t)(mPopulationSize * 0.6));
702  Stalled10 = Stalled20 = Stalled40 = 0;
703  }
704  else if (Stalled20 > 20)
705  {
706  Continue = creation((size_t)(mPopulationSize * 0.8));
707  Stalled10 = Stalled20 = 0;
708  }
709  else if (Stalled10 > 10)
710  {
711  Continue = creation((size_t)(mPopulationSize * 0.9));
712  Stalled10 = 0;
713  }
714 
715 #else
716 
717  for (mGeneration = 2;
718  mGeneration <= mGenerations && Continue;
719  mGeneration++)
720  {
721 #endif // RANDOMIZE
722  Continue = replicate();
723 
724  // select the most fit
725  select();
726 
727  // get the index of the fittest
728  BestIndex = fittest();
729 
730  if (BestIndex != C_INVALID_INDEX &&
731  mValue[BestIndex] < mBestValue)
732  {
733 #ifdef RANDOMIZE
734  Stalled10 = Stalled20 = Stalled40 = Stalled80 = 0;
735 #endif // RANDOMIZE
736  mBestValue = mValue[BestIndex];
737 
738  Continue = mpOptProblem->setSolution(mBestValue, *mIndividual[BestIndex]);
739 
740  // We found a new best value lets report it.
742  }
743 
744  if (mpCallBack)
746  }
747 
748  if (mpCallBack)
750 
751  return true;
752 }
C_FLOAT64 phi(size_t indvNum)
virtual C_INT32 checkConstraint() const
Definition: COptItem.cpp:401
COptTask * mpParentTask
Definition: COptMethod.h:58
#define pdelete(p)
Definition: copasi.h:215
CVector< C_FLOAT64 > mValue
virtual bool initialize()
Definition: COptMethod.cpp:189
unsigned C_INT32 mPopulationSize
std::vector< CVector< C_FLOAT64 > * > mVariance
bool checkLowerBound(const C_FLOAT64 &value) const
Definition: COptItem.cpp:435
virtual C_FLOAT64 getRandomNormal(const C_FLOAT64 &mean, const C_FLOAT64 &sd)
Definition: CRandom.cpp:292
#define childrate
virtual C_FLOAT64 getRandomOO()
Definition: CRandom.cpp:254
C_FLOAT64 mEvaluationValue
virtual bool optimise()
virtual bool cleanup()
unsigned C_INT32 mGenerations
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
#define C_INVALID_INDEX
Definition: copasi.h:222
COptProblem * mpOptProblem
Definition: COptMethod.h:56
const std::vector< COptItem * > * mpOptContraints
Definition: COptMethod.h:75
virtual void output(const COutputInterface::Activity &activity)
CRandom * mpRandom
virtual ~COptMethodSRES()
#define C_INT32
Definition: copasi.h:90
virtual bool progressItem(const size_t &handle)
std::vector< CVector< C_FLOAT64 > * > mIndividual
bool checkUpperBound(const C_FLOAT64 &value) const
Definition: COptItem.cpp:438
bool swap(size_t from, size_t to)
virtual C_FLOAT64 getRandomNormal01()
Definition: CRandom.cpp:261
C_FLOAT64 mBestValue
static CRandom * createGenerator(CRandom::Type type=CRandom::mt19937, unsigned C_INT32 seed=0)
Definition: CRandom.cpp:49
virtual bool calculate()
virtual C_FLOAT64 getRandomCC()
Definition: CRandom.cpp:235
virtual unsigned C_INT32 getRandomU()
Definition: CRandom.cpp:173
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
CVector< C_FLOAT64 > mMaxVariance
const Value & getValue() const
bool setValue(const std::string &name, const CType &value)
const C_FLOAT64 * getLowerBoundValue() const
Definition: COptItem.h:191
unsigned C_INT32 mGeneration
unsigned C_INT32 * pUINT
virtual bool setSolution(const C_FLOAT64 &value, const CVector< C_FLOAT64 > &variables)
virtual bool finishItem(const size_t &handle)
const C_FLOAT64 & getStartValue() const
Definition: COptItem.cpp:199
const std::vector< COptItem * > * mpOptItem
Definition: COptMethod.h:70
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
const C_FLOAT64 * getUpperBoundValue() const
Definition: COptItem.h:198
CVector< C_FLOAT64 > mPhi
bool addParameter(const CCopasiParameter &parameter)
virtual bool initialize()
bool creation(size_t first)
const C_FLOAT64 & getCalculateValue() const
bool evaluate(const CVector< C_FLOAT64 > &individual)
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
COptMethodSRES(const COptMethodSRES &src, const CCopasiContainer *pParent=NULL)
CProcessReport * mpCallBack
#define min(a, b)
Definition: f2c.h:175
#define max(a, b)
Definition: f2c.h:176