COPASI API  4.16.103
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
COptMethodGA Class Reference

#include <COptMethodGA.h>

Inheritance diagram for COptMethodGA:
Inheritance graph
[legend]
Collaboration diagram for COptMethodGA:
Collaboration graph
[legend]

Public Member Functions

 COptMethodGA (const COptMethodGA &src, const CCopasiContainer *pParent=NULL)
 
virtual bool optimise ()
 
virtual ~COptMethodGA ()
 
- Public Member Functions inherited from COptMethod
 COptMethod (const COptMethod &src, const CCopasiContainer *pParent=NULL)
 
bool isBounded (void)
 
virtual bool isValidProblem (const CCopasiProblem *pProblem)
 
void setProblem (COptProblem *problem)
 
virtual ~COptMethod ()
 
- Public Member Functions inherited from CCopasiMethod
 CCopasiMethod (const CCopasiMethod &src, const CCopasiContainer *pParent=NULL)
 
const CCopasiMethod::SubTypegetSubType () const
 
const CCopasiTask::TypegetType () const
 
virtual void load (CReadConfig &configBuffer, CReadConfig::Mode mode=CReadConfig::SEARCH)
 
virtual void print (std::ostream *ostream) const
 
virtual void printResult (std::ostream *ostream) const
 
virtual bool setCallBack (CProcessReport *pCallBack)
 
virtual ~CCopasiMethod ()
 
- Public Member Functions inherited from CCopasiParameterGroup
bool addGroup (const std::string &name)
 
bool addParameter (const CCopasiParameter &parameter)
 
bool addParameter (const std::string &name, const CCopasiParameter::Type type)
 
template<class CType >
bool addParameter (const std::string &name, const CCopasiParameter::Type type, const CType &value)
 
void addParameter (CCopasiParameter *pParameter)
 
CCopasiParameterGroupassertGroup (const std::string &name)
 
template<class CType >
CCopasiParameterassertParameter (const std::string &name, const CCopasiParameter::Type type, const CType &defaultValue)
 
index_iterator beginIndex () const
 
name_iterator beginName () const
 
 CCopasiParameterGroup (const CCopasiParameterGroup &src, const CCopasiContainer *pParent=NULL)
 
 CCopasiParameterGroup (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &objectType="ParameterGroup")
 
void clear ()
 
virtual bool elevateChildren ()
 
index_iterator endIndex () const
 
name_iterator endName () const
 
CCopasiParameterGroupgetGroup (const std::string &name)
 
const CCopasiParameterGroupgetGroup (const std::string &name) const
 
CCopasiParameterGroupgetGroup (const size_t &index)
 
const CCopasiParameterGroupgetGroup (const size_t &index) const
 
size_t getIndex (const std::string &name) const
 
std::string getKey (const std::string &name) const
 
std::string getKey (const size_t &index) const
 
virtual const std::string & getName (const size_t &index) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
CCopasiParametergetParameter (const std::string &name)
 
const CCopasiParametergetParameter (const std::string &name) const
 
CCopasiParametergetParameter (const size_t &index)
 
const CCopasiParametergetParameter (const size_t &index) const
 
CCopasiParameter::Type getType (const std::string &name) const
 
CCopasiParameter::Type getType (const size_t &index) const
 
std::string getUniqueParameterName (const CCopasiParameter *pParameter) const
 
const CCopasiParameter::ValuegetValue (const std::string &name) const
 
const CCopasiParameter::ValuegetValue (const size_t &index) const
 
CCopasiParameter::ValuegetValue (const std::string &name)
 
CCopasiParameter::ValuegetValue (const size_t &index)
 
CCopasiParameterGroupoperator= (const CCopasiParameterGroup &rhs)
 
bool removeParameter (const std::string &name)
 
bool removeParameter (const size_t &index)
 
template<class CType >
bool setValue (const std::string &name, const CType &value)
 
template<class CType >
bool setValue (const size_t &index, const CType &value)
 
size_t size () const
 
bool swap (const size_t &iFrom, const size_t &iTo)
 
bool swap (index_iterator &from, index_iterator &to)
 
virtual ~CCopasiParameterGroup ()
 
- Public Member Functions inherited from CCopasiParameter
 CCopasiParameter (const CCopasiParameter &src, const CCopasiContainer *pParent=NULL)
 
 CCopasiParameter (const std::string &name, const Type &type, const void *pValue=NULL, const CCopasiContainer *pParent=NULL, const std::string &objectType="Parameter")
 
virtual CCopasiObjectName getCN () const
 
virtual const std::string & getKey () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const CCopasiParameter::TypegetType () const
 
const ValuegetValue () const
 
ValuegetValue ()
 
virtual voidgetValuePointer () const
 
CCopasiObjectgetValueReference () const
 
bool isValidValue (const C_FLOAT64 &value) const
 
bool isValidValue (const C_INT32 &value) const
 
bool isValidValue (const unsigned C_INT32 &value) const
 
bool isValidValue (const bool &value) const
 
bool isValidValue (const std::string &value) const
 
bool isValidValue (const CCopasiObjectName &value) const
 
bool isValidValue (const std::vector< CCopasiParameter * > &value) const
 
CCopasiParameteroperator= (const CCopasiParameter &rhs)
 
template<class CType >
bool setValue (const CType &value)
 
bool setValue (const std::vector< CCopasiParameter * > &value)
 
virtual ~CCopasiParameter ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Private Member Functions

virtual bool cleanup ()
 
 COptMethodGA (const CCopasiContainer *pParent=NULL)
 
