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

Base class being able to evaluate given context and output the result. More...

Inheritance diagram for Grail.Evaluators.Evaluator< ContextType >:

Public Member Functions

float EvaluateContext (ContextType context, in UtilityEvaluatorSnapshot snapshot)
 Evaluates provided context and if provided snapshot is not empty, fills it with debug data describing this node. More...
 
abstract void GetDependentConsiderations (List< Consideration< ContextType >> considerations)
 

Static Public Member Functions

static void CacheConsiderationEvaluations (Evaluator< ContextType > evaluator, ContextType context)
 

Protected Member Functions

abstract float Evaluate (ContextType context, in UtilityEvaluatorSnapshot snapshot)
 Called from EvaluateContext which also evaluates context, but without automatically filling snapshot with debug data. Should be overriden for each derived Evaluator. More...
 
abstract void DebugDump (IReadOnlyDictionary< object, int > nodeMapping, ref EvaluationDebugData debugData)
 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...
 

Properties

abstract EvaluatorType EvaluatorType [get]
 

Detailed Description

Base class being able to evaluate given context and output the result.

Template Parameters
ContextType

Member Function Documentation

◆ DebugDump()

abstract void Grail.Evaluators.Evaluator< ContextType >.DebugDump ( IReadOnlyDictionary< object, int >  nodeMapping,
ref EvaluationDebugData  debugData 
)
protectedpure virtual

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
nodeMappingMaps node pointers to node index.
debugDataEvaluation debug data which will be filled in this method.

Implemented in Grail.Evaluators.Curves.Curve< ContextType >, Grail.Evaluators.Consideration< ContextType >, and Grail.Evaluators.Aggregators.Aggregator< ContextType >.

◆ Evaluate()

abstract float Grail.Evaluators.Evaluator< ContextType >.Evaluate ( ContextType  context,
in UtilityEvaluatorSnapshot  snapshot 
)
protectedpure virtual

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

Parameters
contextInput data for evaluation.
snapshotEvaluator snapshot containing debug data describing whole evaluator tree.
Returns
Numerical evaluation of provided context.

Implemented in Grail.Evaluators.Consideration< ContextType >, Grail.Evaluators.Curves.Curve< ContextType >, Grail.Evaluators.Aggregators.AverageAggregator< ContextType >, Grail.Evaluators.Aggregators.MaxAggregator< ContextType >, Grail.Evaluators.Aggregators.MinAggregator< ContextType >, Grail.Evaluators.Aggregators.ProductAggregator< ContextType >, and Grail.Evaluators.Aggregators.SumAggregator< ContextType >.

◆ EvaluateContext()

float Grail.Evaluators.Evaluator< ContextType >.EvaluateContext ( ContextType  context,
in UtilityEvaluatorSnapshot  snapshot 
)
inline

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

Parameters
contextInput data for evaluation.
snapshotEvaluator snapshot containing debug data describing whole evaluator tree.
Returns
Evaluation score.

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