COPASI API
4.16.103
|
#include <CStochMethod.h>
Public Member Functions | |
CStochMethod (const CStochMethod &src, const CCopasiContainer *pParent=NULL) | |
virtual bool | elevateChildren () |
virtual bool | isValidProblem (const CCopasiProblem *pProblem) |
virtual void | start (const CState *initialState) |
virtual Status | step (const double &deltaT) |
~CStochMethod () | |
![]() | |
CTrajectoryMethod (const CTrajectoryMethod &src, const CCopasiContainer *pParent=NULL) | |
const CVector< C_INT > & | getRoots () const |
void | setCurrentState (CState *currentState) |
void | setProblem (CTrajectoryProblem *problem) |
virtual void | stateChanged () |
~CTrajectoryMethod () | |
![]() | |
CCopasiMethod (const CCopasiMethod &src, const CCopasiContainer *pParent=NULL) | |
const CCopasiMethod::SubType & | getSubType () const |
const CCopasiTask::Type & | getType () 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 () |
![]() | |
bool | addGroup (const std::string &name) |
bool | addParameter (const CCopasiParameter ¶meter) |
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) |
CCopasiParameterGroup * | assertGroup (const std::string &name) |
template<class CType > | |
CCopasiParameter * | assertParameter (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 () |
index_iterator | endIndex () const |
name_iterator | endName () const |
CCopasiParameterGroup * | getGroup (const std::string &name) |
const CCopasiParameterGroup * | getGroup (const std::string &name) const |
CCopasiParameterGroup * | getGroup (const size_t &index) |
const CCopasiParameterGroup * | getGroup (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 CObjectInterface * | getObject (const CCopasiObjectName &cn) const |
CCopasiParameter * | getParameter (const std::string &name) |
const CCopasiParameter * | getParameter (const std::string &name) const |
CCopasiParameter * | getParameter (const size_t &index) |
const CCopasiParameter * | getParameter (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::Value & | getValue (const std::string &name) const |
const CCopasiParameter::Value & | getValue (const size_t &index) const |
CCopasiParameter::Value & | getValue (const std::string &name) |
CCopasiParameter::Value & | getValue (const size_t &index) |
CCopasiParameterGroup & | operator= (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 () |
![]() | |
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::Type & | getType () const |
const Value & | getValue () const |
Value & | getValue () |
virtual void * | getValuePointer () const |
CCopasiObject * | getValueReference () 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 |
CCopasiParameter & | operator= (const CCopasiParameter &rhs) |
template<class CType > | |
bool | setValue (const CType &value) |
bool | setValue (const std::vector< CCopasiParameter * > &value) |
virtual | ~CCopasiParameter () |
![]() | |
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 objectMap & | getObjects () const |
virtual std::string | getUnits () const |
virtual const CCopasiObject * | getValueObject () const |
virtual bool | remove (CCopasiObject *pObject) |
virtual | ~CCopasiContainer () |
![]() | |
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 DataObjectSet & | getDirectDependencies (const DataObjectSet &context=DataObjectSet()) const |
CCopasiContainer * | getObjectAncestor (const std::string &type) const |
CCopasiDataModel * | getObjectDataModel () |
const CCopasiDataModel * | getObjectDataModel () const |
const std::string & | getObjectName () const |
CCopasiContainer * | getObjectParent () const |
const std::string & | getObjectType () const |
virtual const CObjectInterface::ObjectSet & | getPrerequisites () const |
virtual Refresh * | getRefresh () const |
UpdateMethod * | getUpdateMethod () 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 () |
![]() | |
CObjectInterface () | |
virtual | ~CObjectInterface () |
Protected Member Functions | |
C_INT32 | calculateAmu (size_t reaction_index) |
CStochMethod (const CCopasiContainer *pParent=NULL) | |
virtual C_FLOAT64 | doSingleStep (C_FLOAT64 time, C_FLOAT64 endtime)=0 |
size_t | generateReactionIndex () |
C_FLOAT64 | generateReactionTime () |
C_FLOAT64 | generateReactionTime (size_t reaction_index) |
virtual void | initMethod (C_FLOAT64 start_time)=0 |
void | setupDependencyGraphAndBalances () |
C_INT32 | updatePropensities () |
C_INT32 | updateSystemState (size_t reaction_index, const C_FLOAT64 &time) |
![]() | |
CTrajectoryMethod (const CCopasiMethod::SubType &subType, const CCopasiContainer *pParent=NULL) | |
![]() | |
CCopasiMethod (const CCopasiTask::Type &taskType, const SubType &subType, const CCopasiContainer *pParent=NULL) | |
![]() | |
CCopasiParameterGroup () | |
![]() | |
template<class CType > | |
CCopasiObject * | addMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
void | initObjects () |
![]() | |
CCopasiObject () | |
CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0) | |
Static Protected Member Functions | |
static bool | modelHasAssignments (const CModel *pModel) |
Protected Attributes | |
C_FLOAT64 | mA0 |
std::vector< C_FLOAT64 > | mAmu |
std::vector< C_FLOAT64 > | mAmuOld |
CDependencyGraph | mDG |
bool | mDoCorrection |
size_t | mFirstMetabIndex |
bool | mHasAssignments |
std::vector< std::vector < CStochBalance > > | mLocalBalances |
std::vector< std::vector < CStochBalance > > | mLocalSubstrates |
std::vector< C_INT64 > | mNumbers |
size_t | mNumReactions |
CModel * | mpModel |
CRandom * | mpRandomGenerator |
![]() | |
CState * | mpCurrentState |
CTrajectoryProblem * | mpProblem |
CVector< C_INT > | mRoots |
![]() | |
CProcessReport * | mpCallBack |
![]() | |
std::string | mKey |
CCopasiObject * | mpValueReference |
size_t | mSize |
Value | mValue |
![]() | |
objectMap | mObjects |
Private Member Functions | |
std::set< std::string > * | getAffects (size_t reaction_index) |
std::set< std::string > * | getDependsOn (size_t reaction_index) |
void | initializeParameter () |
Static Private Member Functions | |
static C_INT32 | checkModel (CModel *pmodel) |
Private Attributes | |
C_INT32 | mMaxBalance |
C_INT64 | mMaxIntBeforeStep |
size_t | mMaxSteps |
bool | mMaxStepsReached |
Friends | |
CTrajectoryMethod * | CTrajectoryMethod::createMethod (CCopasiMethod::SubType subType) |
Definition at line 47 of file CStochMethod.h.
|
protected |
Default constructor.
const | CCopasiContainer * pParent (default: NULL) |
Definition at line 48 of file CStochMethod.cpp.
References CRandom::createGenerator(), initializeParameter(), mpRandomGenerator, and CRandom::mt19937.
CStochMethod::CStochMethod | ( | const CStochMethod & | src, |
const CCopasiContainer * | pParent = NULL |
||
) |
Copy constructor.
const | CStochMethod & src, |
const | CCopasiContainer * pParent (Default: NULL) |
Definition at line 55 of file CStochMethod.cpp.
References CRandom::createGenerator(), initializeParameter(), mpRandomGenerator, and CRandom::mt19937.
CStochMethod::~CStochMethod | ( | ) |
|
protected |
Calculate one of the propensities
Definition at line 237 of file CStochMethod.cpp.
References C_FLOAT64, C_INT32, C_INT64, CModel::getReactions(), mAmu, mDoCorrection, mLocalSubstrates, mNumbers, and mpModel.
Referenced by updatePropensities(), and updateSystemState().
This checks if a model is suitable for stochastic simulation. It returns a suggestion which method to use
model | The model to check |
Definition at line 42 of file CStochMethod.cpp.
|
protectedpure virtual |
Do one iteration of the simulation
Implemented in CStochNextReactionMethod.
Referenced by step().
|
virtual |
This methods must be called to elevate subgroups to derived objects. The default implementation does nothing.
Reimplemented from CCopasiParameterGroup.
Definition at line 104 of file CStochMethod.cpp.
References initializeParameter().
|
protected |
Generate the index of a putative reaction.
Definition at line 389 of file CStochMethod.cpp.
References C_FLOAT64, CRandom::getRandomOO(), CModel::getReactions(), mA0, mAmu, mpModel, mpRandomGenerator, and CCopasiVector< T >::size().
|
protected |
Generate the putative time taken before any reaction takes place
Definition at line 408 of file CStochMethod.cpp.
References C_FLOAT64, CRandom::getRandomOO(), mA0, and mpRandomGenerator.
Referenced by CStochNextReactionMethod::setupPriorityQueue(), and CStochNextReactionMethod::updatePriorityQueue().
|
protected |
Generate the putative time taken before a special reaction takes place
Definition at line 416 of file CStochMethod.cpp.
References C_FLOAT64, CRandom::getRandomOO(), mAmu, and mpRandomGenerator.
|
private |
Get the set of metabolites which change number when a given reaction is executed.
reaction_index | The index of the reaction being executed. |
Definition at line 560 of file CStochMethod.cpp.
References CModelEntity::FIXED, CCopasiParameter::getKey(), CModel::getReactions(), mpModel, and CCopasiVector< T >::size().
Referenced by setupDependencyGraphAndBalances().
|
private |
Get the set of metabolites on which a given reaction depends.
reaction_index | The index of the reaction being executed. |
Definition at line 534 of file CStochMethod.cpp.
References CModel::getReactions(), mpModel, CFunctionParameter::PARAMETER, and CCopasiVector< T >::size().
Referenced by setupDependencyGraphAndBalances().
|
private |
Intialize the method parameter
Definition at line 69 of file CStochMethod.cpp.
References CCopasiParameterGroup::assertParameter(), CCopasiParameter::BOOL, C_INT32, CCopasiParameterGroup::getParameter(), CCopasiParameter::getValue(), CCopasiParameter::INT, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pINT, CCopasiParameter::Value::pUINT, CCopasiParameterGroup::removeParameter(), CCopasiParameterGroup::setValue(), and CCopasiParameter::UINT.
Referenced by CStochMethod(), and elevateChildren().
|
virtual |
Check if the method is suitable for this problem
Reimplemented from CTrajectoryMethod.
Definition at line 583 of file CStochMethod.cpp.
References CCopasiMessage::ERROR, CModel::getCompartments(), CTrajectoryProblem::getDuration(), CModel::getEvents(), CModel::getMetabolites(), CCopasiProblem::getModel(), CModel::getModelValues(), CModel::getNumMetabs(), CModel::getNumModelValues(), CModel::getTotSteps(), CCopasiParameter::getValue(), CTrajectoryMethod::isValidProblem(), MCTrajectoryMethod, CModelEntity::ODE, CCopasiParameter::Value::pINT, CCopasiVector< T >::size(), and CModel::suitableForStochasticSimulation().
|
staticprotected |
tests if the model contains a global value with an assignment rule that is used in calculations
Definition at line 676 of file CStochMethod.cpp.
References CModelEntity::ASSIGNMENT, CModel::getCompartments(), CModel::getMetabolites(), CModel::getModelValues(), CModel::getNumMetabs(), CModel::getNumModelValues(), and CCopasiVector< T >::size().
Referenced by start().
|
protected |
Set up the dependency graph and the balances
Definition at line 424 of file CStochMethod.cpp.
References CDependencyGraph::addDependent(), C_INT32, CDependencyGraph::clear(), CModelEntity::FIXED, getAffects(), getDependsOn(), CCopasiVector< T >::getIndex(), CModel::getMetabolitesX(), CModel::getReactions(), max, mDG, CStochBalance::mIndex, mLocalBalances, mLocalSubstrates, mMaxBalance, mMaxIntBeforeStep, mMaxSteps, CStochBalance::mMultiplicity, mNumReactions, mpModel, CDependencyGraph::resize(), and CCopasiVector< T >::size().
Referenced by start().
This instructs the method to prepare for integration starting with the initialState given.
const CState * | initialState |
Reimplemented from CTrajectoryMethod.
Definition at line 160 of file CStochMethod.cpp.
References C_FLOAT64, C_INT32, C_INT64, CModel::deterministic, CStateTemplate::getIndex(), CModel::getMetabolitesX(), CCopasiProblem::getModel(), CModel::getModelType(), CModel::getReactions(), CModel::getStateTemplate(), CState::getTime(), CCopasiParameter::getValue(), CRandom::initialize(), initMethod(), mAmu, mAmuOld, mDoCorrection, mFirstMetabIndex, mHasAssignments, mMaxSteps, mMaxStepsReached, mNumbers, mNumReactions, modelHasAssignments(), CTrajectoryMethod::mpCurrentState, mpModel, CTrajectoryMethod::mpProblem, mpRandomGenerator, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pINT, CCopasiParameter::Value::pUINT, setupDependencyGraphAndBalances(), CCopasiVector< T >::size(), updatePropensities(), and CModel::updateSimulatedValues().
|
virtual |
This instructs the method to calculate a time step of deltaT starting with the current state, i.e., the result of the previous step. The new state (after deltaT) is expected in the current state. The return value is the actual timestep taken.
const double & | deltaT |
Reimplemented from CTrajectoryMethod.
Definition at line 110 of file CStochMethod.cpp.
References CState::beginIndependent(), C_FLOAT64, doSingleStep(), CCopasiMessage::EXCEPTION, CModel::getMetabolitesX(), CCopasiProblem::getModel(), CModel::getNumVariableMetabs(), CModel::getState(), CState::getTime(), MCTrajectoryMethod, mFirstMetabIndex, mMaxIntBeforeStep, mMaxSteps, CTrajectoryMethod::mpCurrentState, CTrajectoryMethod::mpProblem, CTrajectoryMethod::NORMAL, and CState::setTime().
|
protected |
Calculate the propensities for all reactions
Definition at line 222 of file CStochMethod.cpp.
References calculateAmu(), mA0, mAmu, mAmuOld, and mNumReactions.
Referenced by start(), and updateSystemState().
Update the particle numbers according to which reaction ocurred
Definition at line 317 of file CStochMethod.cpp.
References CModelEntity::ASSIGNMENT, C_FLOAT64, C_INT64, calculateAmu(), CDependencyGraph::getDependents(), CModel::getMetabolitesX(), mA0, mAmu, mAmuOld, mDG, mHasAssignments, mLocalBalances, mNumbers, mpModel, CMetab::refreshConcentration(), CModel::setTime(), CModelEntity::setValue(), updatePropensities(), and CModel::updateSimulatedValues().
Referenced by CStochNextReactionMethod::doSingleStep().
|
friend |
|
protected |
The sum of the propensities
Definition at line 62 of file CStochMethod.h.
Referenced by generateReactionIndex(), generateReactionTime(), updatePropensities(), and updateSystemState().
|
protected |
The propensities for the reactions
Definition at line 57 of file CStochMethod.h.
Referenced by calculateAmu(), generateReactionIndex(), generateReactionTime(), start(), CStochNextReactionMethod::updatePriorityQueue(), updatePropensities(), and updateSystemState().
|
protected |
The stored propensities for the reactions before the last update
Definition at line 67 of file CStochMethod.h.
Referenced by start(), CStochNextReactionMethod::updatePriorityQueue(), updatePropensities(), and updateSystemState().
|
protected |
The graph of reactions and their dependent reactions. When a reaction is executed, the propensities for each of its dependents must be updated.
Definition at line 252 of file CStochMethod.h.
Referenced by setupDependencyGraphAndBalances(), CStochNextReactionMethod::updatePriorityQueue(), and updateSystemState().
|
protected |
indicates if the correction N^2 -> N*(N-1) should be performed
Definition at line 72 of file CStochMethod.h.
Referenced by calculateAmu(), and start().
|
protected |
index of first metab in a CState
Definition at line 274 of file CStochMethod.h.
|
protected |
Indicates whether the model has global quantities with assignment rules. If it has, we will use a less efficient way to update the model state to handle this.
Definition at line 79 of file CStochMethod.h.
Referenced by start(), CStochNextReactionMethod::updatePriorityQueue(), and updateSystemState().
|
protected |
The balances of the reactions as integers
Definition at line 257 of file CStochMethod.h.
Referenced by setupDependencyGraphAndBalances(), and updateSystemState().
|
protected |
the substrates of each reaction with their multiplicities
Definition at line 262 of file CStochMethod.h.
Referenced by calculateAmu(), and setupDependencyGraphAndBalances().
|
private |
maximal increase of a particle number in one step.
Definition at line 169 of file CStochMethod.h.
Referenced by setupDependencyGraphAndBalances().
|
private |
This is set to maxint - mMaxSteps*mMaxBalance
Definition at line 174 of file CStochMethod.h.
Referenced by setupDependencyGraphAndBalances(), and step().
|
private |
max number of single stochastic steps to do in one step()
Definition at line 164 of file CStochMethod.h.
Referenced by setupDependencyGraphAndBalances(), start(), and step().
|
private |
Definition at line 176 of file CStochMethod.h.
Referenced by start().
|
protected |
The particle numbers
Definition at line 267 of file CStochMethod.h.
Referenced by calculateAmu(), start(), and updateSystemState().
|
protected |
Definition at line 269 of file CStochMethod.h.
Referenced by setupDependencyGraphAndBalances(), start(), CStochNextReactionMethod::updatePriorityQueue(), and updatePropensities().
|
protected |
A pointer to the instance of CModel being used.
Definition at line 246 of file CStochMethod.h.
Referenced by calculateAmu(), generateReactionIndex(), getAffects(), getDependsOn(), setupDependencyGraphAndBalances(), CStochNextReactionMethod::setupPriorityQueue(), start(), and updateSystemState().
|
protected |
The random number generator
Definition at line 241 of file CStochMethod.h.
Referenced by CStochMethod(), generateReactionIndex(), generateReactionTime(), start(), and ~CStochMethod().