bool creation (size_t first, size_t last=std::numeric_limits< size_t >::max())
 
bool crossover (const CVector< C_FLOAT64 > &parent1, const CVector< C_FLOAT64 > &parent2, CVector< C_FLOAT64 > &child1, CVector< C_FLOAT64 > &child2)
 
bool evaluate (const CVector< C_FLOAT64 > &individual)
 
size_t fittest ()
 
virtual bool initialize ()
 
void initObjects ()
 
bool mutate (CVector< C_FLOAT64 > &individual)
 
bool replicate ()
 
bool select ()
 
bool serializepop (size_t first, size_t last)
 
bool swap (size_t from, size_t to)
 

Private Attributes

size_t mBestIndex
 
C_FLOAT64 mBestValue
 
CVector< bool > mCrossOver
 
CVector< bool > mCrossOverFalse
 
C_FLOAT64 mEvaluationValue
 
unsigned C_INT32 mGeneration
 
unsigned C_INT32 mGenerations
 
size_t mhGenerations
 
std::vector< CVector
< C_FLOAT64 > * > 
mIndividual
 
CVector< size_t > mLosses
 
C_FLOAT64 mMutationVarians
 
CVector< size_t > mPivot
 
unsigned C_INT32 mPopulationSize
 
CPermutationmpPermutation
 
CRandommpRandom
 
CVector< C_FLOAT64mValue
 
size_t mVariableSize
 

Friends

COptMethodCOptMethod::createMethod (CCopasiMethod::SubType subType)
 

Additional Inherited Members

- Public Types inherited from CCopasiMethod
enum  SubType {
  unset = 0, RandomSearch, RandomSearchMaster, SimulatedAnnealing,
  CoranaWalk, DifferentialEvolution, ScatterSearch, GeneticAlgorithm,
  EvolutionaryProgram, SteepestDescent, HybridGASA, GeneticAlgorithmSR,
  HookeJeeves, LevenbergMarquardt, NelderMead, SRES,
  Statistics, ParticleSwarm, Praxis, TruncatedNewton,
  Newton, deterministic, LSODAR, directMethod,
  stochastic, tauLeap, adaptiveSA, hybrid,
  hybridLSODA, hybridODE45, DsaLsodar, tssILDM,
  tssILDMModified, tssCSP, mcaMethodReder, scanMethod,
  lyapWolf, sensMethod, EFMAlgorithm, EFMBitPatternTreeAlgorithm,
  EFMBitPatternAlgorithm, Householder, crossSectionMethod, linearNoiseApproximation
}
 
- Public Types inherited from CCopasiParameterGroup
typedef parameterGroup::iterator index_iterator
 
typedef
CCopasiContainer::objectMap::iterator 
name_iterator
 
typedef std::vector
< CCopasiParameter * > 
parameterGroup
 
- Public Types inherited from CCopasiParameter
enum  Type {
  DOUBLE = 0, UDOUBLE, INT, UINT,
  BOOL, GROUP, STRING, CN,
  KEY, FILE, EXPRESSION, INVALID
}
 
- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Member Functions inherited from COptMethod
static COptMethodcreateMethod (CCopasiMethod::SubType subType=CCopasiMethod::RandomSearch)
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- Static Public Attributes inherited from CCopasiMethod
static const std::string SubTypeName []
 
static const char * XMLSubType []
 
- Static Public Attributes inherited from CCopasiParameter
static const std::string TypeName []
 
static const char * XMLType []
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from COptMethod
 COptMethod (const CCopasiTask::Type &taskType, const SubType &subType, const CCopasiContainer *pParent=NULL)
 
- Protected Member Functions inherited from CCopasiMethod
 CCopasiMethod (const CCopasiTask::Type &taskType, const SubType &subType, const CCopasiContainer *pParent=NULL)
 
- Protected Member Functions inherited from CCopasiParameterGroup
 CCopasiParameterGroup ()
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Protected Attributes inherited from COptMethod
const bool mBounds
 
const std::vector< COptItem * > * mpOptContraints
 
const std::vector< COptItem * > * mpOptItem
 
COptProblemmpOptProblem
 
COptTaskmpParentTask
 
const std::vector
< UpdateMethod * > * 
mpSetCalculateVariable
 
- Protected Attributes inherited from CCopasiMethod
CProcessReportmpCallBack
 
- Protected Attributes inherited from CCopasiParameter
std::string mKey
 
CCopasiObjectmpValueReference
 
size_t mSize
 
Value mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 29 of file COptMethodGA.h.

Constructor & Destructor Documentation

COptMethodGA::COptMethodGA ( const COptMethodGA src,
const CCopasiContainer pParent = NULL 
)

Copy Constructor

Parameters
constCOptMethodGA & src
constCCopasiContainer * pParent (default: NULL)

Definition at line 64 of file COptMethodGA.cpp.

References initObjects().

