Evaluator

Evaluator’s role is to provide a score deduced by considering data stored inside a Context. Contexts can take form of any built-in or user-defined data type. Most often AIControlledEntity or pair of AIControlledEntity and Blackboard are passed as evaluator Context

Evaluator’s score takes form of two values
  • weight - a measure of how suitable is evaluated object, considering current Context.

  • rank - evaluated object priority (the higher the rank, the bigger importance of evaluated object)

Weight aggregation can be executed with one of the following functions
  • min

  • max

  • average

  • sum

  • product

IEvaluator<Context>

A template interface which allows the user to define their own method of calculating both rank and weight in terms of provided Context.

UtilityEvaluator<Context>

Grail’s standard evaluator. Requires user to provide evaluation method and list / vector of considerations paired with curves. This evaluator Context type should be the same as all of it’s considerations' Context's types.

Weight

To calculate weight, UtilityEvaluator gathers all provided considerations and passes them through corresponding evaluation functions - usually curves.

Then those scores are aggregated by one of the following evaluation functions
  • min

  • max

  • average

  • sum

  • product

Rank

UtilityEvaluators rank is equal to highest rank of it’s considerations.

Example

Let’s consider that we evaluate object based on two considerations.
  • entity’s health

  • distance from opponent

Assuming that both considerations have a rank of 0. Scores gotten from health and distance considerations are respectively equal 1 and 1.5.

User has chosen to aggregate score by taking their product, so final values are as follow
  • weight = 1.5

  • rank = 0

But, if we really need to take care of agent’s health, we can change it’s rank to 1, we will indicate that evaluated object is more important and score values will change.
  • weight = 1.5

  • rank = 1