copasi API
0.1
|
#include <COptProblem.h>
Public Member Functions | |
COptProblem (const CCopasiTask::Type &type=CCopasiTask::optimization, const CCopasiContainer *pParent=NULL) | |
COptProblem (const COptProblem &src, const CCopasiContainer *pParent=NULL) | |
virtual | ~COptProblem () |
virtual bool | elevateChildren () |
virtual bool | setModel (CModel *pModel) |
virtual bool | setCallBack (CProcessReport *pCallBack) |
virtual bool | initialize () |
virtual bool | initializeSubtaskBeforeOutput () |
virtual bool | calculate () |
virtual bool | restore (const bool &updateModel) |
virtual bool | checkParametricConstraints () |
virtual bool | checkFunctionalConstraints () |
virtual bool | calculateStatistics (const C_FLOAT64 &factor=1.0e-003, const C_FLOAT64 &resolution=1.0e-009) |
unsigned C_INT32 | getVariableSize () const |
const std::vector< COptItem * > & | getOptItemList () const |
const std::vector< COptItem * > & | getConstraintList () const |
const std::vector < UpdateMethod * > & | getCalculateVariableUpdateMethods () const |
const C_FLOAT64 & | getCalculateValue () const |
const CVector< C_FLOAT64 > & | getSolutionVariables () const |
const CVector< C_FLOAT64 > & | getVariableGradients () const |
virtual bool | setSolution (const C_FLOAT64 &value, const CVector< C_FLOAT64 > &variables) |
const C_FLOAT64 & | getSolutionValue () const |
COptItem & | getOptItem (const unsigned C_INT32 &index) |
unsigned C_INT32 | getOptItemSize () const |
COptItem & | addOptItem (const CCopasiObjectName &objectCN) |
bool | removeOptItem (const unsigned C_INT32 &index) |
bool | swapOptItem (const unsigned C_INT32 &iFrom, const unsigned C_INT32 &iTo) |
bool | setObjectiveFunction (const std::string &infix) |
const std::string | getObjectiveFunction () |
bool | setSubtaskType (const CCopasiTask::Type &subtaskType) |
CCopasiTask::Type | getSubtaskType () const |
void | setMaximize (const bool &maximize) |
const bool & | maximize () const |
const unsigned C_INT32 & | getFunctionEvaluations () const |
const C_FLOAT64 & | getExecutionTime () const |
virtual void | print (std::ostream *ostream) const |
virtual void | printResult (std::ostream *ostream) const |
Protected Attributes | |
C_FLOAT64 | mInfinity |
std::string * | mpParmSubtaskCN |
std::string * | mpParmObjectiveExpression |
bool * | mpParmMaximize |
CCopasiParameterGroup * | mpGrpItems |
CCopasiParameterGroup * | mpGrpConstraints |
std::vector< COptItem * > * | mpOptItems |
std::vector< COptItem * > * | mpConstraintItems |
CCopasiTask * | mpSubtask |
CExpression * | mpObjectiveExpression |
std::vector< UpdateMethod * > | mUpdateMethods |
std::vector< Refresh * > | mInitialRefreshMethods |
std::vector< Refresh * > | mRefreshMethods |
std::vector< Refresh * > | mRefreshConstraints |
C_FLOAT64 | mCalculateValue |
CVector< C_FLOAT64 > | mSolutionVariables |
CVector< C_FLOAT64 > | mOriginalVariables |
C_FLOAT64 | mSolutionValue |
unsigned C_INT32 | mCounter |
unsigned C_INT32 | mFailedCounter |
unsigned C_INT32 | mConstraintCounter |
unsigned C_INT32 | mFailedConstraintCounter |
CCopasiTimer | mCPUTime |
unsigned C_INT32 | mhSolutionValue |
unsigned C_INT32 | mhCounter |
bool | mStoreResults |
bool | mHaveStatistics |
CVector< C_FLOAT64 > | mGradient |
Friends | |
std::ostream & | operator<< (std::ostream &os, const COptProblem &o) |
:pos -4.4,4.15
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) |
File name: COptProblem.cpp
Programmer: Yongqun He Contact email: yohe@vt.edu Purpose: This is the source file of the COptProblem class. It specifies the optimization problem with its own members and functions. It's used by COptAlgorithm class and COptimization class
COptProblem::COptProblem | ( | const COptProblem & | src, |
const CCopasiContainer * | pParent = NULL |
||
) |
Copy constructor.
const | COptProblem & src |
const | CCopasiContainer * pParent (default: NULL) |
COptProblem::~COptProblem | ( | ) | [virtual] |
Destructor
COptItem & COptProblem::addOptItem | ( | const CCopasiObjectName & | objectCN | ) |
Add an optimization item to the problem.
const | CCopasiObjectName & objectCN |
bool COptProblem::calculate | ( | void | ) | [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.
bool COptProblem::calculateStatistics | ( | const C_FLOAT64 & | factor = 1.0e-003 , |
const C_FLOAT64 & | resolution = 1.0e-009 |
||
) | [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.
bool COptProblem::checkFunctionalConstraints | ( | ) | [virtual] |
Check whether all functional constraints are fulfilled.
Reimplemented in CFitProblem.
bool COptProblem::checkParametricConstraints | ( | ) | [virtual] |
Check whether all parameters are within their boundaries.
bool COptProblem::elevateChildren | ( | ) | [virtual] |
This methods must be called to elevate subgroups to derived objects. The default implementation does nothing.
Reimplemented from CCopasiParameterGroup.
Reimplemented in CFitProblem.
const C_FLOAT64 & COptProblem::getCalculateValue | ( | ) | const |
Retrieve the result of a calculation
const std::vector< UpdateMethod * > & COptProblem::getCalculateVariableUpdateMethods | ( | ) | const |
Retrieve the update methods for the variables for calculation.
const std::vector< COptItem * > & COptProblem::getConstraintList | ( | ) | const |
Retrieve the list of constraints.
const C_FLOAT64 & COptProblem::getExecutionTime | ( | ) | const |
Retrieve the objective function.
const unsigned C_INT32 & COptProblem::getFunctionEvaluations | ( | ) | const |
Retrieve the objective function.
const std::string COptProblem::getObjectiveFunction | ( | ) |
Retrieve the objective function.
COptItem & COptProblem::getOptItem | ( | const unsigned C_INT32 & | index | ) |
Retrieve the 'index' optimization item.
const | unsigned C_INT32 & index |
const std::vector< COptItem * > & COptProblem::getOptItemList | ( | ) | const |
Retrieve the list of optimization parameters.
unsigned C_INT32 COptProblem::getOptItemSize | ( | ) | const |
Retrieve the number of optimization items.
const C_FLOAT64 & COptProblem::getSolutionValue | ( | ) | const |
Retrieve the result for the solution
const CVector< C_FLOAT64 > & COptProblem::getSolutionVariables | ( | ) | const |
Retrieve the solution variables
CCopasiTask::Type COptProblem::getSubtaskType | ( | ) | const |
Retrieve the subtask type
const CVector< C_FLOAT64 > & COptProblem::getVariableGradients | ( | ) | const |
Retrieve the gradients for each solution variable.
unsigned C_INT32 COptProblem::getVariableSize | ( | ) | const |
Retrieve the size of the variable vectors.
bool COptProblem::initialize | ( | ) | [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.
bool COptProblem::initializeSubtaskBeforeOutput | ( | ) | [virtual] |
perform at least the initializations of the subtask that must be done before the output is initialized.
const bool & COptProblem::maximize | ( | ) | const |
Check whether we have to maximize
void COptProblem::print | ( | std::ostream * | ostream | ) | const [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.
void COptProblem::printResult | ( | std::ostream * | ostream | ) | const [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.
bool COptProblem::removeOptItem | ( | const unsigned C_INT32 & | index | ) |
Remove an optimization items.
const | unsigned C_INT32 & index |
bool COptProblem::restore | ( | const bool & | updateModel | ) | [virtual] |
Do all necessary restore procedures so that the model is in the same state as before
const | bool & updateModel |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
bool COptProblem::setCallBack | ( | CProcessReport * | pCallBack | ) | [virtual] |
Set the call back of the problem
CProcessReport | * pCallBack |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
void COptProblem::setMaximize | ( | const bool & | maximize | ) |
Set whether we have to maximize the objective function
const | bool & maximize |
bool COptProblem::setModel | ( | CModel * | pModel | ) | [virtual] |
Set the model of the problem
CModel | * pModel |
Reimplemented from CCopasiProblem.
Reimplemented in CFitProblem.
bool COptProblem::setObjectiveFunction | ( | const std::string & | infix | ) |
Set optimization function
const | std::string & infix |
bool COptProblem::setSolution | ( | const C_FLOAT64 & | value, |
const CVector< C_FLOAT64 > & | variables | ||
) | [virtual] |
Set the solution.
const | C_FLOAT64 & value |
const | CVector< C_FLOAT64 > & variables |
bool COptProblem::setSubtaskType | ( | const CCopasiTask::Type & | subtaskType | ) |
bool COptProblem::swapOptItem | ( | const unsigned C_INT32 & | iFrom, |
const unsigned C_INT32 & | iTo | ||
) |
Swap two optimization items.
const | unsigned C_INT32 & iFrom |
const | unsigned C_INT32 & iTo |
std::ostream& operator<< | ( | std::ostream & | os, |
const COptProblem & | o | ||
) | [friend] |
C_FLOAT64 COptProblem::mCalculateValue [protected] |
A vector of results for calculate
unsigned C_INT32 COptProblem::mConstraintCounter [protected] |
Counter of constraint checks
unsigned C_INT32 COptProblem::mCounter [protected] |
Counter of evaluations
CCopasiTimer COptProblem::mCPUTime [protected] |
A CPU Timer
unsigned C_INT32 COptProblem::mFailedConstraintCounter [protected] |
Counter of failed constraint checks
unsigned C_INT32 COptProblem::mFailedCounter [protected] |
Counter of failed evaluations
CVector< C_FLOAT64 > COptProblem::mGradient [protected] |
The gradient vector for the parameters
bool COptProblem::mHaveStatistics [protected] |
Indicates whether the statistics have been calculated for the current result
unsigned C_INT32 COptProblem::mhCounter [protected] |
Handle of "Function Evaluations" process report item
unsigned C_INT32 COptProblem::mhSolutionValue [protected] |
Handle of "Best Value" process report item
C_FLOAT64 COptProblem::mInfinity [protected] |
A static value containing Infinity.
std::vector< Refresh * > COptProblem::mInitialRefreshMethods [protected] |
A vector of refresh methods which need to be called update all initial values which depend on the optimization items.
CVector< C_FLOAT64 > COptProblem::mOriginalVariables [protected] |
A vector of solution variables
std::vector<COptItem *>* COptProblem::mpConstraintItems [protected] |
A pointer to the vector of optimization constraints
CCopasiParameterGroup* COptProblem::mpGrpConstraints [protected] |
A pointer to the value of the CCopasiParameter holding the OptimizationConstraints
CCopasiParameterGroup* COptProblem::mpGrpItems [protected] |
A pointer to the value of the CCopasiParameterGroup holding the OptimizationItems
CExpression* COptProblem::mpObjectiveExpression [protected] |
The objective function which should be minimized or maximized.
std::vector<COptItem *>* COptProblem::mpOptItems [protected] |
A pointer to the vector of optimization items
bool* COptProblem::mpParmMaximize [protected] |
A pointer to the value of the CCopasiParameter holding Maximize
std::string* COptProblem::mpParmObjectiveExpression [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
std::string* COptProblem::mpParmSubtaskCN [protected] |
A pointer to the value of the CCopasiParameter holding the CN for the subtask
CCopasiTask* COptProblem::mpSubtask [mutable, protected] |
Pointer to the subtask to be used in the optimization
std::vector< Refresh * > COptProblem::mRefreshConstraints [protected] |
A vector of refresh methods which need to be called retrieve the values of constraints.
std::vector< Refresh * > COptProblem::mRefreshMethods [protected] |
A vector of refresh methods which need to be called retrieve the value of the objective function.
C_FLOAT64 COptProblem::mSolutionValue [protected] |
A vector of solution results
CVector< C_FLOAT64 > COptProblem::mSolutionVariables [protected] |
A vector of solution variables
bool COptProblem::mStoreResults [protected] |
Indicates whether the results shall be stored. The default is false.
std::vector< UpdateMethod * > COptProblem::mUpdateMethods [protected] |
A vector of update method to the values of the optimization items.