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

#include <CFitItem.h>

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

Public Member Functions

bool addCrossValidation (const std::string &key)
 
bool addExperiment (const std::string &key)
 
 CFitItem (const CCopasiContainer *pParent, const std::string &name="FitItem")
 
 CFitItem (const CFitItem &src, const CCopasiContainer *pParent=NULL)
 
 CFitItem (const CCopasiParameterGroup &group, const CCopasiContainer *pParent=NULL)
 
virtual C_INT32 checkConstraint () const
 
virtual bool compile (const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
 
virtual bool elevateChildren ()
 
virtual C_FLOAT64 getConstraintViolation () const
 
const std::string & getCrossValidation (const size_t &index) const
 
size_t getCrossValidationCount () const
 
std::string getCrossValidations () const
 
const std::string & getExperiment (const size_t &index) const
 
size_t getExperimentCount () const
 
std::string getExperiments () const
 
const C_FLOAT64getLocalValue () const
 
virtual const C_FLOAT64getObjectValue () const
 
virtual UpdateMethodgetUpdateMethod () const
 
virtual bool isValid () const
 
bool removeCrossValidation (const size_t &index)
 
bool removeExperiment (const size_t &index)
 
void setLocalValue (const C_FLOAT64 &value)
 
bool updateBounds (std::vector< COptItem * >::iterator it)
 
virtual ~CFitItem ()
 
- Public Member Functions inherited from COptItem
C_INT32 checkConstraint (const C_FLOAT64 &value) const
 
bool checkLowerBound (const C_FLOAT64 &value) const
 
bool checkUpperBound (const C_FLOAT64 &value) const
 
 COptItem (const CCopasiContainer *pParent, const std::string &name="OptimizationItem")
 
 COptItem (const COptItem &src, const CCopasiContainer *pParent=NULL)
 
 COptItem (const CCopasiParameterGroup &group, const CCopasiContainer *pParent=NULL)
 
const C_FLOAT64getLastStartValue () const
 
const std::string getLowerBound () const
 
const C_FLOAT64getLowerBoundValue () const
 
const CCopasiObjectgetObject () const
 
const CCopasiObjectName getObjectCN () const
 
std::string getObjectDisplayName () const
 
C_FLOAT64 getRandomValue (CRandom *pRandom=NULL)
 
const C_FLOAT64getStartValue () const
 
const std::string getUpperBound () const
 
const C_FLOAT64getUpperBoundValue () const
 
void rememberStartValue ()
 
bool setLowerBound (const CCopasiObjectName &lowerBound)
 
bool setObjectCN (const CCopasiObjectName &objectCN)
 
bool setStartValue (const C_FLOAT64 &value)
 
bool setUpperBound (const CCopasiObjectName &upperBound)
 
virtual ~COptItem ()
 
- 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 ()
 
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)
 
virtual void print (std::ostream *ostream) const
 
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 ()
 

Static Public Member Functions

static bool isValid (CCopasiParameterGroup &group)
 
- Static Public Member Functions inherited from COptItem
static bool isValid (CCopasiParameterGroup &group)
 
- 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)
 

Protected Member Functions

 CFitItem ()
 
- Protected Member Functions inherited from COptItem
 COptItem ()
 
- 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

C_FLOAT64 mLocalValue
 
CCopasiParameterGroupmpGrpAffectedCrossValidations
 
CCopasiParameterGroupmpGrpAffectedExperiments
 
UpdateMethodmpLocalMethod
 
- Protected Attributes inherited from COptItem
C_FLOAT64 mLastStartValue
 
C_FLOAT64 mLowerBound
 
const C_FLOAT64mpLowerBound
 
const CCopasiObjectmpLowerObject
 
UpdateMethodmpMethod
 
const CCopasiObjectmpObject
 
const C_FLOAT64mpObjectValue
 
std::string * mpParmLowerBound
 
std::string * mpParmObjectCN
 
C_FLOAT64mpParmStartValue
 
std::string * mpParmUpperBound
 
const C_FLOAT64mpUpperBound
 
const CCopasiObjectmpUpperObject
 
C_FLOAT64 mUpperBound
 
- Protected Attributes inherited from CCopasiParameter
std::string mKey
 
