copasi API  0.1
Public Member Functions | Protected Attributes | Friends
COptProblem Class Reference

#include <COptProblem.h>

Inheritance diagram for COptProblem:
CCopasiProblem CCopasiParameterGroup CCopasiParameter CCopasiContainer CCopasiObject CFitProblem

List of all members.

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
COptItemgetOptItem (const unsigned C_INT32 &index)
unsigned C_INT32 getOptItemSize () const
COptItemaddOptItem (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
CCopasiParameterGroupmpGrpItems
CCopasiParameterGroupmpGrpConstraints
std::vector< COptItem * > * mpOptItems
std::vector< COptItem * > * mpConstraintItems
CCopasiTaskmpSubtask
CExpressionmpObjectiveExpression
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)

Detailed Description

:pos -4.4,4.15


Constructor & Destructor Documentation

COptProblem::COptProblem ( const CCopasiTask::Type type = CCopasiTask::optimization,
const CCopasiContainer pParent = NULL 
)

Default constructor

Parameters:
constCCopasiTask::Type & type (default: optimization)
constCCopasiContainer * 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.

Parameters:
constCOptProblem & src
constCCopasiContainer * pParent (default: NULL)
COptProblem::~COptProblem ( ) [virtual]

Destructor


Member Function Documentation

COptItem & COptProblem::addOptItem ( const CCopasiObjectName objectCN)

Add an optimization item to the problem.

Parameters:
constCCopasiObjectName & objectCN
Returns:
COptItem optItemAdded
bool COptProblem::calculate ( void  ) [virtual]

Do the calculating based on CalculateVariables and fill CalculateResults with the results.

Returns:
bool continue

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

Parameters:
constC_FLOAT64 & factor (Default: 1.0e-003)
constC_FLOAT64 & resolution (Default: 1.0e-009)

Reimplemented in CFitProblem.

bool COptProblem::checkFunctionalConstraints ( ) [virtual]

Check whether all functional constraints are fulfilled.

Returns:
bool fulfilled

Reimplemented in CFitProblem.

bool COptProblem::checkParametricConstraints ( ) [virtual]

Check whether all parameters are within their boundaries.

Returns:
bool within
bool COptProblem::elevateChildren ( ) [virtual]

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

Returns:
bool success

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.

Returns:
const std::vector< UpdateMethod * > & updateMethods
const std::vector< COptItem * > & COptProblem::getConstraintList ( ) const

Retrieve the list of constraints.

Returns:
const std::vector< COptItem * > & constraintList
const C_FLOAT64 & COptProblem::getExecutionTime ( ) const

Retrieve the objective function.

Returns:
const C_FLOAT64 & executionTime
const unsigned C_INT32 & COptProblem::getFunctionEvaluations ( ) const

Retrieve the objective function.

Returns:
const unsigned C_INT32 & functionEvaluations
const std::string COptProblem::getObjectiveFunction ( )

Retrieve the objective function.

Returns:
const std::string infix.
COptItem & COptProblem::getOptItem ( const unsigned C_INT32 &  index)

Retrieve the 'index' optimization item.

Parameters:
constunsigned C_INT32 & index
Returns:
COptItem optItem
const std::vector< COptItem * > & COptProblem::getOptItemList ( ) const

Retrieve the list of optimization parameters.

Returns:
const std::vector< COptItem * > & optItemList
unsigned C_INT32 COptProblem::getOptItemSize ( ) const

Retrieve the number of optimization items.

Returns:
const unsigned C_INT32 size
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

Returns:
CCopasiTask::Type subtaskType
const CVector< C_FLOAT64 > & COptProblem::getVariableGradients ( ) const

Retrieve the gradients for each solution variable.

Returns:
const CVector< C_FLOAT64 > & variableGradients
unsigned C_INT32 COptProblem::getVariableSize ( ) const

Retrieve the size of the variable vectors.

Returns:
unsigned C_INT32 VariableSize
bool COptProblem::initialize ( ) [virtual]

Do all necessary initialization so that calls to calculate will be successful. This is called once from CCopasiTask::process()

Returns:
bool success

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

Returns:
const bool & 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.

Parameters:
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.

Parameters:
std::ostream* ostream

Reimplemented from CCopasiProblem.

Reimplemented in CFitProblem.

bool COptProblem::removeOptItem ( const unsigned C_INT32 &  index)

Remove an optimization items.

Parameters:
constunsigned C_INT32 & index
Returns:
bool success
bool COptProblem::restore ( const bool &  updateModel) [virtual]

Do all necessary restore procedures so that the model is in the same state as before

Parameters:
constbool & updateModel
Returns:
bool success

Reimplemented from CCopasiProblem.

Reimplemented in CFitProblem.

bool COptProblem::setCallBack ( CProcessReport pCallBack) [virtual]

Set the call back of the problem

Parameters:
CProcessReport* pCallBack
Returns:
bool success

Reimplemented from CCopasiProblem.

Reimplemented in CFitProblem.

void COptProblem::setMaximize ( const bool &  maximize)

Set whether we have to maximize the objective function

Parameters:
constbool & maximize
bool COptProblem::setModel ( CModel pModel) [virtual]

Set the model of the problem

Parameters:
CModel* pModel
Returns:
bool success

Reimplemented from CCopasiProblem.

Reimplemented in CFitProblem.

bool COptProblem::setObjectiveFunction ( const std::string &  infix)

Set optimization function

Parameters:
conststd::string & infix
Returns:
bool success
bool COptProblem::setSolution ( const C_FLOAT64 &  value,
const CVector< C_FLOAT64 > &  variables 
) [virtual]

Set the solution.

Parameters:
constC_FLOAT64 & value
constCVector< C_FLOAT64 > & variables
Returns:
bool continue;
bool COptProblem::setSubtaskType ( const CCopasiTask::Type subtaskType)

Set subtask type

Parameters:
constCCopasiTask::Type & subtaskType
Returns:
success
bool COptProblem::swapOptItem ( const unsigned C_INT32 &  iFrom,
const unsigned C_INT32 &  iTo 
)

Swap two optimization items.

Parameters:
constunsigned C_INT32 & iFrom
constunsigned C_INT32 & iTo
Returns:
bool success

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const COptProblem o 
) [friend]

Output stream operator

Parameters:
ostream& os
constCOptProblem & A
Returns:
ostream & os

Member Data Documentation

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

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

A pointer to the value of the CCopasiParameter holding the OptimizationConstraints

A pointer to the value of the CCopasiParameterGroup holding the OptimizationItems

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines