COPASI API
4.16.103
|
#include <COptProblem.h>
Public Member Functions | |
COptItem & | addOptItem (const CCopasiObjectName &objectCN) |
virtual bool | calculate () |
virtual bool | calculateStatistics (const C_FLOAT64 &factor=1.0e-003, const C_FLOAT64 &resolution=1.0e-009) |
virtual bool | checkFunctionalConstraints () |
virtual bool | checkParametricConstraints () |
COptProblem (const CCopasiTask::Type &type=CCopasiTask::optimization, const CCopasiContainer *pParent=NULL) | |
COptProblem (const COptProblem &src, const CCopasiContainer *pParent=NULL) | |
virtual bool | elevateChildren () |
const bool & | getCalculateStatistics () const |
const C_FLOAT64 & | getCalculateValue () const |
const std::vector < UpdateMethod * > & | getCalculateVariableUpdateMethods () const |
const std::vector< COptItem * > & | getConstraintList () const |
const C_FLOAT64 & | getExecutionTime () const |
const unsigned C_INT32 & | getFunctionEvaluations () const |
const std::string | getObjectiveFunction () |
COptItem & | getOptItem (const size_t &index) |
const std::vector< COptItem * > & | getOptItemList () const |
size_t | getOptItemSize () const |
const bool & | getRandomizeStartValues () const |
const C_FLOAT64 & | getSolutionValue () const |
const CVector< C_FLOAT64 > & | getSolutionVariables () const |
CCopasiTask::Type | getSubtaskType () const |
const CVector< C_FLOAT64 > & | getVariableGradients () const |
size_t | getVariableSize () const |
void | incrementEvaluations (unsigned C_INT32 increment) |
virtual bool | initialize () |
virtual bool | initializeSubtaskBeforeOutput () |
const bool & | maximize () const |
virtual void | print (std::ostream *ostream) const |
virtual void | printResult (std::ostream *ostream) const |
void | randomizeStartValues () |
void | rememberStartValues () |
bool | removeOptItem (const size_t &index) |
void | reset () |
void | resetEvaluations () |
virtual bool | restore (const bool &updateModel) |
void | restoreModel (const bool &updateModel) |
void | setCalculateStatistics (const bool &calculate) |
virtual bool | setCallBack (CProcessReport *pCallBack) |
void | setMaximize (const bool &maximize) |
virtual bool | setModel (CModel *pModel) |
bool | setObjectiveFunction (const std::string &infix) |
void | setRandomizeStartValues (const bool &randomize) |
virtual bool | setSolution (const C_FLOAT64 &value, const CVector< C_FLOAT64 > &variables) |
bool | setSubtaskType (const CCopasiTask::Type &subtaskType) |
bool | swapOptItem (const size_t &iFrom, const size_t &iTo) |
virtual | ~COptProblem () |
![]() | |
CCopasiProblem (const CCopasiProblem &src, const CCopasiContainer *pParent=NULL) | |
CModel * | getModel () const |
const CCopasiTask::Type & | getType () const |
virtual | ~CCopasiProblem () |
![]() | |
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 () |
Static Public Attributes | |
static const unsigned int | ValidSubtasks [] |
![]() | |
static const std::string | TypeName [] |
static const char * | XMLType [] |
![]() | |
static const std::vector < CCopasiContainer * > | EmptyList |
Private Member Functions | |
void | initializeParameter () |
void | initObjects () |
Friends | |
std::ostream & | operator<< (std::ostream &os, const COptProblem &o) |
Additional Inherited Members | |
![]() | |
typedef parameterGroup::iterator | index_iterator |
typedef CCopasiContainer::objectMap::iterator | name_iterator |
typedef std::vector < CCopasiParameter * > | parameterGroup |
![]() | |
enum | Type { DOUBLE = 0, UDOUBLE, INT, UINT, BOOL, GROUP, STRING, CN, KEY, FILE, EXPRESSION, INVALID } |
![]() | |
typedef std::multimap < std::string, CCopasiObject * > | objectMap |
![]() | |
typedef std::set< const CCopasiObject * > | DataObjectSet |
typedef std::vector< Refresh * > | DataUpdateSequence |
![]() | |
typedef std::set< const CObjectInterface * > | ObjectSet |
typedef std::vector < CObjectInterface * > | UpdateSequence |
![]() | |
static std::vector< Refresh * > | buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet()) |
static void | setRenameHandler (CRenameHandler *rh) |
![]() | |
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 } |
![]() | |
CCopasiProblem (const CCopasiTask::Type &type, 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 CRenameHandler * | smpRenameHandler = NULL |
Definition at line 49 of file COptProblem.h.
COptProblem::COptProblem | ( | const CCopasiTask::Type & | type = CCopasiTask::optimization , |
const CCopasiContainer * | pParent = NULL |
||
) |
Default constructor
const | CCopasiTask::Type & type (default: optimization) |
const | CCopasiContainer * pParent (default: NULL) |
Definition at line 67 of file COptProblem.cpp.
References initializeParameter(), and initObjects().
COptProblem::COptProblem | ( | const COptProblem & | src, |
const CCopasiContainer * | pParent = NULL |
||
) |
Copy constructor.
const | COptProblem & src |
const | CCopasiContainer * pParent (default: NULL) |
Definition at line 106 of file COptProblem.cpp.
References initializeParameter(), and initObjects().
|
virtual |
COptItem & COptProblem::addOptItem | ( | const CCopasiObjectName & | objectCN | ) |
Add an optimization item to the problem.
const | CCopasiObjectName & objectCN |
Definition at line 708 of file COptProblem.cpp.
References CCopasiParameterGroup::addParameter(), CCopasiObject::getObjectDataModel(), mpGrpItems, and COptItem::setObjectCN().
|
virtual |
Do the calculating based on CalculateVariables and fill CalculateResults with the results.
calculate() decides whether the problem is a steady state problem or a trajectory problem based on whether the pointer to that type of problem is null or not. It then calls the process() method for that type of problem. Currently process takes ofstream& as a parameter but it will change so that process() takes no parameters.
Reimplemented in CFitProblem, and CRealProblem.
Definition at line 538 of file COptProblem.cpp.
References CExpression::calcValue(), CCopasiMessage::getLastMessage(), CCopasiTask::getProblem(), CCopasiTask::getType(), CCopasiTask::initialize(), mCalculateValue, mCounter, mFailedCounter, mhCounter, mInitialRefreshMethods, CCopasiProblem::mpCallBack, mpObjectiveExpression, mpParmMaximize, mpSubtask, mRefreshMethods, mStoreResults, CCopasiTask::NO_OUTPUT, CCopasiTask::ONLY_TIME_SERIES, pdelete, CCopasiTask::process(), CProcessReport::progressItem(), and CCopasiTask::timeCourse.
Referenced by calculateStatistics(), COptMethodEP::evaluate(), COptMethodStatistics::evaluate(), COptMethodSteepestDescent::evaluate(), CRandomSearch::evaluate(), COptMethodDE::evaluate(), COptMethodSRES::evaluate(), COptMethodPS::evaluate(), COptMethodGA::evaluate(), COptMethodHookeJeeves::evaluate(), COptMethodGASR::evaluate(), COptMethodLevenbergMarquardt::evaluate(), COptMethodNelderMead::evaluate(), COptMethodCoranaWalk::evaluate(), COptMethodSA::evaluate(), COptMethodSS::evaluate(), COptMethodPraxis::evaluate(), COptMethodTruncatedNewton::evaluate(), COptMethodEP2::optimise(), and setCalculateStatistics().
|
virtual |
Calculate the statistics for the problem
const | C_FLOAT64 & factor (Default: 1.0e-003) |
const | C_FLOAT64 & resolution (Default: 1.0e-009) |
Reimplemented in CFitProblem.
Definition at line 609 of file COptProblem.cpp.
References C_FLOAT64, calculate(), CCopasiObject::getRefresh(), mCalculateValue, mCPUTime, mGradient, mHaveStatistics, mpParmCalculateStatistics, mpParmMaximize, mSolutionValue, mSolutionVariables, mStoreResults, mUpdateMethods, mWorstValue, CVector< CType >::resize(), and CVectorCore< CType >::size().
Referenced by COptTask::process().
|
virtual |
Check whether all functional constraints are fulfilled.
Reimplemented in CFitProblem.
Definition at line 507 of file COptProblem.cpp.
References mConstraintCounter, mFailedConstraintCounter, mpConstraintItems, and mRefreshConstraints.
Referenced by COptMethodEP::evaluate(), COptMethodStatistics::evaluate(), COptMethodSteepestDescent::evaluate(), CRandomSearch::evaluate(), COptMethodDE::evaluate(), COptMethodPS::evaluate(), COptMethodGA::evaluate(), COptMethodHookeJeeves::evaluate(), COptMethodSA::evaluate(), COptMethodNelderMead::evaluate(), COptMethodCoranaWalk::evaluate(), COptMethodLevenbergMarquardt::evaluate(), COptMethodSS::evaluate(), COptMethodPraxis::evaluate(), COptMethodTruncatedNewton::evaluate(), COptMethodSA::optimise(), and COptMethodCoranaWalk::optimise().
|
virtual |
Check whether all parameters are within their boundaries.
Definition at line 496 of file COptProblem.cpp.
References mpOptItems.
Referenced by COptMethodSteepestDescent::evaluate(), COptMethodHookeJeeves::evaluate(), COptMethodNelderMead::evaluate(), COptMethodLevenbergMarquardt::evaluate(), COptMethodPraxis::evaluate(), COptMethodTruncatedNewton::evaluate(), COptMethodSA::optimise(), and COptMethodCoranaWalk::optimise().
|
virtual |
This methods must be called to elevate subgroups to derived objects. The default implementation does nothing.
Reimplemented from CCopasiParameterGroup.
Reimplemented in CFitProblem.
Definition at line 167 of file COptProblem.cpp.
References C_INVALID_INDEX, CCopasiRootContainer::getFunctionList(), CCopasiVectorN< CType >::getIndex(), CEvaluationTree::getInfix(), CCopasiParameterGroup::getParameter(), CCopasiParameter::getValue(), CFunctionDB::loadedFunctions(), mpConstraintItems, mpGrpConstraints, mpGrpItems, mpOptItems, mpParmObjectiveExpression, mpParmSubtaskCN, CCopasiParameter::Value::pSTRING, CCopasiParameterGroup::removeParameter(), setObjectiveFunction(), setSubtaskType(), CCopasiTask::steadyState, and CCopasiTask::timeCourse.
Referenced by CFitProblem::elevateChildren(), and initializeParameter().
const bool & COptProblem::getCalculateStatistics | ( | ) | const |
Retrieve whether we have to calculate statistics
Definition at line 838 of file COptProblem.cpp.
References mpParmCalculateStatistics.
Referenced by CQFittingResult::enterProtected(), CQFittingWidget::loadTask(), CQOptimizationWidget::loadTask(), CQFittingWidget::saveTask(), and CQOptimizationWidget::saveTask().
const C_FLOAT64 & COptProblem::getCalculateValue | ( | ) | const |
Retrieve the result of a calculation
Definition at line 673 of file COptProblem.cpp.
References mCalculateValue.
Referenced by COptMethodEP::evaluate(), COptMethodStatistics::evaluate(), COptMethodSteepestDescent::evaluate(), CRandomSearch::evaluate(), COptMethodDE::evaluate(), COptMethodSRES::evaluate(), COptMethodPS::evaluate(), COptMethodGA::evaluate(), COptMethodHookeJeeves::evaluate(), COptMethodSA::evaluate(), COptMethodNelderMead::evaluate(), COptMethodCoranaWalk::evaluate(), COptMethodGASR::evaluate(), COptMethodLevenbergMarquardt::evaluate(), COptMethodSS::evaluate(), COptMethodPraxis::evaluate(), and COptMethodTruncatedNewton::evaluate().
const std::vector< UpdateMethod * > & COptProblem::getCalculateVariableUpdateMethods | ( | ) | const |
Retrieve the update methods for the variables for calculation.
Definition at line 734 of file COptProblem.cpp.
References mUpdateMethods.
Referenced by COptMethod::initialize(), and COptMethodEP2::optimise().
const std::vector< COptItem * > & COptProblem::getConstraintList | ( | ) | const |
Retrieve the list of constraints.
Definition at line 731 of file COptProblem.cpp.
References mpConstraintItems.
Referenced by COptMethod::initialize().
const C_FLOAT64 & COptProblem::getExecutionTime | ( | ) | const |
Retrieve the objective function.
Definition at line 850 of file COptProblem.cpp.
References CCopasiTimer::getElapsedTimeSeconds(), and mCPUTime.
Referenced by CQOptimizationResult::enterProtected(), CQFittingResultTab1::load(), CQOptimizationResult::slotSave(), and CQFittingResult::slotSave().
const unsigned C_INT32 & COptProblem::getFunctionEvaluations | ( | ) | const |
Retrieve the evaluation counter.
Definition at line 841 of file COptProblem.cpp.
References mCounter.
Referenced by CQOptimizationResult::enterProtected(), CQFittingResult::enterProtected(), CQFittingResultTab1::load(), COptMethodSS::localmin(), CQOptimizationResult::slotSave(), and CQFittingResult::slotSave().
const std::string COptProblem::getObjectiveFunction | ( | ) |
Retrieve the objective function.
Definition at line 747 of file COptProblem.cpp.
References mpParmObjectiveExpression.
Referenced by CQOptimizationWidget::loadTask(), and CQOptimizationWidget::saveTask().
COptItem & COptProblem::getOptItem | ( | const size_t & | index | ) |
Retrieve the 'index' optimization item.
const | size_t & index |
Definition at line 702 of file COptProblem.cpp.
const std::vector< COptItem * > & COptProblem::getOptItemList | ( | ) | const |
Retrieve the list of optimization parameters.
Definition at line 728 of file COptProblem.cpp.
References mpOptItems.
Referenced by CQOptimizationResult::enterProtected(), CQFittingResult::enterProtected(), COptMethod::initialize(), and COptMethodSS::localmin().
size_t COptProblem::getOptItemSize | ( | ) | const |
Retrieve the number of optimization items.
Definition at line 705 of file COptProblem.cpp.
References mpGrpItems, and CCopasiParameterGroup::size().
const bool & COptProblem::getRandomizeStartValues | ( | ) | const |
Retrieve whether we have to calculate statistics
Definition at line 803 of file COptProblem.cpp.
References mpParmRandomizeStartValues.
Referenced by CQFittingWidget::loadTask(), CQOptimizationWidget::loadTask(), CQFittingWidget::saveTask(), and CQOptimizationWidget::saveTask().
const C_FLOAT64 & COptProblem::getSolutionValue | ( | ) | const |
Retrieve the result for the solution
Definition at line 699 of file COptProblem.cpp.
References mSolutionValue.
Referenced by CQOptimizationResult::enterProtected(), CQFittingResultTab1::load(), COptMethodSS::localmin(), CQOptimizationResult::slotSave(), and CQFittingResult::slotSave().
Retrieve the solution variables
Definition at line 676 of file COptProblem.cpp.
References mSolutionVariables.
Referenced by CQOptimizationResult::enterProtected(), CQFittingResult::enterProtected(), COptMethodSS::localmin(), COptMethodSS::optimise(), COptMethodCoranaWalk::optimise(), COptMethodNelderMead::optimise(), COptMethodSA::optimise(), and CQFittingItemWidget::slotReset().
CCopasiTask::Type COptProblem::getSubtaskType | ( | ) | const |
Retrieve the subtask type
Definition at line 781 of file COptProblem.cpp.
References CCopasiObject::getObjectAncestor(), CCopasiObject::getObjectDataModel(), CCopasiTask::getType(), mpParmSubtaskCN, mpSubtask, CCopasiDataModel::ObjectFromName(), and CCopasiTask::unset.
Referenced by CQOptimizationWidget::loadTask(), and CQOptimizationWidget::saveTask().
Retrieve the gradients for each solution variable.
Definition at line 679 of file COptProblem.cpp.
References mGradient.
Referenced by CQOptimizationResult::enterProtected(), and CQFittingResult::enterProtected().
size_t COptProblem::getVariableSize | ( | ) | const |
Retrieve the size of the variable vectors.
Referenced by COptMethodEP2::optimise().
Adds increment to the function evaluation counter
unsigned | C_INT32 increment |
Definition at line 844 of file COptProblem.cpp.
References mCounter.
Referenced by COptMethodSS::localmin().
|
virtual |
Do all necessary initialization so that calls to calculate will be successful. This is called once from CCopasiTask::process()
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
Definition at line 328 of file COptProblem.cpp.
References CModel::buildInitialRefreshSequence(), CCopasiObject::buildUpdateSequence(), CExpression::compile(), CModel::compileIfNecessary(), CCopasiMessage::ERROR, CCopasiObject::getDirectDependencies(), CEvaluationTree::getInfix(), CCopasiObject::getObjectParent(), CCopasiTask::getReport(), CReport::getStream(), CModel::getUptoDateObjects(), mConstraintCounter, MCOptimization, mCounter, mCPUTime, mFailedConstraintCounter, mFailedCounter, mInitialRefreshMethods, mOriginalVariables, CCopasiProblem::mpCallBack, mpConstraintItems, CCopasiProblem::mpModel, mpObjectiveExpression, mpOptItems, mpParmMaximize, CCopasiProblem::mpReport, mpSubtask, mRefreshConstraints, mRefreshMethods, mSolutionValue, mSolutionVariables, mUpdateMethods, mWorstValue, pTask, CVector< CType >::resize(), and CCopasiTimer::start().
Referenced by CFitProblem::initialize(), COptTask::initialize(), and COptMethodSS::initialize().
|
private |
Allocates all group parameters and assures that they are properly initialized.
Definition at line 148 of file COptProblem.cpp.
References CCopasiParameterGroup::assertGroup(), CCopasiParameterGroup::assertParameter(), CCopasiParameter::BOOL, CCopasiParameter::CN, elevateChildren(), CCopasiParameter::EXPRESSION, CCopasiParameter::getValue(), mpGrpConstraints, mpGrpItems, mpParmCalculateStatistics, mpParmMaximize, mpParmObjectiveExpression, mpParmRandomizeStartValues, mpParmSubtaskCN, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pCN, and CCopasiParameter::Value::pEXPRESSION.
Referenced by COptProblem().
|
virtual |
perform at least the initializations of the subtask that must be done before the output is initialized.
Definition at line 303 of file COptProblem.cpp.
References CCopasiObject::getObjectAncestor(), CCopasiObject::getObjectDataModel(), CCopasiTask::initialize(), mpParmSubtaskCN, mpSubtask, CCopasiTask::NO_OUTPUT, and CCopasiDataModel::ObjectFromName().
Referenced by COptTask::initialize(), and COptMethodSS::initialize().
|
private |
Definition at line 296 of file COptProblem.cpp.
References CCopasiContainer::addObjectReference(), CCopasiContainer::addVectorReference(), mCounter, mSolutionValue, mSolutionVariables, CCopasiObject::ValueDbl, and CCopasiObject::ValueInt.
Referenced by COptProblem().
const bool & COptProblem::maximize | ( | ) | const |
Check whether we have to maximize
Definition at line 797 of file COptProblem.cpp.
References mpParmMaximize.
Referenced by CQOptimizationWidget::loadTask(), CQOptimizationWidget::saveTask(), and setMaximize().
|
virtual |
This is the output method for any object. The default implementation provided with CCopasiObject uses the ostream operator<< of the object to print the object.To override this default behavior one needs to reimplement the virtual print function.
std::ostream | * ostream |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
Definition at line 855 of file COptProblem.cpp.
|
virtual |
This is the output method for any result of a problem. The default implementation provided with CCopasiProblem. Does only print "Not implemented." To override this default behavior one needs to reimplement the virtual printResult function.
std::ostream | * ostream |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
Definition at line 858 of file COptProblem.cpp.
References C_FLOAT64, CCopasiTimer::getElapsedTime(), CCopasiTimeVariable::getMilliSeconds(), CCopasiTimeVariable::getSeconds(), CCopasiTimeVariable::LL2String(), mCounter, mCPUTime, mpOptItems, mSolutionValue, mSolutionVariables, and CVectorCore< CType >::size().
void COptProblem::randomizeStartValues | ( | ) |
Randomize the start values if requested
Definition at line 806 of file COptProblem.cpp.
References mpOptItems, and mpParmRandomizeStartValues.
Referenced by CFitTask::process(), and COptTask::process().
void COptProblem::rememberStartValues | ( | ) |
Remember the start values;
Definition at line 822 of file COptProblem.cpp.
References mpOptItems.
Referenced by CFitTask::process(), and COptTask::process().
bool COptProblem::removeOptItem | ( | const size_t & | index | ) |
Remove an optimization items.
const | size_t & index |
Definition at line 721 of file COptProblem.cpp.
References mpGrpItems, and CCopasiParameterGroup::removeParameter().
void COptProblem::reset | ( | ) |
Reset counters and objective value.
Definition at line 269 of file COptProblem.cpp.
References mCounter, mpParmMaximize, and mSolutionValue.
Referenced by COptMethodSS::localmin(), and setCallBack().
void COptProblem::resetEvaluations | ( | ) |
Resets the function evaluation counter
Definition at line 847 of file COptProblem.cpp.
References mCounter.
Referenced by COptMethodSS::localmin(), and COptTask::process().
|
virtual |
Do all necessary restore procedures so that the model and task are in the same state as before.
const | bool & updateModel |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
Definition at line 478 of file COptProblem.cpp.
References mConstraintCounter, MCOptimization, mCounter, mFailedConstraintCounter, mFailedCounter, mpSubtask, CCopasiTask::restore(), restoreModel(), and CCopasiMessage::WARNING.
Referenced by CFitProblem::restore().
void COptProblem::restoreModel | ( | const bool & | updateModel | ) |
Do all necessary restore procedures for the model is in the same state as before.
const | bool & updateModel |
Definition at line 427 of file COptProblem.cpp.
References CVectorCore< CType >::array(), CModel::buildInitialRefreshSequence(), C_FLOAT64, mOriginalVariables, CCopasiProblem::mpModel, mpOptItems, mSolutionValue, mSolutionVariables, and mWorstValue.
Referenced by CScanTask::processCallback(), and restore().
void COptProblem::setCalculateStatistics | ( | const bool & | calculate | ) |
Set whether we have to calculate statistics
const | bool & calculate |
Definition at line 835 of file COptProblem.cpp.
References calculate(), and mpParmCalculateStatistics.
Referenced by COptMethodSS::initialize(), Arguments::prepareModel(), CQFittingWidget::saveTask(), and CQOptimizationWidget::saveTask().
|
virtual |
Set the call back of the problem
CProcessReport | * pCallBack |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
Definition at line 275 of file COptProblem.cpp.
References CProcessReport::addItem(), mCounter, mhCounter, mhSolutionValue, CCopasiProblem::mpCallBack, mSolutionValue, reset(), and CCopasiProblem::setCallBack().
Referenced by COptMethodSS::initialize(), and CFitProblem::setCallBack().
void COptProblem::setMaximize | ( | const bool & | maximize | ) |
Set whether we have to maximize the objective function
const | bool & maximize |
Definition at line 794 of file COptProblem.cpp.
References maximize(), and mpParmMaximize.
Referenced by CQOptimizationWidget::saveTask().
|
virtual |
Set the model of the problem
CModel | * pModel |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
Definition at line 263 of file COptProblem.cpp.
References CCopasiProblem::mpModel.
Referenced by CFitProblem::setModel().
bool COptProblem::setObjectiveFunction | ( | const std::string & | infix | ) |
Set optimization function
const | std::string & infix |
Definition at line 737 of file COptProblem.cpp.
References mpObjectiveExpression, mpParmObjectiveExpression, and CExpression::setInfix().
Referenced by elevateChildren(), and CQOptimizationWidget::saveTask().
void COptProblem::setRandomizeStartValues | ( | const bool & | randomize | ) |
Set whether we have to randomize start values
const | bool & randomize |
Definition at line 800 of file COptProblem.cpp.
References mpParmRandomizeStartValues.
Referenced by COptMethodSS::initialize(), Arguments::prepareModel(), CQFittingWidget::saveTask(), and CQOptimizationWidget::saveTask().
|
virtual |
Set the solution.
const | C_FLOAT64 & value |
const | CVector< C_FLOAT64 > & variables |
Reimplemented in CFitProblem.
Definition at line 682 of file COptProblem.cpp.
References mhSolutionValue, CCopasiProblem::mpCallBack, mpParmMaximize, mSolutionValue, mSolutionVariables, and CProcessReport::progressItem().
Referenced by COptMethodPS::create(), COptMethodPraxis::evaluateFunction(), COptMethodPS::move(), COptMethodDE::optimise(), COptMethodSRES::optimise(), COptMethodSS::optimise(), COptMethodGA::optimise(), COptMethodPS::optimise(), COptMethodGASR::optimise(), COptMethodHookeJeeves::optimise(), COptMethodLevenbergMarquardt::optimise(), COptMethodNelderMead::optimise(), COptMethodCoranaWalk::optimise(), COptMethodSA::optimise(), COptMethodTruncatedNewton::optimise(), COptMethodPraxis::optimise(), COptMethodStatistics::optimise(), COptMethodSteepestDescent::optimise(), COptMethodEP::optimise(), CRandomSearch::optimise(), CFitProblem::setSolution(), and COptMethodTruncatedNewton::sFun().
bool COptProblem::setSubtaskType | ( | const CCopasiTask::Type & | subtaskType | ) |
Set subtask type
const | CCopasiTask::Type & subtaskType |
Definition at line 752 of file COptProblem.cpp.
References CCopasiObject::getCN(), CCopasiObject::getObjectAncestor(), CCopasiObject::getObjectDataModel(), CCopasiProblem::getType(), mpParmSubtaskCN, mpSubtask, and CCopasiVector< T >::size().
Referenced by elevateChildren(), and CQOptimizationWidget::saveTask().
bool COptProblem::swapOptItem | ( | const size_t & | iFrom, |
const size_t & | iTo | ||
) |
Swap two optimization items.
const | size_t & iFrom |
const | size_t & iTo |
Definition at line 724 of file COptProblem.cpp.
References mpGrpItems, and CCopasiParameterGroup::swap().
|
friend |
Output stream operator
ostream | & os |
const | COptProblem & A |
Definition at line 892 of file COptProblem.cpp.
|
protected |
A vector of results for calculate
Definition at line 474 of file COptProblem.h.
Referenced by CFitProblem::calculate(), calculate(), CFitProblem::calculateStatistics(), calculateStatistics(), and getCalculateValue().
|
protected |
Counter of constraint checks
Definition at line 504 of file COptProblem.h.
Referenced by CFitProblem::checkFunctionalConstraints(), checkFunctionalConstraints(), initialize(), and restore().
|
protected |
Counter of evaluations
Definition at line 494 of file COptProblem.h.
Referenced by CFitProblem::calculate(), calculate(), CFitProblem::calculateCrossValidation(), getFunctionEvaluations(), incrementEvaluations(), initialize(), initObjects(), CFitProblem::printResult(), printResult(), reset(), resetEvaluations(), restore(), and setCallBack().
|
protected |
A CPU Timer
Definition at line 514 of file COptProblem.h.
Referenced by CFitProblem::calculateStatistics(), calculateStatistics(), getExecutionTime(), initialize(), CFitProblem::printResult(), and printResult().
|
protected |
Counter of failed constraint checks
Definition at line 509 of file COptProblem.h.
Referenced by CFitProblem::checkFunctionalConstraints(), checkFunctionalConstraints(), initialize(), and restore().
|
protected |
Counter of failed evaluations
Definition at line 499 of file COptProblem.h.
Referenced by CFitProblem::calculate(), calculate(), CFitProblem::calculateCrossValidation(), initialize(), and restore().
The gradient vector for the parameters
Definition at line 541 of file COptProblem.h.
Referenced by CFitProblem::calculateStatistics(), calculateStatistics(), getVariableGradients(), and CFitProblem::printResult().
|
protected |
Indicates whether the statistics have been calculated for the current result
Definition at line 536 of file COptProblem.h.
Referenced by CFitProblem::calculateStatistics(), calculateStatistics(), CFitProblem::initialize(), and CFitProblem::printResult().
|
protected |
Handle of "Function Evaluations" process report item
Definition at line 524 of file COptProblem.h.
Referenced by CFitProblem::calculate(), calculate(), CFitProblem::calculateCrossValidation(), and setCallBack().
|
protected |
Handle of "Best Value" process report item
Definition at line 519 of file COptProblem.h.
Referenced by setCallBack(), and setSolution().
|
protected |
A vector of refresh methods which need to be called update all initial values which depend on the optimization items.
Definition at line 457 of file COptProblem.h.
Referenced by calculate(), and initialize().
A vector of solution variables
Definition at line 484 of file COptProblem.h.
Referenced by CFitProblem::calculate(), CFitProblem::calculateCrossValidation(), initialize(), and restoreModel().
|
protected |
A pointer to the vector of optimization constraints
Definition at line 436 of file COptProblem.h.
Referenced by CFitProblem::calculate(), CFitProblem::calculateCrossValidation(), CFitProblem::checkFunctionalConstraints(), checkFunctionalConstraints(), CFitProblem::elevateChildren(), elevateChildren(), getConstraintList(), CFitProblem::initialize(), initialize(), and operator<<().
|
protected |
A pointer to the value of the CCopasiParameter holding the OptimizationConstraints
Definition at line 426 of file COptProblem.h.
Referenced by elevateChildren(), and initializeParameter().
|
protected |
A pointer to the value of the CCopasiParameterGroup holding the OptimizationItems
Definition at line 421 of file COptProblem.h.
Referenced by addOptItem(), elevateChildren(), getOptItemSize(), initializeParameter(), removeOptItem(), and swapOptItem().
|
protected |
The objective function which should be minimized or maximized.
Definition at line 446 of file COptProblem.h.
Referenced by calculate(), initialize(), operator<<(), and setObjectiveFunction().
|
protected |
A pointer to the vector of optimization items
Definition at line 431 of file COptProblem.h.
Referenced by CFitProblem::calculate(), checkParametricConstraints(), CFitProblem::elevateChildren(), elevateChildren(), getOptItemList(), CFitProblem::initialize(), initialize(), operator<<(), CFitProblem::printResult(), printResult(), randomizeStartValues(), rememberStartValues(), and restoreModel().
|
protected |
A pointer to the value of the CCopasiParameter holding Calculate Statistics
Definition at line 416 of file COptProblem.h.
Referenced by CFitProblem::calculateStatistics(), calculateStatistics(), getCalculateStatistics(), initializeParameter(), CFitProblem::printResult(), and setCalculateStatistics().
|
protected |
A pointer to the value of the CCopasiParameter holding Maximize
Definition at line 406 of file COptProblem.h.
Referenced by calculate(), calculateStatistics(), initialize(), CFitProblem::initializeParameter(), initializeParameter(), maximize(), reset(), setMaximize(), and setSolution().
|
protected |
A pointer to the value of the CCopasiParameter holding the ObjectiveFunctionKey A pointer to the value of the CCopasiParameter holding the infix expression of the objective function
Definition at line 401 of file COptProblem.h.
Referenced by elevateChildren(), getObjectiveFunction(), CFitProblem::initializeParameter(), initializeParameter(), and setObjectiveFunction().
|
protected |
A pointer to the value of the CCopasiParameter holding Randomize Start Values
Definition at line 411 of file COptProblem.h.
Referenced by getRandomizeStartValues(), initializeParameter(), randomizeStartValues(), and setRandomizeStartValues().
|
protected |
A pointer to the value of the CCopasiParameter holding the CN for the subtask
Definition at line 390 of file COptProblem.h.
Referenced by elevateChildren(), getSubtaskType(), CFitProblem::initializeParameter(), initializeParameter(), initializeSubtaskBeforeOutput(), and setSubtaskType().
|
mutableprotected |
Pointer to the subtask to be used in the optimization
Definition at line 441 of file COptProblem.h.
Referenced by calculate(), getSubtaskType(), initialize(), initializeSubtaskBeforeOutput(), operator<<(), restore(), and setSubtaskType().
|
protected |
A vector of refresh methods which need to be called retrieve the values of constraints.
Definition at line 469 of file COptProblem.h.
Referenced by checkFunctionalConstraints(), and initialize().
|
protected |
A vector of refresh methods which need to be called retrieve the value of the objective function.
Definition at line 463 of file COptProblem.h.
Referenced by calculate(), and initialize().
|
protected |
A vector of solution results
Definition at line 489 of file COptProblem.h.
Referenced by CFitProblem::calculateCrossValidation(), CFitProblem::calculateStatistics(), calculateStatistics(), getSolutionValue(), initialize(), initObjects(), CFitProblem::printResult(), printResult(), reset(), restoreModel(), setCallBack(), and setSolution().
A vector of solution variables
Definition at line 479 of file COptProblem.h.
Referenced by CFitProblem::calculateCrossValidation(), CFitProblem::calculateStatistics(), calculateStatistics(), getSolutionVariables(), CFitProblem::initialize(), initialize(), initObjects(), CFitProblem::printResult(), printResult(), restoreModel(), and setSolution().
|
protected |
Indicates whether the results shall be stored. The default is false.
Definition at line 530 of file COptProblem.h.
Referenced by CFitProblem::calculate(), calculate(), CFitProblem::calculateCrossValidation(), CFitProblem::calculateStatistics(), calculateStatistics(), and CFitProblem::initialize().
|
protected |
A vector of update method to the values of the optimization items.
Definition at line 451 of file COptProblem.h.
Referenced by CFitProblem::calculateStatistics(), calculateStatistics(), getCalculateVariableUpdateMethods(), and initialize().
|
protected |
A static value containing Infinity.
Definition at line 385 of file COptProblem.h.
Referenced by CFitProblem::calculate(), CFitProblem::calculateCrossValidation(), CFitProblem::calculateStatistics(), calculateStatistics(), CFitProblem::initialize(), initialize(), and restoreModel().
|
static |
The methods which can be selected for performing this task.
File name: COptProblem.cpp
Programmer: Yongqun He Contact email: yohe@ Purpose: This is the source file of the vt.e duCOptProblem class. It specifies the optimization problem with its own members and functions. It's used by COptAlgorithm class and COptimization class
Definition at line 57 of file COptProblem.h.
Referenced by CQOptimizationWidget::init().