CCopasiObjectmpValueReference
 
size_t mSize
 
Value mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 

Private Member Functions

void initializeParameter ()
 

Friends

class CFitProblem
 
std::ostream & operator<< (std::ostream &os, const CFitItem &o)
 

Additional Inherited Members

- 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 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
}
 
- Static Protected Attributes inherited from COptItem
static CRandommpRandom = NULL
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 22 of file CFitItem.h.

Constructor & Destructor Documentation

CFitItem::CFitItem ( )
protected

Default constructor

CFitItem::CFitItem ( const CCopasiContainer pParent,
const std::string &  name = "FitItem" 
)

Specific constructor

Parameters
constCCopasiContainer * pParent (default: NULL)
conststd::string & name (default: FitItem)

Definition at line 27 of file CFitItem.cpp.

References initializeParameter().

28  :
29  COptItem(pParent, name),
32  mLocalValue(0),
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
UpdateMethod * mpLocalMethod
Definition: CFitItem.h:240
void setLocalValue(const C_FLOAT64 &value)
Definition: CFitItem.cpp:169
void initializeParameter()
Definition: CFitItem.cpp:57
CFitItem::CFitItem ( const CFitItem src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCFitItem & src
constCCopasiContainer * pParent (default: src data model)

Definition at line 36 of file CFitItem.cpp.

References initializeParameter().

37  :
38  COptItem(src, pParent),
41  mLocalValue(0),
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
UpdateMethod * mpLocalMethod
Definition: CFitItem.h:240
void setLocalValue(const C_FLOAT64 &value)
Definition: CFitItem.cpp:169
void initializeParameter()
Definition: CFitItem.cpp:57
CFitItem::CFitItem ( const CCopasiParameterGroup group,
const CCopasiContainer pParent = NULL 
)

Specific constructor used for reading COPASI files

Parameters
constCCopasiParameterGroup & group
constCCopasiContainer * pParent (default: group data model)

Definition at line 45 of file CFitItem.cpp.

References initializeParameter().

46  :
47  COptItem(group, pParent),
50  mLocalValue(0),
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
UpdateMethod * mpLocalMethod
Definition: CFitItem.h:240
void setLocalValue(const C_FLOAT64 &value)
Definition: CFitItem.cpp:169
void initializeParameter()
Definition: CFitItem.cpp:57
CFitItem::~CFitItem ( )
virtual

Destructor

Definition at line 54 of file CFitItem.cpp.

References mpLocalMethod, and pdelete.

#define pdelete(p)
Definition: copasi.h:215
UpdateMethod * mpLocalMethod
Definition: CFitItem.h:240

Member Function Documentation

bool CFitItem::addCrossValidation ( const std::string &  key)

Add an experiment to the list of affected cross validations.

Parameters
conststd::string & key
Returns
bool success

Definition at line 234 of file CFitItem.cpp.

References CCopasiParameterGroup::addParameter(), CCopasiParameterGroup::getValue(), CCopasiParameter::KEY, mpGrpAffectedCrossValidations, CCopasiParameter::Value::pKEY, and CCopasiParameterGroup::size().

Referenced by CQFittingItemWidget::save().

235 {
236  size_t i, imax = mpGrpAffectedCrossValidations->size();
237 
238  for (i = 0; i < imax; i++)
239  if (*mpGrpAffectedCrossValidations->getValue(i).pKEY == key) return false; // The key already exists.
240 
241  return mpGrpAffectedCrossValidations->addParameter("Experiment Key", CCopasiParameter::KEY, key);
242 }
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
bool addParameter(const CCopasiParameter &parameter)
const CCopasiParameter::Value & getValue(const std::string &name) const
bool CFitItem::addExperiment ( const std::string &  key)

Add an experiment to the list of affected experiments.

Parameters
conststd::string & key
Returns
bool success

Definition at line 184 of file CFitItem.cpp.

References CCopasiParameterGroup::addParameter(), CCopasiParameterGroup::getValue(), CCopasiParameter::KEY, mpGrpAffectedExperiments, CCopasiParameter::Value::pKEY, and CCopasiParameterGroup::size().

Referenced by CQFittingItemWidget::save(), and CQFittingItemWidget::slotDuplicatePerExperiment().

185 {
186  size_t i, imax = mpGrpAffectedExperiments->size();
187 
188  for (i = 0; i < imax; i++)
189  if (*mpGrpAffectedExperiments->getValue(i).pKEY == key) return false; // The key already exists.
190 
191  return mpGrpAffectedExperiments->addParameter("Experiment Key", CCopasiParameter::KEY, key);
192 }
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
bool addParameter(const CCopasiParameter &parameter)
const CCopasiParameter::Value & getValue(const std::string &name) const
C_INT32 CFitItem::checkConstraint ( ) const
virtual

This functions check whether the current value is within the limits of the optimization item.

Returns
C_INT32 result (-1: to small, 0: within boundaries, 1 to large)

Reimplemented from COptItem.

Reimplemented in CFitConstraint.

Definition at line 111 of file CFitItem.cpp.

References mLocalValue, COptItem::mpLowerBound, and COptItem::mpUpperBound.

Referenced by getConstraintViolation().

112 {
113  if (*mpLowerBound > mLocalValue) return - 1;
114 
115  if (mLocalValue > *mpUpperBound) return 1;
116 
117  return 0;
118 }
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
bool CFitItem::compile ( const std::vector< CCopasiContainer * >  listOfContainer = CCopasiContainer::EmptyList)
virtual

Compile the optimization item. This function must be called before any of the check functions are called.

Parameters
conststd::vector< CCopasiContainer * > listOfContainer
Returns
bool success

Reimplemented from COptItem.

Definition at line 102 of file CFitItem.cpp.

References COptItem::compile(), mLocalValue, and COptItem::mpParmStartValue.

103 {
104  bool success = COptItem::compile(listOfContainer);
105 
107 
108  return success;
109 }
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
virtual bool compile(const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: COptItem.cpp:336
bool CFitItem::elevateChildren ( )
virtual

This methods must be called to elevate subgroups to derived objects. The default implementation does nothing.

Returns
bool success

Reimplemented from CCopasiParameterGroup.

Definition at line 66 of file CFitItem.cpp.

References CCopasiParameterGroup::getParameter(), CCopasiParameter::getValue(), mpGrpAffectedCrossValidations, mpGrpAffectedExperiments, CCopasiParameter::Value::pDOUBLE, CCopasiParameterGroup::removeParameter(), and COptItem::setStartValue().

Referenced by initializeParameter().

67 {
68  // The functionality of SavedValue is no handled more transparently
69  // through the StartValue. Therefore, in case we encounter an old file
70  // we need to copy its value.
71  CCopasiParameter *pSavedValue = getParameter("SavedValue");
72 
73  if (pSavedValue)
74  {
75  setStartValue(*pSavedValue->getValue().pDOUBLE);
76  removeParameter("SavedValue");
77  }
78 
80  elevate<CCopasiParameterGroup, CCopasiParameterGroup>(mpGrpAffectedExperiments);
81 
82  if (!mpGrpAffectedExperiments) return false;
83 
85  elevate<CCopasiParameterGroup, CCopasiParameterGroup>(mpGrpAffectedCrossValidations);
86 
87  if (!mpGrpAffectedCrossValidations) return false;
88 
89  return true;
90 }
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
bool removeParameter(const std::string &name)
const Value & getValue() const
bool setStartValue(const C_FLOAT64 &value)
Definition: COptItem.cpp:192
CCopasiParameter * getParameter(const std::string &name)
C_FLOAT64 CFitItem::getConstraintViolation ( ) const
virtual

Retrieve the magnitude of the constraint violation This is always a positive number

Returns
C_FLOAT64 constraintViolation;

Reimplemented from COptItem.

Reimplemented in CFitConstraint.

Definition at line 120 of file CFitItem.cpp.

References checkConstraint(), mLocalValue, COptItem::mpLowerBound, and COptItem::mpUpperBound.

121 {
122  switch (checkConstraint())
123  {
124  case - 1:
125  return *mpLowerBound - mLocalValue;
126  break;
127 
128  case 1:
129  return mLocalValue - *mpUpperBound;
130  break;
131  }
132 
133  return 0.0;
134 }
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
virtual C_INT32 checkConstraint() const
Definition: CFitItem.cpp:111
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
const std::string & CFitItem::getCrossValidation ( const size_t &  index) const

Retreive the key of the indexed experiment.

Parameters
constsize_t & index
Returns
const std::string & key

Definition at line 244 of file CFitItem.cpp.

References CCopasiParameterGroup::getValue(), mpGrpAffectedCrossValidations, CCopasiParameter::Value::pKEY, and CCopasiParameterGroup::size().

Referenced by CFitProblem::initialize(), CQFittingItemWidget::load(), operator<<(), and CQFittingItemWidget::save().

245 {
246  static const std::string Empty("");
247 
248  if (index < mpGrpAffectedCrossValidations->size())
250 
251  return Empty;
252 }
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
const CCopasiParameter::Value & getValue(const std::string &name) const
size_t CFitItem::getCrossValidationCount ( ) const

Retrieve the number of cross validations

Returns
size_t size

Definition at line 257 of file CFitItem.cpp.

References mpGrpAffectedCrossValidations, and CCopasiParameterGroup::size().

Referenced by CFitProblem::initialize(), CQFittingItemWidget::load(), and CQFittingItemWidget::save().

CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
std::string CFitItem::getCrossValidations ( ) const

Retrieve a string listing all cross validations the item applies to

Returns
std::string crossValidations

Definition at line 260 of file CFitItem.cpp.

References CKeyFactory::get(), CCopasiRootContainer::getKeyFactory(), CCopasiObject::getObjectName(), CCopasiParameterGroup::getValue(), mpGrpAffectedCrossValidations, CCopasiParameter::Value::pKEY, and CCopasiParameterGroup::size().

261 {
262  std::string CrossValidations;
263  size_t i, imax = mpGrpAffectedCrossValidations->size();
264  const CCopasiObject * pObject;
265 
266  for (i = 0; i < imax; i++)
267  {
269 
270  if (i && pObject)
271  CrossValidations += ", ";
272 
273  CrossValidations += pObject->getObjectName();
274  }
275 
276  return CrossValidations;
277 }
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
const std::string & getObjectName() const
CCopasiObject * get(const std::string &key)
static CKeyFactory * getKeyFactory()
const CCopasiParameter::Value & getValue(const std::string &name) const
const std::string & CFitItem::getExperiment ( const size_t &  index) const

Retreive the key of the indexed experiment.

Parameters
constsize_t & index
Returns
const std::string & key

Definition at line 194 of file CFitItem.cpp.

References CCopasiParameterGroup::getValue(), mpGrpAffectedExperiments, CCopasiParameter::Value::pKEY, and CCopasiParameterGroup::size().

Referenced by CFitProblem::initialize(), CQFittingItemWidget::load(), operator<<(), CFitProblem::printResult(), and CQFittingItemWidget::save().

195 {
196  static const std::string Empty("");
197 
198  if (index < mpGrpAffectedExperiments->size())
199  return *mpGrpAffectedExperiments->getValue(index).pKEY;
200 
201  return Empty;
202 }
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
const CCopasiParameter::Value & getValue(const std::string &name) const
size_t CFitItem::getExperimentCount ( ) const

Retrieve the number of experiments

Returns
size_t size

Definition at line 207 of file CFitItem.cpp.

References mpGrpAffectedExperiments, and CCopasiParameterGroup::size().

Referenced by CFitProblem::initialize(), CQFittingItemWidget::load(), CFitProblem::printResult(), and CQFittingItemWidget::save().

208 {return mpGrpAffectedExperiments->size();}
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
std::string CFitItem::getExperiments ( ) const

Retrieve a string listing all experiments the item applies to

Returns
std::string experiments

Definition at line 210 of file CFitItem.cpp.

References CKeyFactory::get(), CCopasiRootContainer::getKeyFactory(), CCopasiObject::getObjectName(), CCopasiParameterGroup::getValue(), mpGrpAffectedExperiments, CCopasiParameter::Value::pKEY, and CCopasiParameterGroup::size().

Referenced by CFitProblem::initialize().

211 {
212  std::string Experiments;
213  size_t i, imax = mpGrpAffectedExperiments->size();
214  const CCopasiObject * pObject;
215 
216  for (i = 0; i < imax; i++)
217  {
219 
220  if (pObject != NULL)
221  {
222  if (i != 0)
223  {
224  Experiments += ", ";
225  }
226 
227  Experiments += pObject->getObjectName();
228  }
229  }
230 
231  return Experiments;
232 }
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
const std::string & getObjectName() const
CCopasiObject * get(const std::string &key)
static CKeyFactory * getKeyFactory()
const CCopasiParameter::Value & getValue(const std::string &name) const
const C_FLOAT64 & CFitItem::getLocalValue ( ) const

Retreive the local value.

Returns
const C_FLOAT64 & value

Definition at line 175 of file CFitItem.cpp.

References mLocalValue.

Referenced by CFitProblem::calculate(), and updateBounds().

176 {return mLocalValue;}
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
const C_FLOAT64 * CFitItem::getObjectValue ( ) const
virtual

Retrieve the value of the optimization object.

Returns
const C_FLOAT64 * objectValue

Reimplemented from COptItem.

Definition at line 178 of file CFitItem.cpp.

References mLocalValue.

179 {return & mLocalValue;}
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
UpdateMethod * CFitItem::getUpdateMethod ( ) const
virtual

Retrieve the update method

Returns
UpdateMethod * pUpdateMethod

Reimplemented from COptItem.

Definition at line 181 of file CFitItem.cpp.

References mpLocalMethod.

182 {return mpLocalMethod;}
UpdateMethod * mpLocalMethod
Definition: CFitItem.h:240
void CFitItem::initializeParameter ( )
private

Allocates all group parameters and assures that they are properly initialized.

Definition at line 57 of file CFitItem.cpp.

References CCopasiParameterGroup::assertGroup(), elevateChildren(), mpGrpAffectedCrossValidations, and mpGrpAffectedExperiments.

Referenced by CFitItem().

58 {
59  mpGrpAffectedExperiments = assertGroup("Affected Experiments");
60 
61  mpGrpAffectedCrossValidations = assertGroup("Affected Cross Validation Experiments");
62 
64 }
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
virtual bool elevateChildren()
Definition: CFitItem.cpp:66
CCopasiParameterGroup * assertGroup(const std::string &name)
bool CFitItem::isValid ( ) const
virtual

Check the validity of the optimization item.

Returns
bool isValid

Reimplemented from COptItem.

Definition at line 92 of file CFitItem.cpp.

References COptItem::isValid().

Referenced by isValid().

93 {return COptItem::isValid();}
virtual bool isValid() const
Definition: COptItem.cpp:316
bool CFitItem::isValid ( CCopasiParameterGroup group)
static

Check whether the group describes a valid optimization item.

Parameters
CCopasiParameterGroup& group
Returns
bool isValid

Definition at line 95 of file CFitItem.cpp.

References isValid().

96 {
97  CFitItem tmp(group);
98 
99  return tmp.isValid();
100 }
bool CFitItem::removeCrossValidation ( const size_t &  index)

Remove the indexed experiment from the affected cross validations

Parameters
constsize_t & index
Returns
bool success

Definition at line 254 of file CFitItem.cpp.

References mpGrpAffectedCrossValidations, and CCopasiParameterGroup::removeParameter().

Referenced by CQFittingItemWidget::save(), and CQFittingItemWidget::slotCrossValidationChanged().

CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
bool removeParameter(const std::string &name)
bool CFitItem::removeExperiment ( const size_t &  index)

Remove the indexed experiment from the affected experiments

Parameters
constsize_t & index
Returns
bool success

Definition at line 204 of file CFitItem.cpp.

References mpGrpAffectedExperiments, and CCopasiParameterGroup::removeParameter().

Referenced by CQFittingItemWidget::save(), CQFittingItemWidget::slotDuplicatePerExperiment(), and CQFittingItemWidget::slotExperimentChanged().

CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
bool removeParameter(const std::string &name)
void CFitItem::setLocalValue ( const C_FLOAT64 value)

Set the local value.

Parameters
constC_FLOAT64 & value

Definition at line 169 of file CFitItem.cpp.

References mLocalValue.

170 {
171  mLocalValue = value;
172  return;
173 }
C_FLOAT64 mLocalValue
Definition: CFitItem.h:235
bool CFitItem::updateBounds ( std::vector< COptItem * >::iterator  it)

Update bounds

Parameters
std::vector<COptItem* >::iterator it
Returns
bool success

Definition at line 279 of file CFitItem.cpp.

References getLocalValue(), COptItem::getLowerBound(), COptItem::getUpperBound(), COptItem::mpLowerBound, COptItem::mpLowerObject, COptItem::mpUpperBound, and COptItem::mpUpperObject.

Referenced by CFitProblem::initialize().

280 {
281  while (*it != this)
282  {
283  if (mpLowerObject && (getLowerBound() == (*it)->getObjectCN()))
284  mpLowerBound = &static_cast<CFitItem *>(*it)->getLocalValue();
285 
286  if (mpUpperObject && (getUpperBound() == (*it)->getObjectCN()))
287  mpUpperBound = &static_cast<CFitItem *>(*it)->getLocalValue();
288 
289  ++it;
290  }
291 
292  return true;
293 }
const std::string getUpperBound() const
Definition: COptItem.cpp:189
const CCopasiObject * mpLowerObject
Definition: COptItem.h:303
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
const C_FLOAT64 & getLocalValue() const
Definition: CFitItem.cpp:175
const CCopasiObject * mpUpperObject
Definition: COptItem.h:318
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
const std::string getLowerBound() const
Definition: COptItem.cpp:164

Friends And Related Function Documentation

friend class CFitProblem
friend

Definition at line 24 of file CFitItem.h.

std::ostream& operator<< ( std::ostream &  os,
const CFitItem o 
)
friend

Output stream operator

Parameters
ostream& os
constCFitItem & A
Returns
ostream & os

Definition at line 136 of file CFitItem.cpp.

137 {
138  os << * static_cast<const COptItem *>(&o) << std::endl;
139 
140  size_t i, imax = o.mpGrpAffectedExperiments->size();
141 
142  os << " Affected Experiments:" << std::endl << " ";
143 
144  if (imax == 0) os << "all";
145 
146  for (i = 0; i < imax; i++)
147  {
148  if (i) os << ", ";
149 
150  os << o.getExperiment(i);
151  }
152 
154 
155  os << " Affected Validation Experiments:" << std::endl << " ";
156 
157  if (imax == 0) os << "all";
158 
159  for (i = 0; i < imax; i++)
160  {
161  if (i) os << ", ";
162 
163  os << o.getCrossValidation(i);
164  }
165 
166  return os;
167 }
const std::string & getExperiment(const size_t &index) const
Definition: CFitItem.cpp:194
CCopasiParameterGroup * mpGrpAffectedCrossValidations
Definition: CFitItem.h:230
CCopasiParameterGroup * mpGrpAffectedExperiments
Definition: CFitItem.h:224
const std::string & getCrossValidation(const size_t &index) const
Definition: CFitItem.cpp:244

Member Data Documentation

C_FLOAT64 CFitItem::mLocalValue
protected

The value for local items, which affect the experiments in the list.

Definition at line 235 of file CFitItem.h.

Referenced by checkConstraint(), compile(), getConstraintViolation(), getLocalValue(), getObjectValue(), and setLocalValue().

CCopasiParameterGroup* CFitItem::mpGrpAffectedCrossValidations
protected

A pointer to the value of the CCopasiParameterGroup holding the list of Affected Validation Experiments

Definition at line 230 of file CFitItem.h.

Referenced by addCrossValidation(), elevateChildren(), getCrossValidation(), getCrossValidationCount(), getCrossValidations(), initializeParameter(), operator<<(), and removeCrossValidation().

CCopasiParameterGroup* CFitItem::mpGrpAffectedExperiments
protected

A pointer to the value of the CCopasiParameterGroup holding the list of AffectedExperiments

Definition at line 224 of file CFitItem.h.

Referenced by addExperiment(), elevateChildren(), getExperiment(), getExperimentCount(), getExperiments(), initializeParameter(), operator<<(), and removeExperiment().

UpdateMethod* CFitItem::mpLocalMethod
protected

A pointer to the local update method

Definition at line 240 of file CFitItem.h.

Referenced by getUpdateMethod(), and ~CFitItem().


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