65  :
66  COptMethod(src, pParent),
67  mGenerations(0),
68  mPopulationSize(0),
69  mpRandom(NULL),
70  mVariableSize(0),
71  mIndividual(0),
72  mCrossOverFalse(0),
73  mCrossOver(0),
75  mValue(0),
76  mpPermutation(NULL),
77  mLosses(0),
78  mPivot(0),
79  mMutationVarians(0.1),
82  mGeneration(0)
83 {initObjects();}
C_FLOAT64 mMutationVarians
Definition: COptMethodGA.h:217
unsigned C_INT32 mGenerations
Definition: COptMethodGA.h:152
CVector< size_t > mPivot
Definition: COptMethodGA.h:212
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
CVector< bool > mCrossOverFalse
Definition: COptMethodGA.h:182
#define C_INVALID_INDEX
Definition: copasi.h:222
C_FLOAT64 mEvaluationValue
Definition: COptMethodGA.h:192
CRandom * mpRandom
Definition: COptMethodGA.h:167
CVector< size_t > mLosses
Definition: COptMethodGA.h:207
CVector< bool > mCrossOver
Definition: COptMethodGA.h:187
void initObjects()
size_t mVariableSize
Definition: COptMethodGA.h:172
size_t mBestIndex
Definition: COptMethodGA.h:220
unsigned C_INT32 mGeneration
Definition: COptMethodGA.h:221
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
C_FLOAT64 mBestValue
Definition: COptMethodGA.h:219
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
CPermutation * mpPermutation
Definition: COptMethodGA.h:202
#define max(a, b)
Definition: f2c.h:176
COptMethodGA::~COptMethodGA ( )
virtual

Destructor

Definition at line 85 of file COptMethodGA.cpp.

References cleanup().

86 {cleanup();}
virtual bool cleanup()
COptMethodGA::COptMethodGA ( const CCopasiContainer pParent = NULL)
private

Default Constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 36 of file COptMethodGA.cpp.

References CCopasiParameterGroup::addParameter(), C_INT32, initObjects(), CRandom::mt19937, and CCopasiParameter::UINT.

36  :
38  mGenerations(0),
39  mPopulationSize(0),
40  mpRandom(NULL),
41  mVariableSize(0),
42  mIndividual(0),
43  mCrossOverFalse(0),
44  mCrossOver(0),
46  mValue(0),
47  mpPermutation(NULL),
48  mLosses(0),
49  mPivot(0),
50  mMutationVarians(0.1),
53  mGeneration(0)
54 
55 {
56  addParameter("Number of Generations", CCopasiParameter::UINT, (unsigned C_INT32) 200);
57  addParameter("Population Size", CCopasiParameter::UINT, (unsigned C_INT32) 20);
58  addParameter("Random Number Generator", CCopasiParameter::UINT, (unsigned C_INT32) CRandom::mt19937);
59  addParameter("Seed", CCopasiParameter::UINT, (unsigned C_INT32) 0);
60 
61  initObjects();
62 }
C_FLOAT64 mMutationVarians
Definition: COptMethodGA.h:217
unsigned C_INT32 mGenerations
Definition: COptMethodGA.h:152
CVector< size_t > mPivot
Definition: COptMethodGA.h:212
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
CVector< bool > mCrossOverFalse
Definition: COptMethodGA.h:182
#define C_INVALID_INDEX
Definition: copasi.h:222
C_FLOAT64 mEvaluationValue
Definition: COptMethodGA.h:192
#define C_INT32
Definition: copasi.h:90
CRandom * mpRandom
Definition: COptMethodGA.h:167
CVector< size_t > mLosses
Definition: COptMethodGA.h:207
CVector< bool > mCrossOver
Definition: COptMethodGA.h:187
void initObjects()
size_t mVariableSize
Definition: COptMethodGA.h:172
size_t mBestIndex
Definition: COptMethodGA.h:220
unsigned C_INT32 mGeneration
Definition: COptMethodGA.h:221
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
C_FLOAT64 mBestValue
Definition: COptMethodGA.h:219
bool addParameter(const CCopasiParameter &parameter)
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
CPermutation * mpPermutation
Definition: COptMethodGA.h:202
#define max(a, b)
Definition: f2c.h:176

Member Function Documentation

bool COptMethodGA::cleanup ( )
privatevirtual

Cleanup arrays and pointers.

Returns
bool success

Reimplemented from COptMethod.

Definition at line 468 of file COptMethodGA.cpp.

References mIndividual, mpPermutation, mpRandom, and pdelete.

Referenced by initialize(), optimise(), and ~COptMethodGA().

469 {
470  size_t i;
471 
472  pdelete(mpRandom);
474 
475  for (i = 0; i < mIndividual.size(); i++)
476  pdelete(mIndividual[i]);
477 
478  return true;
479 }
#define pdelete(p)
Definition: copasi.h:215
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
CRandom * mpRandom
Definition: COptMethodGA.h:167
CPermutation * mpPermutation
Definition: COptMethodGA.h:202
bool COptMethodGA::creation ( size_t  first,
size_t  last = std::numeric_limits<size_t>::max() 
)
private

Initialise the population

Parameters
size_tfirst
size_tlast (default: population size)
Returns
bool continue

Definition at line 337 of file COptMethodGA.cpp.

References C_FLOAT64, COptItem::checkConstraint(), evaluate(), COptItem::getLowerBoundValue(), CRandom::getRandomCC(), COptItem::getUpperBoundValue(), max, mEvaluationValue, min, mIndividual, mPopulationSize, mpRandom, mValue, and mVariableSize.

Referenced by optimise().

