COPASI API  4.40.278
COptMethodEP Class Reference

#include <COptMethodEP.h>

Inheritance diagram for COptMethodEP:
[legend]

Public Member Functions

 COptMethodEP (const CDataContainer *pParent, const CTaskEnum::Method &methodType=CTaskEnum::Method::EvolutionaryProgram, const CTaskEnum::Task &taskType=CTaskEnum::Task::optimization)
 
 COptMethodEP (const COptMethodEP &src, const CDataContainer *pParent)
 
virtual unsigned C_INT32 getMaxLogVerbosity () const
 
virtual bool optimise ()
 
virtual ~COptMethodEP ()
 
- Public Member Functions inherited from COptPopulationMethod
 COptPopulationMethod (const CDataContainer *pParent, const CTaskEnum::Method &methodType, const CTaskEnum::Task &taskType, const bool &parallel)
 
 COptPopulationMethod (const COptPopulationMethod &src, const CDataContainer *pParent)
 
C_INT32 getCurrentGeneration ()
 
C_INT32 getNumGenerations ()
 
const CVector< C_FLOAT64 > & getObjectiveValues ()
 
const std::vector< CVector< C_FLOAT64 > * > & getPopulation ()
 
C_INT32 getPopulationSize ()
 
void initObjects ()
 
virtual void print (std::ostream *ostream) const
 
virtual ~COptPopulationMethod ()
 
- Public Member Functions inherited from COptMethod
 COptMethod (const CDataContainer *pParent, const CTaskEnum::Method &methodType, const CTaskEnum::Task &taskType, const bool &parallel)
 
 COptMethod (const COptMethod &src, const CDataContainer *pParent)
 
virtual const CVector< C_FLOAT64 > * getBestParameters () const
 
virtual C_FLOAT64 getBestValue () const
 
virtual const CVector< C_FLOAT64 > * getCurrentParameters () const
 
virtual C_FLOAT64 getCurrentValue () const
 
const COptLoggetMethodLog () const
 
virtual bool isValidProblem (const CCopasiProblem *pProblem)
 
void setProblem (COptProblem *problem)
 
virtual ~COptMethod ()
 
- Public Member Functions inherited from CCopasiMethod
 CCopasiMethod (const CCopasiMethod &src, const CDataContainer *pParent)
 
virtual void clearCallBack ()
 
const CProcessReportLevelgetCallBack () const
 
CMathContainergetMathContainer () const
 
const CTaskEnum::MethodgetSubType () const
 
const CTaskEnum::TaskgetType () const
 
virtual void load (CReadConfig &configBuffer, CReadConfig::Mode mode=CReadConfig::SEARCH)
 
CCopasiMethodoperator= (const CCopasiMethod &rhs)
 
virtual void printResult (std::ostream *ostream) const
 
virtual bool setCallBack (CProcessReportLevel callBack)
 
void setMathContainer (CMathContainer *pContainer)
 
virtual ~CCopasiMethod ()
 
- Public Member Functions inherited from CCopasiParameterGroup
bool addGroup (const std::string &name)
 
void addParameter (CCopasiParameter *pParameter)
 
bool addParameter (const CCopasiParameter &parameter)
 
bool addParameter (const std::string &name, const CCopasiParameter::Type type, const CCopasiParameter::UserInterfaceFlag &flag=CCopasiParameter::UserInterfaceFlag::All)
 
template<class CType >
bool addParameter (const std::string &name, const CCopasiParameter::Type type, const CType &value, const CCopasiParameter::UserInterfaceFlag &flag=CCopasiParameter::UserInterfaceFlag::All)
 
virtual bool applyData (const CData &data, CUndoData::CChangeSet &changes)
 
CCopasiParameterGroupassertGroup (const std::string &name, const CCopasiParameter::UserInterfaceFlag &flag=CCopasiParameter::UserInterfaceFlag::All)
 
template<class CType >
CType * assertParameter (const std::string &name, const CCopasiParameter::Type type, const CType &defaultValue, const CCopasiParameter::UserInterfaceFlag &flag=CCopasiParameter::UserInterfaceFlag::All)
 
index_iterator beginIndex () const
 
const_name_iterator beginName () const
 
 CCopasiParameterGroup (const CCopasiParameterGroup &src, const CDataContainer *pParent=NULL)
 
 CCopasiParameterGroup (const std::string &name, const CDataContainer *pParent=NO_PARENT, const std::string &objectType="ParameterGroup")
 
void clear ()
 
virtual void createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const
 
virtual bool elevateChildren ()
 
