coco::func_d_eval Class Reference
[Evaluators]

Forward function evaluation with preparation of derivative data. More...

#include <der_evaluator.h>

Inheritance diagram for coco::func_d_eval:

Inheritance graph
[legend]
Collaboration diagram for coco::func_d_eval:

Collaboration graph
[legend]

List of all members.

Public Types

typedef _Base::node_data_type node_data_type
typedef _Base::return_value return_value
typedef _Base::const_walker const_walker
typedef func_d_eval_type data_type

Public Member Functions

 func_d_eval (const std::vector< double > &__x, const variable_indicator &__v, const model &__m, std::vector< std::vector< double > > &__d, std::vector< double > *__c)
 func_d_eval (const func_d_eval &__x)
 ~func_d_eval ()
expression_const_walker short_cut_to (const expression_node &__data)
void new_point (const std::vector< double > &__x, const variable_indicator &__v)
 func_d_eval (const std::vector< double > &__x, const variable_indicator &__v, const model &__m, std::vector< std::vector< double > > &__d, std::vector< double > *__c)
 func_d_eval (const func_d_eval &__x)
 ~func_d_eval ()
expression_const_walker short_cut_to (const expression_node &__data)
void new_point (const std::vector< double > &__x, const variable_indicator &__v)
int preorder (const node_data_type &__data)
void postorder (const node_data_type &__data)
int collect (const node_data_type &__data, const return_value &__rval)
int vcollect (const return_value &__rval)
return_value value ()
return_value vvalue ()
void vinit ()
virtual void cleanup (const node_data_type &__data)
void initialize ()
int initialize (const expression_node &__data)
void calculate (const expression_node &__data)
void retrieve_from_cache (const expression_node &__data)
int update (const double &__rval)
int update (const expression_node &__data, const double &__rval)
double calculate_value (bool eval_all)
void initialize ()
int initialize (const expression_node &__data)
void calculate (const expression_node &__data)
void retrieve_from_cache (const expression_node &__data)
int update (const double &__rval)
int update (const expression_node &__data, const double &__rval)
double calculate_value (bool eval_all)

Protected Member Functions

bool is_cached (const node_data_type &__data)
bool is_cached (const node_data_type &__data)

Protected Attributes

const variable_indicatorv_ind
func_d_eval_type eval_data


Detailed Description

This class is a cached forward evaluator performing a function evaluation and the preparation of partial derivative information for backwards differentiation.

Definition at line 148 of file der_evaluator.h.


Member Typedef Documentation

This is the type of the walker, which is used for the short-cuts.

Reimplemented from coco::cached_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 723 of file evaluator.h.

The data_type specifies the type of the internal data of the evaluator.

Definition at line 305 of file evaluator.h.

The node_data_type is the datatype of the nodes of the graph.

Reimplemented from coco::cached_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 719 of file evaluator.h.

This type is the result type of the evaluator.

Reimplemented from coco::cached_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 721 of file evaluator.h.


Constructor & Destructor Documentation

coco::func_d_eval::func_d_eval ( const std::vector< double > &  __x,
const variable_indicator __v,
const model __m,
std::vector< std::vector< double > > &  __d,
std::vector< double > *  __c 
) [inline]

Constructor: __x is the point where the derivative shall be evaluated, __v is a variable indicator specifying the variables that have changed value since the last evaluation, __m specifies the DAG, __d the derivative data, and __c the cache (may be NULL).

Definition at line 241 of file der_evaluator.h.

coco::func_d_eval::func_d_eval ( const func_d_eval __x  )  [inline]

Standard Copy Constructor

Definition at line 256 of file der_evaluator.h.

coco::func_d_eval::~func_d_eval (  )  [inline]

Standard Destructor

Definition at line 259 of file der_evaluator.h.

coco::func_d_eval::func_d_eval ( const std::vector< double > &  __x,
const variable_indicator __v,
const model __m,
std::vector< std::vector< double > > &  __d,
std::vector< double > *  __c 
) [inline]

Constructor: __x is the point where the derivative shall be evaluated, __v is a variable indicator specifying the variables that have changed value since the last evaluation, __m specifies the DAG, __d the derivative data, and __c the cache (may be NULL).

Definition at line 238 of file der_evaluator_n.h.

coco::func_d_eval::func_d_eval ( const func_d_eval __x  )  [inline]

Standard Copy Constructor

Definition at line 253 of file der_evaluator_n.h.

coco::func_d_eval::~func_d_eval (  )  [inline]

Standard Destructor

Definition at line 256 of file der_evaluator_n.h.


Member Function Documentation