339 {
340  size_t Last = std::min(last, (size_t) mPopulationSize);
341 
342  size_t i;
343  size_t j;
344 
345  C_FLOAT64 mn;
346  C_FLOAT64 mx;
347  C_FLOAT64 la;
348 
349  bool Continue = true;
350 
351  for (i = first; i < Last && Continue; i++)
352  {
353  for (j = 0; j < mVariableSize; j++)
354  {
355  // calculate lower and upper bounds
356  COptItem & OptItem = *(*mpOptItem)[j];
357  mn = *OptItem.getLowerBoundValue();
358  mx = *OptItem.getUpperBoundValue();
359 
360  C_FLOAT64 & mut = (*mIndividual[i])[j];
361 
362  try
363  {
364  // determine if linear or log scale
365  if ((mn < 0.0) || (mx <= 0.0))
366  mut = mn + mpRandom->getRandomCC() * (mx - mn);
367  else
368  {
369  la = log10(mx) - log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min()));
370 
371  if (la < 1.8)
372  mut = mn + mpRandom->getRandomCC() * (mx - mn);
373  else
374  mut = pow(10.0, log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min())) + la * mpRandom->getRandomCC());
375  }
376  }
377 
378  catch (...)
379  {
380  mut = (mx + mn) * 0.5;
381  }
382 
383  // force it to be within the bounds
384  switch (OptItem.checkConstraint(mut))
385  {
386  case - 1:
387  mut = *OptItem.getLowerBoundValue();
388  break;
389 
390  case 1:
391  mut = *OptItem.getUpperBoundValue();
392  break;
393  }
394 
395  // We need to set the value here so that further checks take
396  // account of the value.
397  (*(*mpSetCalculateVariable)[j])(mut);
398  }
399 
400  // calculate its fitness
401  Continue &= evaluate(*mIndividual[i]);
403  }
404 
405  return Continue;
406 }
virtual C_INT32 checkConstraint() const
Definition: COptItem.cpp:401
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
C_FLOAT64 mEvaluationValue
Definition: COptMethodGA.h:192
CRandom * mpRandom
Definition: COptMethodGA.h:167
virtual C_FLOAT64 getRandomCC()
Definition: CRandom.cpp:235
size_t mVariableSize
Definition: COptMethodGA.h:172
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
const C_FLOAT64 * getLowerBoundValue() const
Definition: COptItem.h:191
#define C_FLOAT64
Definition: copasi.h:92
const C_FLOAT64 * getUpperBoundValue() const
Definition: COptItem.h:198
bool evaluate(const CVector< C_FLOAT64 > &individual)
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
#define min(a, b)
Definition: f2c.h:175
#define max(a, b)
Definition: f2c.h:176
bool COptMethodGA::crossover ( const CVector< C_FLOAT64 > &  parent1,
const CVector< C_FLOAT64 > &  parent2,
CVector< C_FLOAT64 > &  child1,
CVector< C_FLOAT64 > &  child2 
)
private
Parameters
constCVector< C_FLOAT64 > & parent1
constCVector< C_FLOAT64 > & parent2
CVector<C_FLOAT64 > & child1
CVector<C_FLOAT64 > & child2

Definition at line 159 of file COptMethodGA.cpp.

References C_INT32, CRandom::getRandomU(), mCrossOver, mCrossOverFalse, mpRandom, and mVariableSize.

Referenced by replicate().

163 {
164  size_t i, crp;
165  size_t nCross = 0;
166 
168 
169  if (mVariableSize > 1)
170  nCross = mpRandom->getRandomU((unsigned C_INT32)(mVariableSize / 2));
171 
172  if (nCross == 0)
173  {
174  // if less than 0 just copy parent to child
175  child1 = parent1;
176  child2 = parent2;
177 
178  return true;
179  }
180 
181  // choose cross over points;
182  // We do not mind if a crossover point gets drawn twice
183  for (i = 0; i < nCross; i++)
184  {
185  crp = mpRandom->getRandomU((unsigned C_INT32)(mVariableSize - 1));
186  mCrossOver[crp] = true;
187  }
188 
189  const CVector< C_FLOAT64 > * pParent1 = & parent1;
190 
191  const CVector< C_FLOAT64 > * pParent2 = & parent2;
192 
193  const CVector< C_FLOAT64 > * pTmp;
194 
195  for (i = 0; i < mVariableSize; i++)
196  {
197  if (mCrossOver[i])
198  {
199  pTmp = pParent1;
200  pParent1 = pParent2;
201  pParent2 = pTmp;
202  }
203 
204  child1[i] = (*pParent1)[i];
205  child2[i] = (*pParent2)[i];
206  }
207 
208  return true;
209 }
CVector< bool > mCrossOverFalse
Definition: COptMethodGA.h:182
#define C_INT32
Definition: copasi.h:90
CRandom * mpRandom
Definition: COptMethodGA.h:167
CVector< bool > mCrossOver
Definition: COptMethodGA.h:187
virtual unsigned C_INT32 getRandomU()
Definition: CRandom.cpp:173
size_t mVariableSize
Definition: COptMethodGA.h:172
bool COptMethodGA::evaluate ( const CVector< C_FLOAT64 > &  individual)
private

Evaluate the fitness of one individual

Parameters
constCVector< C_FLOAT64 > & individual
Returns
bool continue

Definition at line 89 of file COptMethodGA.cpp.

References COptProblem::calculate(), COptProblem::checkFunctionalConstraints(), COptProblem::getCalculateValue(), mEvaluationValue, and COptMethod::mpOptProblem.

Referenced by creation(), optimise(), and replicate().

90 {
91  bool Continue = true;
92 
93  // We do not need to check whether the parametric constraints are fulfilled
94  // since the parameters are created within the bounds.
95 
96  // evaluate the fitness
97  Continue &= mpOptProblem->calculate();
98 
99  // check whether the functional constraints are fulfilled
101  mEvaluationValue = std::numeric_limits<C_FLOAT64>::infinity();
102  else
104 
105  return Continue;
106 }
COptProblem * mpOptProblem
Definition: COptMethod.h:56
C_FLOAT64 mEvaluationValue
Definition: COptMethodGA.h:192
virtual bool calculate()
virtual bool checkFunctionalConstraints()
const C_FLOAT64 & getCalculateValue() const
size_t COptMethodGA::fittest ( void  )
private