index_iterator endIndex () const
 
const_name_iterator endName () const
 
CCopasiParameterGroupgetElementTemplates ()
 
const CCopasiParameterGroupgetElementTemplates () const
 
CCopasiParameterGroupgetGroup (const size_t &index)
 
const CCopasiParameterGroupgetGroup (const size_t &index) const
 
CCopasiParameterGroupgetGroup (const std::string &name)
 
const CCopasiParameterGroupgetGroup (const std::string &name) const
 
virtual size_t getIndex (const CDataObject *pObject) const
 
size_t getIndex (const std::string &name) const
 
std::string getKey (const size_t &index) const
 
std::string getKey (const std::string &name) const
 
virtual const std::string & getName (const size_t &index) const
 
virtual const CObjectInterfacegetObject (const CCommonName &cn) const
 
CCopasiParametergetParameter (const size_t &index)
 
const CCopasiParametergetParameter (const size_t &index) const
 
CCopasiParametergetParameter (std::string name)
 
const CCopasiParametergetParameter (std::string name) const
 
CCopasiParameter::Type getType (const size_t &index) const
 
CCopasiParameter::Type getType (const std::string &name) const
 
std::string getUniqueParameterName (const CCopasiParameter *pParameter) const
 
template<class CType >
CType & getValue (const size_t &index)
 
template<class CType >
const CType & getValue (const size_t &index) const
 
template<class CType >
CType & getValue (const std::string &name)
 
template<class CType >
const CType & getValue (const std::string &name) const
 
bool haveTemplate () const
 
virtual CUndoObjectInterfaceinsert (const CData &data)
 
CCopasiParameterGroupoperator= (const CCopasiParameterGroup &rhs)
 
virtual bool remove (CDataObject *pObject)
 
bool removeParameter (CCopasiParameter *pParameter)
 
bool removeParameter (const size_t &index)
 
bool removeParameter (const std::string &name)
 
virtual void setUserInterfaceFlag (const UserInterfaceFlag &flag)
 
template<class CType >
bool setValue (const size_t &index, const CType &value)
 
template<class CType >
bool setValue (const std::string &name, const CType &value)
 
size_t size (const UserInterfaceFlag &require=UserInterfaceFlag::None, const UserInterfaceFlag &exclude=UserInterfaceFlag::None) const
 
bool swap (const size_t &iFrom, const size_t &iTo)
 
bool swap (index_iterator &from, index_iterator &to)
 
virtual CData toData () const
 
virtual void updateIndex (const size_t &index, const CUndoObjectInterface *pUndoObject)
 
virtual ~CCopasiParameterGroup ()
 
- Public Member Functions inherited from CCopasiParameter
 CCopasiParameter (const CCopasiParameter &src, const CDataContainer *pParent)
 
 CCopasiParameter (const std::string &name, const Type &type, const void *pValue=NULL, const CDataContainer *pParent=NO_PARENT, const std::string &objectType="Parameter")
 
virtual CCommonName getCN () const override
 
template<class CType >
const CType & getDefault () const
 
virtual const std::string & getKey () const override
 
virtual std::string getObjectDisplayName () const override
 
const CCopasiParameter::TypegetType () const
 
const UserInterfaceFlaggetUserInterfaceFlag () const
 
template<class CType >
std::vector< std::pair< CType, CType > > & getValidValues ()
 
template<class CType >
const std::vector< std::pair< CType, CType > > & getValidValues () const
 
void * getValidValuesPointer () const
 
template<class CType >
CType & getValue ()
 
template<class CType >
const CType & getValue () const
 
virtual void * getValuePointer () const override
 
CDataObjectgetValueReference () const
 
bool hasValidValues () const
 
bool isBasic () const
 
bool isDefault () const
 
bool isEditable () const
 
bool isUnsupported () const
 
bool isValidValue (const bool &value) const
 
bool isValidValue (const C_FLOAT64 &value) const
 
bool isValidValue (const C_INT32 &value) const
 
bool isValidValue (const CCommonName &value) const
 
template<class CType >
bool isValidValue (const CType &) const
 
bool isValidValue (const std::string &value) const
 
bool isValidValue (const std::vector< CCopasiParameter * > &value) const
 
bool isValidValue (const unsigned C_INT32 &value) const
 
CCopasiParameteroperator= (const CCopasiParameter &rhs)
 
template<class CType >
bool setDefault (const CType &defaultValue)
 
bool setDefault (const std::vector< CCopasiParameter * > &defaultValue)
 