void coco::func_d_eval::calculate ( const expression_node __data  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 335 of file der_evaluator_n.h.

void coco::func_d_eval::calculate ( const expression_node __data  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 338 of file der_evaluator.h.

double coco::func_d_eval::calculate_value ( bool  eval_all  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 970 of file der_evaluator_n.h.

double coco::func_d_eval::calculate_value ( bool  eval_all  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 973 of file der_evaluator.h.

virtual void coco::cached_forward_evaluator_base< func_d_eval_type , expression_node , double , expression_const_walker >::cleanup ( const node_data_type __data  )  [inline, virtual, inherited]

The cleanup method is called just before calculate_value and should be used to clean up dynamically allocated data. The __data parameter contains the node data of the graph node being visited.

Definition at line 804 of file evaluator.h.

int coco::cached_forward_evaluator_base< func_d_eval_type , expression_node , double , expression_const_walker >::collect ( const node_data_type __data,
const return_value &  __rval 
) [inline, virtual, inherited]

This method is needed by a visitor (see VGTL documentation) and is called for each normal node everytime a child node has been visited passing the return value of the child. It is translated to a call to update.

Reimplemented from coco::_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 750 of file evaluator.h.

int coco::func_d_eval::initialize ( const expression_node __data  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 275 of file der_evaluator_n.h.

void coco::func_d_eval::initialize (  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 273 of file der_evaluator_n.h.

int coco::func_d_eval::initialize ( const expression_node __data  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 278 of file der_evaluator.h.

void coco::func_d_eval::initialize (  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 276 of file der_evaluator.h.

bool coco::func_d_eval::is_cached ( const node_data_type __data  )  [inline, protected, virtual]

This function determines, whether the value and derivative information for this node are already available.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 157 of file der_evaluator_n.h.

bool coco::func_d_eval::is_cached ( const node_data_type __data  )  [inline, protected, virtual]

This function determines, whether the value and derivative information for this node are already available.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 160 of file der_evaluator.h.

void coco::func_d_eval::new_point ( const std::vector< double > &  __x,
const variable_indicator __v 
) [inline]

This method changes the evaluation point to __x. The parameter __v specifies which variables have changed value since the last evaluation.

Definition at line 265 of file der_evaluator_n.h.

void coco::func_d_eval::new_point ( const std::vector< double > &  __x,
const variable_indicator __v 
) [inline]

This method changes the evaluation point to __x. The parameter __v specifies which variables have changed value since the last evaluation.

Definition at line 268 of file der_evaluator.h.

void coco::cached_forward_evaluator_base< func_d_eval_type , expression_node , double , expression_const_walker >::postorder ( const node_data_type __data  )  [inline, virtual, inherited]

This method is needed by a visitor (see VGTL documentation) and is called right after all children of a node have been visited. It is translated into calls to calculate and cleanup.

Reimplemented from coco::_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 744 of file evaluator.h.

int coco::cached_forward_evaluator_base< func_d_eval_type , expression_node , double , expression_const_walker >::preorder ( const node_data_type __data  )  [inline, virtual, inherited]

This method is needed by a visitor (see VGTL documentation) and is called right before any children of a node are visited. It checks whether the result of this node is cached and calls either retrieve_from_cache and stops the downwards walk or calls initialize.

Reimplemented from coco::cached_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 732 of file evaluator.h.

void coco::func_d_eval::retrieve_from_cache ( const expression_node __data  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 345 of file der_evaluator_n.h.

void coco::func_d_eval::retrieve_from_cache ( const expression_node __data  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 348 of file der_evaluator.h.

expression_const_walker coco::func_d_eval::short_cut_to ( const expression_node __data  )  [inline, virtual]

expression_const_walker coco::func_d_eval::short_cut_to ( const expression_node __data  )  [inline, virtual]

NOP version, not needed

Reimplemented from coco::cached_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 262 of file der_evaluator.h.

int coco::func_d_eval::update ( const expression_node __data,
const double &  __rval 
) [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 378 of file der_evaluator_n.h.

int coco::func_d_eval::update ( const double &  __rval  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 372 of file der_evaluator_n.h.

int coco::func_d_eval::update ( const expression_node __data,
const double &  __rval 
) [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 381 of file der_evaluator.h.

int coco::func_d_eval::update ( const double &  __rval  )  [inline, virtual]

This is an evaluator method, as defined for the various evaluators.

Reimplemented from coco::cached_forward_evaluator_base< func_d_eval_type, expression_node, double, expression_const_walker >.

Definition at line 375 of file der_evaluator.h.

This method is needed by a visitor (see VGTL documentation) and is called right before the end of the visit of a normal node to retrieve the return value. It is translated to a call to calculate_value with parameter false.

Reimplemented from coco::_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 762 of file evaluator.h.

int coco::cached_forward_evaluator_base< func_d_eval_type , expression_node , double , expression_const_walker >::vcollect ( const return_value &  __rval  )  [inline, virtual, inherited]

This method is needed by a visitor (see VGTL documentation) and is called for each virtual node everytime a child node has been visited passing the return value of the child. It is translated to a call to update.

Reimplemented from coco::_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 756 of file evaluator.h.

void coco::cached_forward_evaluator_base< func_d_eval_type , expression_node , double , expression_const_walker >::vinit (  )  [inline, inherited]

This method is needed by a visitor using recursive_short_cut_walk for traversing the graph. It is called before performing any graph walk when at a virtual node. It is translated to initialize.

Definition at line 771 of file evaluator.h.

This method is needed by a visitor (see VGTL documentation) and is called right before the end of the visit of a virtual node to retrieve the return value. It is translated to a call to calculate_value with parameter true.

Reimplemented from coco::_evaluator_base< func_d_eval_type, expression_node, double,expression_const_walker >.

Definition at line 767 of file evaluator.h.


Member Data Documentation

The internal data of the evaluator

Definition at line 316 of file evaluator.h.

For caching a variable indicator is needed to check which nodes need not be re-evaluated.

Definition at line 427 of file evaluator.h.


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

Generated on Tue Feb 9 14:48:08 2010 for COCONUT API by  doxygen 1.5.8