Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::evaluator::Evaluator< ContextType > Class Template Referenceabstract

The Evaluator class - base class being able to evaluate given context and output the result. More...

#include <Evaluator.hh>

Inheritance diagram for grail::evaluator::Evaluator< ContextType >:

Public Member Functions

float EvaluateContext (const ContextType &context, data::UtilityEvaluatorSnapshot *const snapshot) const
 EvaluateContext - evaluates provided context and if provided snapshot is not empty, fills it with debug data describing this node. More...
 
virtual data::EvaluatorType GetEvaluatorType () const =0
 
virtual void GetDependentConsiderations (std::vector< Consideration< ContextType > * > &considerations)=0
 

Protected Member Functions

virtual float Evaluate (const ContextType &context, data::UtilityEvaluatorSnapshot *const snapshot) const =0
 Evaluate - Called from EvaluateContext which also evaluates context, but without automatically filling snapshot with debug data. Should be overriden for each derived Evaluator. More...
 
virtual void DebugDump (const std::map< const void *, unsigned int > &nodeMapping, data::EvaluationDebugData &debugData) const =0
 DebugDump - Called from EvaluateContext, which generates additional debug data for each evaluator. Should be overriden in each derived evaluator to better reflect debug tree topology. More...
 

Detailed Description

template<typename ContextType>
class grail::evaluator::Evaluator< ContextType >

The Evaluator class - base class being able to evaluate given context and output the result.

Member Function Documentation

◆ DebugDump()

template<typename ContextType >
virtual void grail::evaluator::Evaluator< ContextType >::DebugDump ( const std::map< const void *, unsigned int > &  nodeMapping,
data::EvaluationDebugData debugData 
) const
protectedpure virtual

DebugDump - Called from EvaluateContext, which generates additional debug data for each evaluator. Should be overriden in each derived evaluator to better reflect debug tree topology.

Parameters
nodeMapping- Maps node pointers to node index.
debugData- Evaluation debug data which will be filled in this method

Implemented in grail::evaluator::Curve< ContextType >, grail::evaluator::Aggregator< ContextType >, and grail::evaluator::Consideration< ContextType >.

◆ Evaluate()

template<typename ContextType >
virtual float grail::evaluator::Evaluator< ContextType >::Evaluate ( const ContextType &  context,
data::UtilityEvaluatorSnapshot *const  snapshot 
) const
protectedpure virtual

Evaluate - Called from EvaluateContext which also evaluates context, but without automatically filling snapshot with debug data. Should be overriden for each derived Evaluator.

Parameters
context- Input data for evaluation
snapshot- Evaluator snapshot containing debug data describing whole evaluator tree.
Returns
Numerical evaluation of provided context.

Implemented in grail::evaluator::Consideration< ContextType >, grail::evaluator::Curve< ContextType >, grail::evaluator::MaxAggregator< ContextType >, grail::evaluator::MinAggregator< ContextType >, grail::evaluator::AverageAggregator< ContextType >, grail::evaluator::ProductAggregator< ContextType >, and grail::evaluator::SumAggregator< ContextType >.

◆ EvaluateContext()

template<typename ContextType >
float grail::evaluator::Evaluator< ContextType >::EvaluateContext ( const ContextType &  context,
data::UtilityEvaluatorSnapshot *const  snapshot 
) const
inline

EvaluateContext - evaluates provided context and if provided snapshot is not empty, fills it with debug data describing this node.

Parameters
context- input data for evaluation
snapshot- evaluator snapshot containing debug data describing whole evaluator tree
Returns
evaluation score

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