Grail (C#)  1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.Evolution.Arena Class Referenceabstract

Public Member Functions

abstract void Evaluate (List< EvoScript > onceEvaluatedList, List< EvoScript > neverEvaluatedList)
 This function's responsibility is to evaluate EvoScripts and assign the value to them using the [.Fitness] getter. If your method of evaluation is deterministic and absolute (i.e. fitness only depends on the EvoScript object itself) then you might ignore the @onceEvaluatedList. If your method is non-deterministic or relative (e.g., tournament-based) to the whole population, then you might evaluate @onceEvaluatedList again within the scope of the current population. More...
 

Protected Member Functions

virtual void TwoPlayerTournamentSelection (List< EvoScript > bots, int trialCount, float maxScoreInTrial, Func< EvoScript, EvoScript, float > compareTwoFunction, Random random)
 A helper method that will: for each bot in @bots test it against randomly chosen @trialCount another bots and call the compareTwoFunction to score the bot. This function will assign Fitness to each bot based on the average score obtained in the process. More...
 

Detailed Description

The Arena class is an interface for the evaluator of the quality of players represented by EvoScripts. It is used either stand-alone or in the in the evaluation phase of Evolutionary Algorithm optimization

Member Function Documentation

◆ Evaluate()

abstract void Grail.Evolution.Arena.Evaluate ( List< EvoScript onceEvaluatedList,
List< EvoScript neverEvaluatedList 
)
pure virtual

This function's responsibility is to evaluate EvoScripts and assign the value to them using the [.Fitness] getter. If your method of evaluation is deterministic and absolute (i.e. fitness only depends on the EvoScript object itself) then you might ignore the @onceEvaluatedList. If your method is non-deterministic or relative (e.g., tournament-based) to the whole population, then you might evaluate @onceEvaluatedList again within the scope of the current population.

Parameters
onceEvaluatedListEvoScript objects that have been evaluated at least once in previous iterations. The evaluation might need to be updated.
neverEvaluatedListEvoScript objects that have never been evaluated. Assign Fitness to them in this method.

◆ TwoPlayerTournamentSelection()

virtual void Grail.Evolution.Arena.TwoPlayerTournamentSelection ( List< EvoScript bots,
int  trialCount,
float  maxScoreInTrial,
Func< EvoScript, EvoScript, float >  compareTwoFunction,
Random  random 
)
inlineprotectedvirtual

A helper method that will: for each bot in @bots test it against randomly chosen @trialCount another bots and call the compareTwoFunction to score the bot. This function will assign Fitness to each bot based on the average score obtained in the process.

Parameters
botsThe population of bots to be tested.
trialCountThe number of times, each bot is tested against some subset of population.
maxScoreInTrialThe maximum score that a bot can get in a single test.
compareTwoFunctionThe function that tests a pair of bots and returns score from the first one's perspective.
randomRandom numbers generator.

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