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

#include <COptItem.h>

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

Public Member Functions

virtual C_INT32 checkConstraint () const
 
C_INT32 checkConstraint (const C_FLOAT64 &value) const
 
bool checkLowerBound (const C_FLOAT64 &value) const
 
bool checkUpperBound (const C_FLOAT64 &value) const
 
virtual bool compile (const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
 
 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)
 
virtual C_FLOAT64 getConstraintViolation () const
 
const C_FLOAT64getLastStartValue () const
 
const std::string getLowerBound () const
 
const C_FLOAT64getLowerBoundValue () const
 
const CCopasiObjectgetObject () const
 
const CCopasiObjectName getObjectCN () const
 
std::string getObjectDisplayName () const
 
virtual const C_FLOAT64getObjectValue () const
 
C_FLOAT64 getRandomValue (CRandom *pRandom=NULL)
 
const C_FLOAT64getStartValue () const
 
virtual UpdateMethodgetUpdateMethod () const
 
const std::string getUpperBound () const
 
const C_FLOAT64getUpperBoundValue () const
 
virtual bool isValid () 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 ()
 
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)
 
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 CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 

Protected Member Functions

 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 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
 

Static Protected Attributes

static CRandommpRandom = NULL
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Private Member Functions

bool compileLowerBound (const std::vector< CCopasiContainer * > &listOfContainer)
 
bool compileUpperBound (const std::vector< CCopasiContainer * > &listOfContainer)
 
void initializeParameter ()
 

Friends

std::ostream & operator<< (std::ostream &os, const COptItem &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
}
 

Detailed Description

Definition at line 29 of file COptItem.h.

Constructor & Destructor Documentation

COptItem::COptItem ( )
protected

Default constructor

COptItem::COptItem ( const CCopasiContainer pParent,
const std::string &  name = "OptimizationItem" 
)

Specific constructor

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

Definition at line 39 of file COptItem.cpp.

References initializeParameter().