Find the best individual at this generation

Returns
size_t fittest

Definition at line 283 of file COptMethodGA.cpp.

References C_FLOAT64, C_INVALID_INDEX, max, mLosses, mPopulationSize, and mValue.

Referenced by optimise().

284 {
285  size_t i, BestIndex = C_INVALID_INDEX;
287 
288  for (i = 0; i < mPopulationSize && !mLosses[i]; i++)
289  if (mValue[i] < BestValue)
290  {
291  BestIndex = i;
292  BestValue = mValue[i];
293  }
294 
295  return BestIndex;
296 }
#define C_INVALID_INDEX
Definition: copasi.h:222
CVector< size_t > mLosses
Definition: COptMethodGA.h:207
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
#define C_FLOAT64
Definition: copasi.h:92
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
#define max(a, b)
Definition: f2c.h:176
bool COptMethodGA::initialize ( )
privatevirtual

Initialize arrays and pointer.

Returns
bool success

Reimplemented from COptMethod.

Definition at line 413 of file COptMethodGA.cpp.

References CProcessReport::addItem(), cleanup(), CRandom::createGenerator(), CProcessReport::finishItem(), CCopasiParameter::getValue(), COptMethod::initialize(), mBestValue, mCrossOver, mCrossOverFalse, mGeneration, mGenerations, mhGenerations, mIndividual, mLosses, mMutationVarians, CCopasiMethod::mpCallBack, COptMethod::mpOptItem, mPopulationSize, mpPermutation, mpRandom, mValue, mVariableSize, CCopasiParameter::Value::pUINT, and CVector< CType >::resize().

Referenced by optimise().

414 {
415  cleanup();
416 
417  size_t i;
418 
419  if (!COptMethod::initialize())
420  {
421  if (mpCallBack)
423 
424  return false;
425  }
426 
427  mGenerations = * getValue("Number of Generations").pUINT;
428  mGeneration = 0;
429 
430  if (mpCallBack)
431  mhGenerations =
432  mpCallBack->addItem("Current Generation",
433  mGeneration,
434  & mGenerations);
435 
436  mGeneration++;
437 
438  mPopulationSize = * getValue("Population Size").pUINT;
439  mpRandom =
440  CRandom::createGenerator(* (CRandom::Type *) getValue("Random Number Generator").pUINT,
441  * getValue("Seed").pUINT);
442 
443  mVariableSize = mpOptItem->size();
444 
445  mIndividual.resize(2 * mPopulationSize);
446 
447  for (i = 0; i < 2 * mPopulationSize; i++)
449 
451  mCrossOverFalse = false;
453 
454  mValue.resize(2 * mPopulationSize);
455  mValue = std::numeric_limits<C_FLOAT64>::infinity();
456  mBestValue = std::numeric_limits<C_FLOAT64>::infinity();
457 
458  mpPermutation = new CPermutation(mpRandom, mPopulationSize);
459 
460  mLosses.resize(2 * mPopulationSize);
461 
462  // Initialize the variance for mutations
463  mMutationVarians = 0.1;
464 
465  return true;
466 }
virtual bool initialize()
Definition: COptMethod.cpp:189
C_FLOAT64 mMutationVarians
Definition: COptMethodGA.h:217
unsigned C_INT32 mGenerations
Definition: COptMethodGA.h:152
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
CVector< bool > mCrossOverFalse
Definition: COptMethodGA.h:182
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
CRandom * mpRandom
Definition: COptMethodGA.h:167
CVector< size_t > mLosses
Definition: COptMethodGA.h:207
static CRandom * createGenerator(CRandom::Type type=CRandom::mt19937, unsigned C_INT32 seed=0)
Definition: CRandom.cpp:49
CVector< bool > mCrossOver
Definition: COptMethodGA.h:187
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
const Value & getValue() const
size_t mVariableSize
Definition: COptMethodGA.h:172
unsigned C_INT32 mGeneration
Definition: COptMethodGA.h:221
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
unsigned C_INT32 * pUINT
virtual bool finishItem(const size_t &handle)
const std::vector< COptItem * > * mpOptItem
Definition: COptMethod.h:70
C_FLOAT64 mBestValue
Definition: COptMethodGA.h:219
virtual bool cleanup()
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
size_t mhGenerations
Definition: COptMethodGA.h:157
CProcessReport * mpCallBack
CPermutation * mpPermutation
Definition: COptMethodGA.h:202
void COptMethodGA::initObjects ( )
private

Initialize contained objects.

Definition at line 408 of file COptMethodGA.cpp.

References CCopasiContainer::addObjectReference(), mGeneration, and CCopasiObject::ValueInt.

Referenced by COptMethodGA().