virtual bool setObjectParent (const CDataContainer *pParent) override
 
template<class CType , class Enum >
bool setValidValues (const CEnumAnnotation< CType, Enum > &validValues)
 
template<class CType >
bool setValidValues (const std::vector< std::pair< CType, CType > > &validValues)
 
template<class CType >
bool setValue (const CType &value)
 
bool setValue (const std::vector< CCopasiParameter * > &value)
 
virtual ~CCopasiParameter ()
 
- Public Member Functions inherited from CDataContainer
virtual bool add (CDataObject *pObject, const bool &adopt=true)
 
virtual bool appendDeletedDependentData (CUndoData &undoData) const
 
 CDataContainer (const CDataContainer &src, const CDataContainer *pParent)
 
 CDataContainer (const std::string &name, const CDataContainer *pParent=NO_PARENT, const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
virtual std::string getChildObjectUnits (const CDataObject *pObject) const
 
void getDescendants (CDataObject::DataObjectSet &descendants, const bool &recursive=false) const
 
virtual objectMapgetObjects ()
 
virtual const objectMapgetObjects () const
 
virtual const std::string getUnits () const override
 
virtual const CDataObjectgetValueObject () const override
 
void objectRenamed (CDataObject *pObject, const std::string &oldName)
 
virtual ~CDataContainer ()
 
- Public Member Functions inherited from CDataObject
void addIssue (const CIssue &issue)
 
void addReference (const CDataContainer *pReference)
 
virtual void calculateValue () override
 
 CDataObject (const CDataObject &src, const CDataContainer *pParent=NULL)
 
virtual void destruct () override
 
virtual const CDataObjectgetDataObject () const override
 
CDataContainergetObjectAncestor (const std::string &type) const
 
CDataModelgetObjectDataModel () const
 
const CObjectInterfacegetObjectFromCN (const CCommonName &cn) const
 
const std::string & getObjectName () const
 
CDataContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const CObjectInterface::ObjectSetgetPrerequisites () const override
 
virtual const CValiditygetValidity () const override
 
bool hasFlag (const Flag &flag) const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CCore::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const override
 
bool prerequisitsContains (const DataObjectSet &objects) const
 
void removeIssue (const CIssue &issue)
 
void removeReference (const CDataContainer *pReference)
 
bool setObjectName (const std::string &name)
 
void validityChanged (const CValidity &changedValidity) override
 
void validityRemoved (const CValidity &changedValidity)
 
virtual ~CDataObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
 CObjectInterface (const CObjectInterface &src)
 
virtual ~CObjectInterface ()
 
- Public Member Functions inherited from CUndoObjectInterface
 CUndoObjectInterface ()
 
 CUndoObjectInterface (const CUndoObjectInterface &src)
 
bool generateUuid ()
 
const xg::Guid & getUuid () const
 
bool setUuid (const std::string &uuid)
 
bool setUuid (const xg::Guid &uuid)
 
virtual ~CUndoObjectInterface ()
 

Private Member Functions

virtual bool cleanup ()
 
 COptMethodEP (const CDataContainer *pParent=NO_PARENT)
 
bool creation ()
 
bool evaluate (const CVector< C_FLOAT64 > &individual)
 
size_t fittest ()
 
virtual bool initialize ()
 
void initObjects ()
 
bool mutate (size_t i)
 
bool replicate ()
 
bool select ()
 
bool swap (size_t from, size_t to)
 

Private Attributes

size_t mBestIndex
 
C_FLOAT64 mBestValue
 
C_FLOAT64 mEvaluationValue
 
CVector< size_t > mLosses
 
CVector< size_t > mPivot
 
unsigned C_INT32 mStopAfterStalledGenerations
 
std::vector< CVector< C_FLOAT64 > * > mVariance
 
double tau1
 
double tau2
 

Additional Inherited Members

- Public Types inherited from CCopasiParameterGroup
typedef CDataObjectMap::const_type_iterator< CCopasiParameterconst_name_iterator
 
typedef std::vector< CCopasiParameter * > elements
 
typedef elements::iterator index_iterator
 
typedef CDataObjectMap::type_iterator< CCopasiParametername_iterator
 
- Public Types inherited from CCopasiParameter
enum class  eUserInterfaceFlag { editable , basic , unsupported , __SIZE }
 
enum class  Type {
  DOUBLE = 0 , UDOUBLE , INT , UINT ,
  BOOL , GROUP , STRING , CN ,
  KEY , FILE , EXPRESSION , INVALID ,
  __SIZE
}
 
typedef CFlags< eUserInterfaceFlagUserInterfaceFlag
 
- Public Types inherited from CDataContainer
typedef CDataObjectMap objectMap
 
- Public Types inherited from CDataObject
typedef std::set< const CDataObject * > DataObjectSet
 
enum  Flag {
  Container , Vector , Matrix , NameVector ,
  Reference , ValueBool , ValueInt , ValueInt64 ,
  ValueDbl , NonUniqueName , StaticString , ValueString ,
  Separator , DisplayName , ModelEntity , Array ,
  DataModel , Root , Gui , __SIZE
}
 
- Public Types inherited from CObjectInterface
typedef std::vector< const CDataContainer * > ContainerList
 
typedef std::set< const CObjectInterface * > ObjectSet
 
- Static Public Member Functions inherited from CCopasiParameter
static void allocateValidValues (const Type &type, void *&pValidValues)
 
static void allocateValue (const Type &type, void *&pValue)
 
static void assignValue (const Type &type, void *&pValue, const void *pNewValue)
 
static void deleteValidValues (const Type &type, void *&pValidValues)
 
static void deleteValue (const Type &type, void *&pValue)
 
static CCopasiParameterfromData (const CData &data, CUndoObjectInterface *pParent)
 
- Static Public Member Functions inherited from CDataContainer
static CDataContainerfromData (const CData &data, CUndoObjectInterface *pParent)
 
- Static Public Member Functions inherited from CDataObject
static CDataObjectfromData (const CData &data, CUndoObjectInterface *pParent)
 
static void sanitizeObjectName (std::string &name)
 
- Static Public Member Functions inherited from CObjectInterface
static const CDataObjectDataObject (const CObjectInterface *pInterface)
 
static CObjectInterfaceGetObjectFromCN (const ContainerList &listOfContainer, const CCommonName &objName)
 
- Static Public Member Functions inherited from CUndoObjectInterface
template<class CType >
static CType * fromData (const CData &, CUndoObjectInterface *)
 
- Static Public Attributes inherited from CCopasiParameter
static const CEnumAnnotation< std::string, TypeTypeName
 
static const CEnumAnnotation< std::string, TypeXMLType
 
- Static Public Attributes inherited from CDataContainer
static const CObjectInterface::ContainerList EmptyList
 
- Protected Member Functions inherited from COptMethod
virtual void signalMathContainerChanged ()
 
- Protected Member Functions inherited from CCopasiMethod
 CCopasiMethod (const CCopasiMethod &src)
 
 CCopasiMethod (const CDataContainer *pParent, const CTaskEnum::Method &methodType, const CTaskEnum::Task &taskType)
 
- Protected Member Functions inherited from CCopasiParameterGroup
 CCopasiParameterGroup ()
 
- Protected Member Functions inherited from CCopasiParameter
 CCopasiParameter (const CCopasiParameter &src)
 
- Protected Member Functions inherited from CDataContainer
template<class CType >
CDataMatrixReference< CType > * addMatrixReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataObjectReference< CType > * addObjectReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataVectorReference< CType > * addVectorReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
 CDataContainer (const CDataContainer &src)
 
void initObjects ()
 
- Protected Member Functions inherited from CDataObject
 CDataObject ()
 
 CDataObject (const std::string &name, const CDataContainer *pParent=static_cast< CDataContainer * >((void *) 0), const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
- Static Protected Member Functions inherited from COptMethod
static std::pair< C_FLOAT64, bool > objectiveValue (COptProblem *pProblem, const CVectorCore< C_FLOAT64 > &parameters)
 
static void reflect (COptProblem *pProblem, const C_FLOAT64 &bestValue, C_FLOAT64 &objectiveValue)
 
- Protected Attributes inherited from COptPopulationMethod
unsigned C_INT32 mCurrentGeneration
 
unsigned C_INT32 mGenerations
 
size_t mhGenerations
 
std::vector< CVector< C_FLOAT64 > * > mIndividuals
 
unsigned C_INT32 mPopulationSize
 
CRandomContext mRandomContext
 
CVector< C_FLOAT64mValues
 
size_t mVariableSize
 
- Protected Attributes inherited from COptMethod
unsigned C_INT32 mLogVerbosity
 
CMathContext mMathContext
 
COptLog mMethodLog
 
bool mParallel
 
COptTaskmpParentTask
 
COptProblemContext mProblemContext
 
- Protected Attributes inherited from CCopasiMethod
CMathContainermpContainer
 
CProcessReportLevel mProcessReport
 
- Protected Attributes inherited from CCopasiParameter
std::string mKey
 
void * mpDefault
 
void * mpValidValues
 
void * mpValue
 
CDataObjectmpValueReference
 
UserInterfaceFlag mUserInterfaceFlag
 
- Protected Attributes inherited from CDataContainer
objectMap mObjects
 
- Protected Attributes inherited from CDataObject
ObjectSet mPrerequisits
 
std::set< CDataContainer * > mReferences
 
- Protected Attributes inherited from CObjectInterface
CValidity mValidity
 

Constructor & Destructor Documentation

◆ COptMethodEP() [1/3]

COptMethodEP::COptMethodEP ( const CDataContainer pParent = NO_PARENT)
private

Default Constructor

◆ COptMethodEP() [2/3]

COptMethodEP::COptMethodEP ( const CDataContainer pParent,
const CTaskEnum::Method methodType = CTaskEnum::Method::EvolutionaryProgram,
const CTaskEnum::Task taskType = CTaskEnum::Task::optimization 
)

Specific constructor

Parameters
constCDataContainer * pParent
constCTaskEnum::Method & methodType (default: EvolutionaryProgram)
constCTaskEnum::Task & taskType (default: optimization)

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

◆ COptMethodEP() [3/3]

COptMethodEP::COptMethodEP ( const COptMethodEP src,
const CDataContainer pParent 
)

Copy Constructor

Parameters
constCOptMethodEP & src

References initObjects().

◆ ~COptMethodEP()

COptMethodEP::~COptMethodEP ( )
virtual

Destructor

References cleanup().

Member Function Documentation

◆ cleanup()

bool COptMethodEP::cleanup ( )
privatevirtual

Cleanup arrays and pointers.

Returns
bool success

Reimplemented from COptPopulationMethod.

References COptPopulationMethod::cleanup(), mVariance, and pdelete.

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

◆ creation()

◆ evaluate()

bool COptMethodEP::evaluate ( const CVector< C_FLOAT64 > &  individual)
private

Evaluate the objective function for the current parameters

Returns
const C_FLOAT64 & objectiveValue

References CContext< Data >::master(), mEvaluationValue, and COptMethod::mProblemContext.

Referenced by creation(), and mutate().

◆ fittest()

size_t COptMethodEP::fittest ( )
private

Find the best individual at this generation

Returns
size_t fittest

References C_FLOAT64, mLosses, COptPopulationMethod::mPopulationSize, and COptPopulationMethod::mValues.

Referenced by optimise().

◆ getMaxLogVerbosity()

unsigned C_INT32 COptMethodEP::getMaxLogVerbosity ( ) const
virtual

Returns the maximum verbosity at which the method can log.

Reimplemented from COptMethod.

◆ initialize()

◆ initObjects()

void COptMethodEP::initObjects ( )
private

Initialize contained objects.

Referenced by COptMethodEP().

◆ mutate()

◆ optimise()

◆ replicate()

bool COptMethodEP::replicate ( )
private

◆ select()

◆ swap()

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

Swap individuals from and to

Parameters
size_tfrom
size_tto
Returns
bool success

References C_FLOAT64, COptPopulationMethod::mIndividuals, mLosses, COptPopulationMethod::mValues, and mVariance.

Referenced by select().

Member Data Documentation

◆ mBestIndex

size_t COptMethodEP::mBestIndex
private

Referenced by optimise().

◆ mBestValue

C_FLOAT64 COptMethodEP::mBestValue
private

The best value found so far.

Referenced by optimise().

◆ mEvaluationValue

C_FLOAT64 COptMethodEP::mEvaluationValue
private

The value of the last evaluation.

Referenced by creation(), evaluate(), and mutate().

◆ mLosses

CVector< size_t > COptMethodEP::mLosses
private

number of wins of each individual in the tournament

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

◆ mPivot

CVector<size_t> COptMethodEP::mPivot
private

Pivot vector used for sorting

Referenced by select().

◆ mStopAfterStalledGenerations

unsigned C_INT32 COptMethodEP::mStopAfterStalledGenerations
private

if no improvement was made after # stalled generations stop

Referenced by initialize(), and optimise().

◆ mVariance

std::vector< CVector < C_FLOAT64 > * > COptMethodEP::mVariance
private

for array of variances w/ variance values for the parameters

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

◆ tau1

double COptMethodEP::tau1
private

Referenced by initialize(), and mutate().

◆ tau2

double COptMethodEP::tau2
private

Referenced by initialize(), and mutate().


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