40  :
41  CCopasiParameterGroup(name, pParent),
42  mpParmObjectCN(NULL),
43  mpParmLowerBound(NULL),
44  mpParmUpperBound(NULL),
45  mpParmStartValue(NULL),
46  mpObject(NULL),
47  mpMethod(NULL),
48  mpObjectValue(NULL),
49  mpLowerObject(NULL),
50  mpLowerBound(NULL),
51  mLowerBound(0.0),
52  mpUpperObject(NULL),
53  mpUpperBound(NULL),
54  mUpperBound(0.0),
55  mLastStartValue(std::numeric_limits< C_FLOAT64 >::quiet_NaN())
const CCopasiObject * mpLowerObject
Definition: COptItem.h:303
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
UpdateMethod * mpMethod
Definition: COptItem.h:293
const CCopasiObject * mpUpperObject
Definition: COptItem.h:318
const CCopasiObject * mpObject
Definition: COptItem.h:288
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
std::string * mpParmUpperBound
Definition: COptItem.h:278
std::string * mpParmLowerBound
Definition: COptItem.h:273
C_FLOAT64 mUpperBound
Definition: COptItem.h:328
void initializeParameter()
Definition: COptItem.cpp:99
C_FLOAT64 mLastStartValue
Definition: COptItem.h:333
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
std::string * mpParmObjectCN
Definition: COptItem.h:268
C_FLOAT64 mLowerBound
Definition: COptItem.h:313
COptItem::COptItem ( const COptItem src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

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

Definition at line 58 of file COptItem.cpp.

References initializeParameter().

59  :
60  CCopasiParameterGroup(src, (pParent != NULL) ? pParent : src.getObjectDataModel()),
61  mpParmObjectCN(NULL),
62  mpParmLowerBound(NULL),
63  mpParmUpperBound(NULL),
64  mpParmStartValue(NULL),
65  mpObject(NULL),
66  mpMethod(NULL),
67  mpObjectValue(NULL),
68  mpLowerObject(NULL),
69  mpLowerBound(NULL),
70  mLowerBound(0.0),
71  mpUpperObject(NULL),
72  mpUpperBound(NULL),
73  mUpperBound(0.0),
CCopasiDataModel * getObjectDataModel()
const CCopasiObject * mpLowerObject
Definition: COptItem.h:303
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
UpdateMethod * mpMethod
Definition: COptItem.h:293
const CCopasiObject * mpUpperObject
Definition: COptItem.h:318
const CCopasiObject * mpObject
Definition: COptItem.h:288
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
std::string * mpParmUpperBound
Definition: COptItem.h:278
std::string * mpParmLowerBound
Definition: COptItem.h:273
C_FLOAT64 mUpperBound
Definition: COptItem.h:328
void initializeParameter()
Definition: COptItem.cpp:99
C_FLOAT64 mLastStartValue
Definition: COptItem.h:333
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
std::string * mpParmObjectCN
Definition: COptItem.h:268
C_FLOAT64 mLowerBound
Definition: COptItem.h:313
COptItem::COptItem ( 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 77 of file COptItem.cpp.

References initializeParameter().

78  :
79  CCopasiParameterGroup(group, (pParent != NULL) ? pParent : group.getObjectDataModel()),
80  mpParmObjectCN(NULL),
81  mpParmLowerBound(NULL),
82  mpParmUpperBound(NULL),
83  mpParmStartValue(NULL),
84  mpObject(NULL),
85  mpMethod(NULL),
86  mpObjectValue(NULL),
87  mpLowerObject(NULL),
88  mpLowerBound(NULL),
89  mLowerBound(0.0),
90  mpUpperObject(NULL),
91  mpUpperBound(NULL),
92  mUpperBound(0.0),
93  mLastStartValue(std::numeric_limits< C_FLOAT64 >::quiet_NaN())
CCopasiDataModel * getObjectDataModel()
const CCopasiObject * mpLowerObject
Definition: COptItem.h:303
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
UpdateMethod * mpMethod
Definition: COptItem.h:293
const CCopasiObject * mpUpperObject
Definition: COptItem.h:318
const CCopasiObject * mpObject
Definition: COptItem.h:288
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
std::string * mpParmUpperBound
Definition: COptItem.h:278
std::string * mpParmLowerBound
Definition: COptItem.h:273
C_FLOAT64 mUpperBound
Definition: COptItem.h:328
void initializeParameter()
Definition: COptItem.cpp:99
C_FLOAT64 mLastStartValue
Definition: COptItem.h:333
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
std::string * mpParmObjectCN
Definition: COptItem.h:268
C_FLOAT64 mLowerBound
Definition: COptItem.h:313
COptItem::~COptItem ( )
virtual

Destructor

Definition at line 96 of file COptItem.cpp.

97 {}

Member Function Documentation

C_INT32 COptItem::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 in CFitConstraint, and CFitItem.

Definition at line 401 of file COptItem.cpp.

References mpLowerBound, mpObjectValue, and mpUpperBound.

Referenced by COptMethodHookeJeeves::bestNearby(), COptMethodSS::combination(), COptMethodPS::create(), COptMethodDE::creation(), COptMethodEP::creation(), COptMethodSRES::creation(), COptMethodGA::creation(), COptMethodSS::creation(), getConstraintViolation(), COptMethodPS::move(), COptMethodEP::mutate(), COptMethodGA::mutate(), COptMethodSRES::mutate(), COptMethodDE::optimise(), COptMethodGA::optimise(), COptMethodPS::optimise(), COptMethodHookeJeeves::optimise(), COptMethodCoranaWalk::optimise(), COptMethodSA::optimise(), COptMethodLevenbergMarquardt::optimise(), COptMethodNelderMead::optimise(), COptMethodPraxis::optimise(), COptMethodTruncatedNewton::optimise(), COptMethodStatistics::optimise(), COptMethodSteepestDescent::optimise(), CRandomSearch::optimise(), COptMethodSS::randomize(), and COptMethodDE::replicate().

402 {
403  if (*mpLowerBound > *mpObjectValue) return - 1;
404 
405  if (*mpObjectValue > *mpUpperBound) return 1;
406 
407  return 0;
408 }
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
C_INT32 COptItem::checkConstraint ( const C_FLOAT64 value) const

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

Parameters
constC_FLOAT64 & value
Returns
C_INT32 result (-1: to small, 0: within boundaries, 1 to large)

Definition at line 426 of file COptItem.cpp.

References mpLowerBound, and mpUpperBound.

427 {
428  if (*mpLowerBound > value) return - 1;
429 
430  if (value > *mpUpperBound) return 1;
431 
432  return 0;
433 }
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
bool COptItem::checkLowerBound ( const C_FLOAT64 value) const

Checks whether the value fulfills the lower bound constraint.

Parameters
constC_FLOAT64 & value
Returns
bool fulfills

Definition at line 435 of file COptItem.cpp.

References mpLowerBound.

Referenced by COptMethodEP::creation(), COptMethodSRES::creation(), and CRandomSearch::optimise().

436 {return *mpLowerBound <= value;}
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
bool COptItem::checkUpperBound ( const C_FLOAT64 value) const

Checks whether the value fulfills the upper bound constraint.

Parameters
constC_FLOAT64 & value
Returns
bool fulfills

Definition at line 438 of file COptItem.cpp.

References mpUpperBound.

Referenced by COptMethodEP::creation(), COptMethodSRES::creation(), and CRandomSearch::optimise().

439 {return value <= *mpUpperBound;}
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
bool COptItem::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 in CFitItem.

Definition at line 336 of file COptItem.cpp.

References CCopasiObject::addDirectDependency(), C_FLOAT64, CCopasiObject::clearDirectDependencies(), compileLowerBound(), compileUpperBound(), DoNothing, CCopasiMessage::ERROR, getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::getObjectDisplayName(), CCopasiObject::getUpdateMethod(), CCopasiObject::getValuePointer(), CCopasiObject::isValueDbl(), MCOptimization, mpLowerBound, mpLowerObject, mpMethod, mpObject, mpObjectValue, mpParmLowerBound, mpParmStartValue, mpParmUpperBound, mpUpperBound, mpUpperObject, and NaN.

Referenced by CFitItem::compile(), getObjectDisplayName(), and getRandomValue().

337 {
338  bool success = true;
340 
341  std::string Bound;
342 
343  mpMethod = &DoNothing;
344  mpObjectValue = &NaN;
345 
346  if ((mpObject =
347  getObjectDataModel()->ObjectFromName(listOfContainer,
348  getObjectCN())) != NULL &&
349  mpObject->isValueDbl())
351 
352  if (mpObjectValue == &NaN)
353  {
355  success = false;
356  }
357  else
358  {
361  }
362 
363  if (compileLowerBound(listOfContainer))
364  {
365  if (mpLowerObject != NULL)
366  {
368  }
369  }
370  else
371  {
373  success = false;
374  }
375 
376  if (compileUpperBound(listOfContainer))
377  {
378  if (mpUpperObject != NULL)
379  {
381  }
382  }
383  else
384  {
386  success = false;
387  }
388 
390  {
392  success = false;
393  }
394 
395  if (isnan(*mpParmStartValue))
397 
398  return success;
399 }
CCopasiDataModel * getObjectDataModel()
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
void clearDirectDependencies()
UpdateMethod * getUpdateMethod() const
UpdateMethod DoNothing
Definition: COptItem.cpp:35
const CCopasiObjectName getObjectCN() const
Definition: COptItem.cpp:131
const CCopasiObject * mpLowerObject
Definition: COptItem.h:303
#define MCOptimization
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
bool compileLowerBound(const std::vector< CCopasiContainer * > &listOfContainer)
Definition: COptItem.cpp:444
void addDirectDependency(const CCopasiObject *pObject)
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
UpdateMethod * mpMethod
Definition: COptItem.h:293
const CCopasiObject * mpUpperObject
Definition: COptItem.h:318
const CCopasiObject * mpObject
Definition: COptItem.h:288
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
std::string * mpParmUpperBound
Definition: COptItem.h:278
std::string * mpParmLowerBound
Definition: COptItem.h:273
C_FLOAT64 NaN
Definition: COptItem.cpp:33
#define C_FLOAT64
Definition: copasi.h:92
bool isValueDbl() const
virtual void * getValuePointer() const
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
bool compileUpperBound(const std::vector< CCopasiContainer * > &listOfContainer)
Definition: COptItem.cpp:474
bool COptItem::compileLowerBound ( const std::vector< CCopasiContainer * > &  listOfContainer)
private

Compile the lower bound to hold the value given by the bound

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

Definition at line 444 of file COptItem.cpp.

References C_FLOAT64, CCopasiObject::getObjectDataModel(), CCopasiObject::getValuePointer(), isNumber(), CCopasiObject::isValueDbl(), max, mLowerBound, mpLowerBound, mpLowerObject, mpParmLowerBound, and strToDouble().

Referenced by compile(), and setLowerBound().

445 {
446  const CCopasiDataModel * pDataModel = getObjectDataModel();
447 
448  assert(pDataModel != NULL);
449 
450  mpLowerObject = NULL;
451  mpLowerBound = NULL;
452 
453  if (*mpParmLowerBound == "-inf")
454  {
457  }
458  else if (isNumber(*mpParmLowerBound))
459  {
460  mLowerBound = strToDouble(mpParmLowerBound->c_str(), NULL);
462  }
463  else if ((mpLowerObject =
464  getObjectDataModel()->ObjectFromName(listOfContainer,
465  *mpParmLowerBound)) != NULL &&
467  {
469  }
470 
471  return mpLowerBound != NULL;
472 }
CCopasiDataModel * getObjectDataModel()
bool isNumber(const std::string &str)
Definition: utility.cpp:75
const CCopasiObject * mpLowerObject
Definition: COptItem.h:303
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
std::string * mpParmLowerBound
Definition: COptItem.h:273
double strToDouble(const char *str, char const **pTail)
Definition: utility.cpp:325
#define C_FLOAT64
Definition: copasi.h:92
bool isValueDbl() const
virtual void * getValuePointer() const
C_FLOAT64 mLowerBound
Definition: COptItem.h:313
#define max(a, b)
Definition: f2c.h:176
bool COptItem::compileUpperBound ( const std::vector< CCopasiContainer * > &  listOfContainer)
private

Compile the upper bound to hold the value given by the bound

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

Definition at line 474 of file COptItem.cpp.

References CCopasiObject::addDirectDependency(), C_FLOAT64, CCopasiObject::getObjectDataModel(), CCopasiObject::getValuePointer(), isNumber(), CCopasiObject::isValueDbl(), max, mpParmUpperBound, mpUpperBound, mpUpperObject, mUpperBound, and strToDouble().

Referenced by compile(), and setUpperBound().

475 {
476  const CCopasiDataModel * pDataModel = getObjectDataModel();
477 
478  assert(pDataModel != NULL);
479 
480  mpUpperObject = NULL;
481  mpUpperBound = NULL;
482 
483  if (*mpParmUpperBound == "inf")
484  {
487  }
488  else if (isNumber(*mpParmUpperBound))
489  {
490  mUpperBound = strToDouble(mpParmUpperBound->c_str(), NULL);
492  }
493  else if ((mpUpperObject =
494  getObjectDataModel()->ObjectFromName(listOfContainer,
495  *mpParmUpperBound)) != NULL &&
497  {
500  }
501 
502  return mpUpperBound != NULL;
503 }
CCopasiDataModel * getObjectDataModel()
bool isNumber(const std::string &str)
Definition: utility.cpp:75
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
void addDirectDependency(const CCopasiObject *pObject)
const CCopasiObject * mpUpperObject
Definition: COptItem.h:318
std::string * mpParmUpperBound
Definition: COptItem.h:278
C_FLOAT64 mUpperBound
Definition: COptItem.h:328
double strToDouble(const char *str, char const **pTail)
Definition: utility.cpp:325
#define C_FLOAT64
Definition: copasi.h:92
bool isValueDbl() const
virtual void * getValuePointer() const
#define max(a, b)
Definition: f2c.h:176
C_FLOAT64 COptItem::getConstraintViolation ( ) const
virtual

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

Returns
C_FLOAT64 constraintViolation;

Reimplemented in CFitConstraint, and CFitItem.

Definition at line 410 of file COptItem.cpp.

References checkConstraint(), mpLowerBound, mpObjectValue, and mpUpperBound.

411 {
412  switch (checkConstraint())
413  {
414  case - 1:
415  return *mpLowerBound - *mpObjectValue;
416  break;
417 
418  case 1:
419  return *mpObjectValue - *mpUpperBound;
420  break;
421  }
422 
423  return 0.0;
424 }
virtual C_INT32 checkConstraint() const
Definition: COptItem.cpp:401
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
const C_FLOAT64 & COptItem::getLastStartValue ( ) const

Retrieve the start value use in the last optimization.

Returns
const C_FLOAT64 & startValue

Definition at line 220 of file COptItem.cpp.

References mLastStartValue.

Referenced by CQFittingResult::enterProtected().

221 {
222  return mLastStartValue;
223 }
C_FLOAT64 mLastStartValue
Definition: COptItem.h:333
const std::string COptItem::getLowerBound ( ) const

Retrieve the lower bound.

Returns
const std::string lowerBound

Definition at line 164 of file COptItem.cpp.

References mpParmLowerBound.

Referenced by CQFittingResult::enterProtected(), isValid(), CQFittingItemWidget::loadSelection(), operator<<(), CQFittingItemWidget::setTableText(), and CFitItem::updateBounds().

165 {return *mpParmLowerBound;}
std::string * mpParmLowerBound
Definition: COptItem.h:273
const C_FLOAT64* COptItem::getLowerBoundValue ( ) const
inline
const CCopasiObject * COptItem::getObject ( ) const

Retrieve the item object. This may only be called after compile

Returns
const CCopasiObject *

Definition at line 128 of file COptItem.cpp.

References mpObject.

Referenced by CFitProblem::initialize().

129 {return mpObject;}
const CCopasiObject * mpObject
Definition: COptItem.h:288
const CCopasiObjectName COptItem::getObjectCN ( ) const

Retrieve the object of the optimization item.

Returns
const CCopasiObjectName objectCN

Definition at line 131 of file COptItem.cpp.

References mpParmObjectCN.

Referenced by compile(), getStartValue(), isValid(), CQFittingItemWidget::load(), CQFittingItemWidget::loadSelection(), and CQFittingItemWidget::setTableText().

132 {return *mpParmObjectCN;}
std::string * mpParmObjectCN
Definition: COptItem.h:268
std::string COptItem::getObjectDisplayName ( ) const

Retrieve the display name of the optimization item.

Returns
std::string displayName

Definition at line 134 of file COptItem.cpp.

References compile(), CCopasiObject::getObjectDisplayName(), and mpObject.

Referenced by CFitProblem::initialize().

135 {
136  if (!mpObject && !const_cast<COptItem *>(this)->compile())
137  return "Invalid Optimization Item";
138 
139  return mpObject->getObjectDisplayName();
140 }
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
virtual bool compile(const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: COptItem.cpp:336
const CCopasiObject * mpObject
Definition: COptItem.h:288
const C_FLOAT64 * COptItem::getObjectValue ( ) const
virtual

Retrieve the value of the optimization object.

Returns
const C_FLOAT64 * objectValue

Reimplemented in CFitItem.

Definition at line 441 of file COptItem.cpp.

References mpObjectValue.

442 {return mpObjectValue;}
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
C_FLOAT64 COptItem::getRandomValue ( CRandom pRandom = NULL)

Retrieve a random value in the interval (lower bound, upper bound). Optionally one may provide a random number generator to be used to create the random value.

Parameters
CRandom* pRandom (default: NULL)
Returns
C_FLOAT64 randomValue

Definition at line 230 of file COptItem.cpp.

References C_FLOAT64, compile(), CRandom::createGenerator(), CRandom::getRandomCC(), CRandom::getRandomNormal(), max, min, mpLowerBound, mpRandom, mpUpperBound, and NaN.

Referenced by CRandomSearch::optimise().

231 {
232  C_FLOAT64 RandomValue;
233 
234  if (mpLowerBound == NULL ||
235  mpUpperBound == NULL) compile();
236 
237  if (mpLowerBound == NULL ||
238  mpUpperBound == NULL)
239  {
240  RandomValue = NaN;
241  return RandomValue;
242  }
243 
244  if (pRandom == NULL)
245  {
246  if (mpRandom == NULL)
248 
249  pRandom = mpRandom;
250  }
251 
252  C_FLOAT64 mn = *mpLowerBound;
253  C_FLOAT64 mx = *mpUpperBound;
254 
255  C_FLOAT64 la;
256 
257  try
258  {
259  // First determine the location of the interval
260  // Secondly determine whether to distribute the parameter linearly or not
261  // depending on the location and act upon it.
262  if (0.0 <= mn) // the interval [mn, mx) is in [0, inf)
263  {
264  la = log10(mx) - log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min()));
265 
266  if (la < 1.8 || !(mn > 0.0)) // linear
267  RandomValue = mn + pRandom->getRandomCC() * (mx - mn);
268  else
269  RandomValue = pow(10.0, log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min())) + la * pRandom->getRandomCC());
270  }
271  else if (mx > 0) // 0 is in the interval (mn, mx)
272  {
273  la = log10(mx) + log10(-mn);
274 
275  if (la < 3.6) // linear
276  RandomValue = mn + pRandom->getRandomCC() * (mx - mn);
277  else
278  {
279  C_FLOAT64 mean = (mx + mn) * 0.5;
280  C_FLOAT64 sigma = std::min(std::numeric_limits< C_FLOAT64 >::max(), mx - mn) / 3.0;
281 
282  do
283  {
284  RandomValue = pRandom->getRandomNormal(mean, sigma);
285  }
286  while ((RandomValue < mn) || (RandomValue > mx));
287  }
288  }
289  else // the interval (mn, mx] is in (-inf, 0]
290  {
291  // Switch lower and upper bound and change sign, i.e.,
292  // we can treat it similarly as location 1:
293  mx = - *mpLowerBound;
294  mn = - *mpUpperBound;
295 
296  la = log10(mx) - log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min()));
297 
298  if (la < 1.8 || !(mn > 0.0)) // linear
299  RandomValue = - (mn + pRandom->getRandomCC() * (mx - mn));
300  else
301  RandomValue = - pow(10.0, log10(std::max(mn, std::numeric_limits< C_FLOAT64 >::min())) + la * pRandom->getRandomCC());
302  }
303  }
304 
305  catch (...)
306  {
307  RandomValue = (mx + mn) * 0.5;
308  }
309 
310  return RandomValue;
311 }
virtual C_FLOAT64 getRandomNormal(const C_FLOAT64 &mean, const C_FLOAT64 &sd)
Definition: CRandom.cpp:292
static CRandom * mpRandom
Definition: COptItem.h:338
const C_FLOAT64 * mpUpperBound
Definition: COptItem.h:323
static CRandom * createGenerator(CRandom::Type type=CRandom::mt19937, unsigned C_INT32 seed=0)
Definition: CRandom.cpp:49
virtual C_FLOAT64 getRandomCC()
Definition: CRandom.cpp:235
virtual bool compile(const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: COptItem.cpp:336
const C_FLOAT64 * mpLowerBound
Definition: COptItem.h:308
C_FLOAT64 NaN
Definition: COptItem.cpp:33
#define C_FLOAT64
Definition: copasi.h:92
#define min(a, b)
Definition: f2c.h:175
#define max(a, b)
Definition: f2c.h:176
const C_FLOAT64 & COptItem::getStartValue ( ) const

Retrieve the start value of the optimization object.

Returns
const C_FLOAT64 & startValue

Definition at line 199 of file COptItem.cpp.

References C_FLOAT64, CCopasiDataModel::getDataObject(), getObjectCN(), CCopasiObject::getObjectDataModel(), CCopasiObject::getValuePointer(), mpObjectValue, mpParmStartValue, and NaN.

Referenced by COptMethodEP::creation(), COptMethodSRES::creation(), COptMethodSS::creation(), CQFittingItemWidget::loadSelection(), operator<<(), COptMethodDE::optimise(), COptMethodGA::optimise(), COptMethodPS::optimise(), COptMethodHookeJeeves::optimise(), COptMethodCoranaWalk::optimise(), COptMethodLevenbergMarquardt::optimise(), COptMethodNelderMead::optimise(), COptMethodSA::optimise(), COptMethodPraxis::optimise(), COptMethodTruncatedNewton::optimise(), COptMethodStatistics::optimise(), COptMethodSteepestDescent::optimise(), CRandomSearch::optimise(), rememberStartValue(), setLowerBound(), CQFittingItemWidget::setTableText(), and setUpperBound().

200 {
201  if (!isnan(*mpParmStartValue))
202  return *mpParmStartValue;
203 
204  if (mpObjectValue == NULL)
205  {
206  const CCopasiDataModel* pDataModel = getObjectDataModel();
207  assert(pDataModel != NULL);
208  const CCopasiObject * pObject = pDataModel->getDataObject(getObjectCN());
209 
210  if (pObject != NULL &&
211  pObject->getValuePointer() != NULL)
212  return *(C_FLOAT64 *) pObject->getValuePointer();
213 
214  return NaN;
215  }
216 
217  return *mpObjectValue;
218 }
CCopasiDataModel * getObjectDataModel()
CCopasiObject * getDataObject(const CCopasiObjectName &CN) const
const CCopasiObjectName getObjectCN() const
Definition: COptItem.cpp:131
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
C_FLOAT64 NaN
Definition: COptItem.cpp:33
#define C_FLOAT64
Definition: copasi.h:92
virtual void * getValuePointer() const
const C_FLOAT64 * mpObjectValue
Definition: COptItem.h:298
UpdateMethod * COptItem::getUpdateMethod ( ) const
virtual

Retrieve the update method

Returns
UpdateMethod * pUpdateMethod

Reimplemented in CFitItem.

Definition at line 313 of file COptItem.cpp.

References mpMethod.

314 {return mpMethod;}
UpdateMethod * mpMethod
Definition: COptItem.h:293
const std::string COptItem::getUpperBound ( ) const

Retrieve the upper bound.

Returns
const std::string upperBound

Definition at line 189 of file COptItem.cpp.

References mpParmUpperBound.

Referenced by CQFittingResult::enterProtected(), isValid(), CQFittingItemWidget::loadSelection(), operator<<(), CQFittingItemWidget::setTableText(), and CFitItem::updateBounds().

190 {return *mpParmUpperBound;}
std::string * mpParmUpperBound
Definition: COptItem.h:278
const C_FLOAT64* COptItem::getUpperBoundValue ( ) const
inline
void COptItem::initializeParameter ( )
private

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

Definition at line 99 of file COptItem.cpp.

References CCopasiParameterGroup::assertParameter(), CCopasiParameter::CN, CCopasiParameter::DOUBLE, CCopasiParameter::getValue(), mpParmLowerBound, mpParmObjectCN, mpParmStartValue, mpParmUpperBound, NaN, CCopasiParameter::Value::pCN, and CCopasiParameter::Value::pDOUBLE.

Referenced by COptItem().

100 {
109 }
CRegisteredObjectName * pCN
const Value & getValue() const
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
std::string * mpParmUpperBound
Definition: COptItem.h:278
std::string * mpParmLowerBound
Definition: COptItem.h:273
C_FLOAT64 NaN
Definition: COptItem.cpp:33
CCopasiParameter * assertParameter(const std::string &name, const CCopasiParameter::Type type, const CType &defaultValue)
std::string * mpParmObjectCN
Definition: COptItem.h:268
bool COptItem::isValid ( ) const
virtual

Check the validity of the optimization item.

Reimplemented in CFitItem.

Definition at line 316 of file COptItem.cpp.

References getLowerBound(), getObjectCN(), getUpperBound(), setLowerBound(), setObjectCN(), and setUpperBound().

Referenced by CFitItem::isValid(), and isValid().

317 {
318  COptItem *pTmp = const_cast<COptItem *>(this);
319 
320  if (!pTmp->setObjectCN(getObjectCN())) return false;
321 
322  if (!pTmp->setLowerBound(getLowerBound())) return false;
323 
324  if (!pTmp->setUpperBound(getUpperBound())) return false;
325 
326  return true;
327 }
const CCopasiObjectName getObjectCN() const
Definition: COptItem.cpp:131
bool setLowerBound(const CCopasiObjectName &lowerBound)
Definition: COptItem.cpp:142
const std::string getUpperBound() const
Definition: COptItem.cpp:189
bool setObjectCN(const CCopasiObjectName &objectCN)
Definition: COptItem.cpp:111
bool setUpperBound(const CCopasiObjectName &upperBound)
Definition: COptItem.cpp:167
const std::string getLowerBound() const
Definition: COptItem.cpp:164
bool COptItem::isValid ( CCopasiParameterGroup group)
static

Check whether the group describes a valid optimization item.

Returns
bool isValid

Definition at line 329 of file COptItem.cpp.

References isValid().

330 {
331  COptItem tmp(group);
332 
333  return tmp.isValid();
334 }
void COptItem::rememberStartValue ( )

Remember the current start value

Definition at line 225 of file COptItem.cpp.

References getStartValue(), and mLastStartValue.

226 {
228 }
const C_FLOAT64 & getStartValue() const
Definition: COptItem.cpp:199
C_FLOAT64 mLastStartValue
Definition: COptItem.h:333
bool COptItem::setLowerBound ( const CCopasiObjectName lowerBound)

Set the lower bound.

Parameters
constCCopasiObjectName & lowerBound
Returns
bool success

Definition at line 142 of file COptItem.cpp.

References C_FLOAT64, compileLowerBound(), CCopasiContainer::EmptyList, getStartValue(), isNumber(), mpParmLowerBound, and strToDouble().

Referenced by isValid(), and CQFittingItemWidget::saveSelection().

143 {
144  if (lowerBound[0] == '-' &&
145  lowerBound[lowerBound.length() - 1] == '%' &&
146  isNumber(lowerBound.substr(1, lowerBound.length() - 2)))
147  {
148  std::stringstream LowerBound;
149  C_FLOAT64 StartValue = getStartValue();
150 
151  LowerBound << StartValue + fabs(StartValue) * strToDouble(lowerBound.c_str(), NULL) / 100.0;
152  *mpParmLowerBound = LowerBound.str();
153 
154  return true;
155  }
156  else
157  {
158  *mpParmLowerBound = lowerBound;
159  }
160 
162 }
bool isNumber(const std::string &str)
Definition: utility.cpp:75
bool compileLowerBound(const std::vector< CCopasiContainer * > &listOfContainer)
Definition: COptItem.cpp:444
static const std::vector< CCopasiContainer * > EmptyList
std::string * mpParmLowerBound
Definition: COptItem.h:273
const C_FLOAT64 & getStartValue() const
Definition: COptItem.cpp:199
double strToDouble(const char *str, char const **pTail)
Definition: utility.cpp:325
#define C_FLOAT64
Definition: copasi.h:92
bool COptItem::setObjectCN ( const CCopasiObjectName objectCN)

Set the object of the optimization item.

Parameters
constCCopasiObjectName & objectCN
Returns
bool success

Definition at line 111 of file COptItem.cpp.

References CCopasiMessage::ERROR, CCopasiDataModel::getDataObject(), CCopasiObject::getObjectDataModel(), CCopasiObject::isValueDbl(), MCOptimization, and mpParmObjectCN.

Referenced by COptProblem::addOptItem(), isValid(), and CQFittingItemWidget::slotParamEdit().

112 {
113  const CCopasiDataModel * pDataModel = getObjectDataModel();
114  assert(pDataModel != NULL);
115 
116  const CCopasiObject * pObject = pDataModel->getDataObject(objectCN);
117 
118  if (pObject == NULL || !pObject->isValueDbl())
119  {
120  CCopasiMessage(CCopasiMessage::ERROR, MCOptimization + 1, objectCN.c_str());
121  return false;
122  }
123 
124  *mpParmObjectCN = objectCN;
125  return true;
126 }
CCopasiDataModel * getObjectDataModel()
CCopasiObject * getDataObject(const CCopasiObjectName &CN) const
#define MCOptimization
bool isValueDbl() const
std::string * mpParmObjectCN
Definition: COptItem.h:268
bool COptItem::setStartValue ( const C_FLOAT64 value)

Set the value start value.

Parameters
constC_FLOAT64 & startValue
Returns
bool success

Definition at line 192 of file COptItem.cpp.

References mpParmStartValue.

Referenced by CFitItem::elevateChildren(), and CQFittingItemWidget::saveSelection().

193 {
194  *mpParmStartValue = value;
195 
196  return true;
197 }
C_FLOAT64 * mpParmStartValue
Definition: COptItem.h:283
bool COptItem::setUpperBound ( const CCopasiObjectName upperBound)

Set the upper bound.

Parameters
constCCopasiObjectName & upperBound
Returns
bool success

Definition at line 167 of file COptItem.cpp.

References C_FLOAT64, compileUpperBound(), CCopasiContainer::EmptyList, getStartValue(), isNumber(), mpParmUpperBound, and strToDouble().

Referenced by isValid(), and CQFittingItemWidget::saveSelection().

168 {
169  if (upperBound[0] == '+' &&
170  upperBound[upperBound.length() - 1] == '%' &&
171  isNumber(upperBound.substr(1, upperBound.length() - 2)))
172  {
173  std::stringstream UpperBound;
174  C_FLOAT64 StartValue = getStartValue();
175 
176  UpperBound << StartValue + fabs(StartValue) * strToDouble(upperBound.c_str(), NULL) / 100.0;
177  *mpParmUpperBound = UpperBound.str();
178 
179  return true;
180  }
181  else
182  {
183  *mpParmUpperBound = upperBound;
184  }
185 
187 }
bool isNumber(const std::string &str)
Definition: utility.cpp:75
static const std::vector< CCopasiContainer * > EmptyList
std::string * mpParmUpperBound
Definition: COptItem.h:278
const C_FLOAT64 & getStartValue() const
Definition: COptItem.cpp:199
double strToDouble(const char *str, char const **pTail)
Definition: utility.cpp:325
#define C_FLOAT64
Definition: copasi.h:92
bool compileUpperBound(const std::vector< CCopasiContainer * > &listOfContainer)
Definition: COptItem.cpp:474

Friends And Related Function Documentation

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

Output stream operator

Parameters
ostream& os
constCOptItem & A
Returns
ostream & os

Definition at line 505 of file COptItem.cpp.

506 {
507  if (o.mpObject == NULL && !const_cast<COptItem *>(&o)->compile())
508  return os << "Invalid Optimization Item";
509 
510  if (o.mpLowerObject)
512  else
513  os << o.getLowerBound();
514 
515  os << " <= ";
516  os << o.mpObject->getObjectDisplayName();
517  os << " <= ";
518 
519  if (o.mpUpperObject)
521  else
522  os << o.getUpperBound();
523 
524  os << "; Start Value = " << o.getStartValue();
525 
526  return os;
527 }
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
const std::string getUpperBound() const
Definition: COptItem.cpp:189
const CCopasiObject * mpLowerObject
Definition: COptItem.h:303
const CCopasiObject * mpUpperObject
Definition: COptItem.h:318
const CCopasiObject * mpObject
Definition: COptItem.h:288
const C_FLOAT64 & getStartValue() const
Definition: COptItem.cpp:199
const std::string getLowerBound() const
Definition: COptItem.cpp:164

Member Data Documentation

C_FLOAT64 COptItem::mLastStartValue
protected

The start value use for last calculation

Definition at line 333 of file COptItem.h.

Referenced by getLastStartValue(), and rememberStartValue().

C_FLOAT64 COptItem::mLowerBound
protected

The value of the lower bound (only if not on object)

Definition at line 313 of file COptItem.h.

Referenced by compileLowerBound().

const C_FLOAT64* COptItem::mpLowerBound
protected
const CCopasiObject* COptItem::mpLowerObject
protected

A pointer to the object for the lower bound

Definition at line 303 of file COptItem.h.

Referenced by compile(), compileLowerBound(), operator<<(), and CFitItem::updateBounds().

UpdateMethod* COptItem::mpMethod
protected

A pointer to the object update method

Definition at line 293 of file COptItem.h.

Referenced by compile(), and getUpdateMethod().

const CCopasiObject* COptItem::mpObject
protected

A pointer to the object

Definition at line 288 of file COptItem.h.

Referenced by compile(), getObject(), getObjectDisplayName(), and operator<<().

const C_FLOAT64* COptItem::mpObjectValue
protected
std::string* COptItem::mpParmLowerBound
protected

A pointer to the value of the CCopasiParameter holding the LowerBound

Definition at line 273 of file COptItem.h.

Referenced by compile(), compileLowerBound(), getLowerBound(), initializeParameter(), and setLowerBound().

std::string* COptItem::mpParmObjectCN
protected

A pointer to the value of the CCopasiParameter holding the ObjectCN

Definition at line 268 of file COptItem.h.

Referenced by getObjectCN(), initializeParameter(), and setObjectCN().

C_FLOAT64* COptItem::mpParmStartValue
protected

A pointer to the value of the CCopasiParameter holding the start value

Definition at line 283 of file COptItem.h.

Referenced by CFitItem::compile(), compile(), getStartValue(), initializeParameter(), and setStartValue().

std::string* COptItem::mpParmUpperBound
protected

A pointer to the value of the CCopasiParameter holding the UpperBound

Definition at line 278 of file COptItem.h.

Referenced by compile(), compileUpperBound(), getUpperBound(), initializeParameter(), and setUpperBound().

CRandom * COptItem::mpRandom = NULL
staticprotected

A pointer to the random number generator used in randomizeStartValue

Definition at line 338 of file COptItem.h.

Referenced by getRandomValue().

const C_FLOAT64* COptItem::mpUpperBound
protected
const CCopasiObject* COptItem::mpUpperObject
protected

A pointer to the object for the upper bound

Definition at line 318 of file COptItem.h.

Referenced by compile(), compileUpperBound(), operator<<(), and CFitItem::updateBounds().

C_FLOAT64 COptItem::mUpperBound
protected

The value of the upper bound (only if not on object)

Definition at line 328 of file COptItem.h.

Referenced by compileUpperBound().


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