409 {
411 }
unsigned C_INT32 mGeneration
Definition: COptMethodGA.h:221
CCopasiObject * addObjectReference(const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
bool COptMethodGA::mutate ( CVector< C_FLOAT64 > &  individual)
private

Mutate one individual

Parameters
CVector<C_FLOAT64 > & individual
Returns
bool success

Definition at line 126 of file COptMethodGA.cpp.

References C_FLOAT64, COptItem::checkConstraint(), COptItem::getLowerBoundValue(), CRandom::getRandomNormal(), COptItem::getUpperBoundValue(), mMutationVarians, mpRandom, and mVariableSize.

Referenced by replicate().

127 {
128  size_t j;
129 
130  // mutate the parameters
131  for (j = 0; j < mVariableSize; j++)
132  {
133  COptItem & OptItem = *(*mpOptItem)[j];
134  C_FLOAT64 & mut = individual[j];
135 
136  // calculate the mutatated parameter
138 
139  // force it to be within the bounds
140  switch (OptItem.checkConstraint(mut))
141  {
142  case - 1:
143  mut = *OptItem.getLowerBoundValue();
144  break;
145 
146  case 1:
147  mut = *OptItem.getUpperBoundValue();
148  break;
149  }
150 
151  // We need to set the value here so that further checks take
152  // account of the value.
153  (*(*mpSetCalculateVariable)[j])(mut);
154  }
155 
156  return true;
157 }
virtual C_INT32 checkConstraint() const
Definition: COptItem.cpp:401
C_FLOAT64 mMutationVarians
Definition: COptMethodGA.h:217
virtual C_FLOAT64 getRandomNormal(const C_FLOAT64 &mean, const C_FLOAT64 &sd)
Definition: CRandom.cpp:292
CRandom * mpRandom
Definition: COptMethodGA.h:167
size_t mVariableSize
Definition: COptMethodGA.h:172
const C_FLOAT64 * getLowerBoundValue() const
Definition: COptItem.h:191
#define C_FLOAT64
Definition: copasi.h:92
const C_FLOAT64 * getUpperBoundValue() const
Definition: COptItem.h:198
bool COptMethodGA::optimise ( void  )
virtual

Execute the optimization algorithm calling simulation routine when needed. It is noted that this procedure can give feedback of its progress by the callback function set with SetCallback. @ return success;

Reimplemented from COptMethod.

Definition at line 481 of file COptMethodGA.cpp.

References C_FLOAT64, C_INVALID_INDEX, COptItem::checkConstraint(), cleanup(), creation(), COutputInterface::DURING, evaluate(), CProcessReport::finishItem(), fittest(), COptItem::getLowerBoundValue(), COptItem::getStartValue(), COptItem::getUpperBoundValue(), initialize(), mBestIndex, mBestValue, mEvaluationValue, mGeneration, mGenerations, mhGenerations, mIndividual, CCopasiMethod::mpCallBack, COptMethod::mpOptProblem, mPopulationSize, COptMethod::mpParentTask, mValue, mVariableSize, CCopasiTask::output(), CProcessReport::progressItem(), replicate(), select(), serializepop(), and COptProblem::setSolution().

482 {
483  bool Continue = true;
484 
485  if (!initialize())
486  {
487  // initialisation failed, we exit
488  if (mpCallBack)
490  return false;
491  }
492 
493  // Counters to determine whether the optimization process has stalled
494  // They count the number of generations without advances.
495  size_t Stalled, Stalled10, Stalled30, Stalled50;
496  Stalled = Stalled10 = Stalled30 = Stalled50 = 0;
497 
498  size_t i;
499 
500  // initialise the population
501  // first individual is the initial guess
502  for (i = 0; i < mVariableSize; i++)
503  {
504  C_FLOAT64 & mut = (*mIndividual[0])[i];
505  COptItem & OptItem = *(*mpOptItem)[i];
506 
507  mut = OptItem.getStartValue();
508 
509  // force it to be within the bounds
510  switch (OptItem.checkConstraint(mut))
511  {
512  case - 1:
513  mut = *OptItem.getLowerBoundValue();
514  break;
515 
516  case 1:
517  mut = *OptItem.getUpperBoundValue();
518  break;
519  }
520 
521  // We need to set the value here so that further checks take
522  // account of the value.
523  (*(*mpSetCalculateVariable)[i])(mut);
524  }
525 
526  Continue &= evaluate(*mIndividual[0]);
528 
529  if (!isnan(mEvaluationValue))
530  {
531  // and store that value
532  mBestValue = mValue[0];
533  Continue &= mpOptProblem->setSolution(mBestValue, *mIndividual[0]);
534 
535  // We found a new best value lets report it.
537  }
538 
539  // the others are random
540  Continue &= creation(1, mPopulationSize);
541 
542 #ifdef DEBUG_OPT
544 #endif
545 
546  Continue &= select();
547  mBestIndex = fittest();
548 
549  if (mBestIndex != C_INVALID_INDEX &&
551  {
552  // and store that value
555 
556  // We found a new best value lets report it.
558  }
559 
560  // test if the user wants to stop, and do so if needed
561  if (!Continue)
562  {
563  if (mpCallBack)
565  cleanup();
566  return true;
567  }
568 
569  // ITERATE FOR gener GENERATIONS
570  for (mGeneration = 2;
571  mGeneration <= mGenerations && Continue;
572  mGeneration++, Stalled++, Stalled10++, Stalled30++, Stalled50++)
573  {
574  // perturb the population if we have stalled for a while
575  if (Stalled > 50 && Stalled50 > 50)
576  {
577  Continue &= creation((size_t)(mPopulationSize / 2),
579  Stalled10 = Stalled30 = Stalled50 = 0;
580  }
581  else if (Stalled > 30 && Stalled30 > 30)
582  {
583  Continue &= creation((size_t)(mPopulationSize * 0.7),
585  Stalled10 = Stalled30 = 0;
586  }
587  else if (Stalled > 10 && Stalled10 > 10)
588  {
589  Continue &= creation((size_t)(mPopulationSize * 0.9),
591  Stalled10 = 0;
592  }
593  // replicate the individuals
594  else
595  Continue &= replicate();
596 
597  // select the most fit
598  Continue &= select();
599 
600  // get the index of the fittest
601  mBestIndex = fittest();
602 
603  if (mBestIndex != C_INVALID_INDEX &&
604  mValue[mBestIndex] < mBestValue)
605  {
606  // reset the stalled counters, since we made progress this time
607  Stalled = Stalled10 = Stalled30 = Stalled50 = 0;
608  // keep best value
610  // pass the current best value upstream
611  Continue &= mpOptProblem->setSolution(mBestValue, *mIndividual[mBestIndex]);
612  // We found a new best value lets report it.
614  }
615 
616  if (mpCallBack)
617  Continue &= mpCallBack->progressItem(mhGenerations);
618 #ifdef DEBUG_OPT
620 #endif
621  }
622 
623  if (mpCallBack)
625 
626  cleanup();
627  return true;
628 }
virtual C_INT32 checkConstraint() const
Definition: COptItem.cpp:401
virtual bool initialize()
COptTask * mpParentTask
Definition: COptMethod.h:58
unsigned C_INT32 mGenerations
Definition: COptMethodGA.h:152
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
#define C_INVALID_INDEX
Definition: copasi.h:222
COptProblem * mpOptProblem
Definition: COptMethod.h:56
C_FLOAT64 mEvaluationValue
Definition: COptMethodGA.h:192
virtual void output(const COutputInterface::Activity &activity)
size_t fittest()
virtual bool progressItem(const size_t &handle)
size_t mVariableSize
Definition: COptMethodGA.h:172
size_t mBestIndex
Definition: COptMethodGA.h:220
unsigned C_INT32 mGeneration
Definition: COptMethodGA.h:221
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
const C_FLOAT64 * getLowerBoundValue() const
Definition: COptItem.h:191
bool serializepop(size_t first, size_t last)
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
#define C_FLOAT64
Definition: copasi.h:92
C_FLOAT64 mBestValue
Definition: COptMethodGA.h:219
const C_FLOAT64 * getUpperBoundValue() const
Definition: COptItem.h:198
virtual bool cleanup()
bool evaluate(const CVector< C_FLOAT64 > &individual)
bool creation(size_t first, size_t last=std::numeric_limits< size_t >::max())
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
size_t mhGenerations
Definition: COptMethodGA.h:157
CProcessReport * mpCallBack
bool COptMethodGA::replicate ( void  )
private

Replicate the individuals with crossover

Returns
bool continue

Definition at line 211 of file COptMethodGA.cpp.

References crossover(), evaluate(), mEvaluationValue, mIndividual, mPopulationSize, mpPermutation, mutate(), mValue, CPermutation::next(), and CPermutation::shuffle().

Referenced by optimise().

212 {
213  size_t i;
214  bool Continue = true;
215 
216  // generate a random order for the parents
218 
219  // reproduce in consecutive pairs
220  for (i = 0; i < mPopulationSize / 2; i++)
223  *mIndividual[mPopulationSize + i * 2],
224  *mIndividual[mPopulationSize + i * 2 + 1]);
225 
226  // check if there is one left over and just copy it
227  if (mPopulationSize % 2 > 0)
228  *mIndividual[2 * mPopulationSize - 1] = *mIndividual[mPopulationSize - 1];
229 
230  // mutate the offspring
231  for (i = mPopulationSize; i < 2 * mPopulationSize && Continue; i++)
232  {
233  mutate(*mIndividual[i]);
234  Continue &= evaluate(*mIndividual[i]);
236  }
237 
238  return Continue;
239 }
const size_t & next()
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
bool crossover(const CVector< C_FLOAT64 > &parent1, const CVector< C_FLOAT64 > &parent2, CVector< C_FLOAT64 > &child1, CVector< C_FLOAT64 > &child2)
C_FLOAT64 mEvaluationValue
Definition: COptMethodGA.h:192
void shuffle(const size_t &swaps=C_INVALID_INDEX)
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
bool mutate(CVector< C_FLOAT64 > &individual)
bool evaluate(const CVector< C_FLOAT64 > &individual)
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
CPermutation * mpPermutation
Definition: COptMethodGA.h:202
bool COptMethodGA::select ( )
private

Select surviving population

Returns
bool success

Definition at line 242 of file COptMethodGA.cpp.

References applyPartialPivot(), CVectorCore< CType >::array(), C_INT32, CRandom::getRandomU(), mLosses, mPivot, mPopulationSize, mpRandom, mValue, partialSortWithPivot(), and swap().

Referenced by optimise().

243 {
244  size_t i, j, nopp, opp;
245  size_t TotalPopulation = 2 * mPopulationSize;
246 
247  // tournament competition
248  mLosses = 0; // Set all wins to 0.
249 
250  // compete with ~ 20% of the TotalPopulation
251  nopp = std::max<size_t>(1, mPopulationSize / 5);
252 
253  // parents and offspring are all in competition
254  for (i = 0; i < TotalPopulation; i++)
255  for (j = 0; j < nopp; j++)
256  {
257  // get random opponent
258  do
259  {
260  opp = mpRandom->getRandomU((unsigned C_INT32)(TotalPopulation - 1));
261  }
262  while (i == opp);
263 
264  if (mValue[i] < mValue[opp])
265  mLosses[opp]++;
266  else
267  mLosses[i]++;
268  }
269 
270  // selection of top mPopulationSize winners
273  mLosses.array() + TotalPopulation,
274  mPivot);
275 
278 
279  return true;
280 }
bool swap(size_t from, size_t to)
CVector< size_t > mPivot
Definition: COptMethodGA.h:212
bool applyPartialPivot(const CVector< size_t > &pivot, const size_t &ordered, SwapMethod swap)
Definition: CSort.h:375
#define C_INT32
Definition: copasi.h:90
CRandom * mpRandom
Definition: COptMethodGA.h:167
CVector< size_t > mLosses
Definition: COptMethodGA.h:207
void partialSortWithPivot(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, CVector< size_t > &pivot)
Definition: CSort.h:149
virtual unsigned C_INT32 getRandomU()
Definition: CRandom.cpp:173
unsigned C_INT32 mPopulationSize
Definition: COptMethodGA.h:162
CType * array()
Definition: CVector.h:139
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197
bool COptMethodGA::serializepop ( size_t  first,
size_t  last 
)
private

Serialize the population for debug

Parameters
size_tfirst
size_tlast (default: population size)
Returns
bool success

Referenced by optimise().

bool COptMethodGA::swap ( size_t  from,
size_t  to 
)
private

Swap individuals from and to

Parameters
size_tfrom
size_tto
Returns
bool success

Definition at line 108 of file COptMethodGA.cpp.

References C_FLOAT64, mIndividual, mLosses, and mValue.

Referenced by select().

109 {
110  CVector< C_FLOAT64 > * pTmp = mIndividual[to];
111  mIndividual[to] = mIndividual[from];
112  mIndividual[from] = pTmp;
113 
114  C_FLOAT64 dTmp = mValue[to];
115  mValue[to] = mValue[from];
116  mValue[from] = dTmp;
117 
118  size_t iTmp = mLosses[to];
119  mLosses[to] = mLosses[from];
120  mLosses[from] = iTmp;
121 
122  return true;
123 }
std::vector< CVector< C_FLOAT64 > * > mIndividual
Definition: COptMethodGA.h:177
CVector< size_t > mLosses
Definition: COptMethodGA.h:207
#define C_FLOAT64
Definition: copasi.h:92
CVector< C_FLOAT64 > mValue
Definition: COptMethodGA.h:197

Friends And Related Function Documentation

Member Data Documentation

size_t COptMethodGA::mBestIndex
private

Definition at line 220 of file COptMethodGA.h.

Referenced by optimise().

C_FLOAT64 COptMethodGA::mBestValue
private

Definition at line 219 of file COptMethodGA.h.

Referenced by initialize(), and optimise().

CVector< bool > COptMethodGA::mCrossOver
private

Vector of crossover points.

Definition at line 187 of file COptMethodGA.h.

Referenced by crossover(), and initialize().

CVector< bool > COptMethodGA::mCrossOverFalse
private

Vector used to initialize the crossover point to false

Definition at line 182 of file COptMethodGA.h.

Referenced by crossover(), and initialize().

C_FLOAT64 COptMethodGA::mEvaluationValue
private

The value of the last evaluation.

Definition at line 192 of file COptMethodGA.h.

Referenced by creation(), evaluate(), optimise(), and replicate().

unsigned C_INT32 COptMethodGA::mGeneration
private

Definition at line 221 of file COptMethodGA.h.

Referenced by initialize(), initObjects(), and optimise().

unsigned C_INT32 COptMethodGA::mGenerations
private

number of generations

Definition at line 152 of file COptMethodGA.h.

Referenced by initialize(), and optimise().

size_t COptMethodGA::mhGenerations
private

Handle to the process report item "Current Generation"

Definition at line 157 of file COptMethodGA.h.

Referenced by initialize(), and optimise().

std::vector< CVector < C_FLOAT64 > * > COptMethodGA::mIndividual
private

for array of individuals w/ candidate values for the parameters

Definition at line 177 of file COptMethodGA.h.

Referenced by cleanup(), creation(), initialize(), optimise(), replicate(), and swap().

CVector< size_t > COptMethodGA::mLosses
private

number of losses of each individual in the tournament

Definition at line 207 of file COptMethodGA.h.

Referenced by fittest(), initialize(), select(), and swap().

C_FLOAT64 COptMethodGA::mMutationVarians
private

variance for mutations

Definition at line 217 of file COptMethodGA.h.

Referenced by initialize(), and mutate().

CVector<size_t> COptMethodGA::mPivot
private

The pivot vector used for sorting

Definition at line 212 of file COptMethodGA.h.

Referenced by select().

unsigned C_INT32 COptMethodGA::mPopulationSize
private

size of the population

Definition at line 162 of file COptMethodGA.h.

Referenced by creation(), fittest(), initialize(), optimise(), replicate(), and select().

CPermutation* COptMethodGA::mpPermutation
private

A permutation of integers used to create the informants;

Definition at line 202 of file COptMethodGA.h.

Referenced by cleanup(), initialize(), and replicate().

CRandom* COptMethodGA::mpRandom
private

a pointer to the randomnumber generator.

Definition at line 167 of file COptMethodGA.h.

Referenced by cleanup(), creation(), crossover(), initialize(), mutate(), and select().

CVector< C_FLOAT64 > COptMethodGA::mValue
private

array of values of objective function f/ individuals

Definition at line 197 of file COptMethodGA.h.

Referenced by creation(), fittest(), initialize(), optimise(), replicate(), select(), and swap().

size_t COptMethodGA::mVariableSize
private

number of parameters

Definition at line 172 of file COptMethodGA.h.

Referenced by creation(), crossover(), initialize(), mutate(), and optimise().


The documentation for this class was generated from the following files: