The main interface class for the SimulatedGame model based on the MCTS algorithm. The class supports definition of a game, running simulations and obtaining results.
More...
|
| SimulatedGame (int teamCount=2, double maxGameScore=1.0, double explorationBoost=1.0, uint freezeVisitsTreshold=uint.MaxValue) |
| Constructs a new SimulatedGame object. This object can be reused. More...
|
|
int | Run (uint milisecondsTotal=30000, uint maxIterationCount=100000, SimulatedGameObserverForGUI observer=null) |
| Performs simulations of the game. Pass the available time for computations and the maximum number of iterations. Both parameters have relatively high default values. The method returns when at least one termination condition occurs. More...
|
|
void | ClearStatistics () |
| This method invalidates the tree built for the game. If any offline learners were attached, their gathered data is cleared too. This method effectively reverts all changes done by the Run() method. More...
|
|
SimulatedGameThinkingUnit | AddUnit (SimulatedGameThinkingUnit unit) |
| Adds a new regular unit to the game. More...
|
|
SimulatedGameStochasticUnit | AddUnit (SimulatedGameStochasticUnit unit) |
| Adds a new stochastic (performing random actions) unit to the game. More...
|
|
void | RemoveUnit (SimulatedGameThinkingUnit unit) |
| Removes a regular unit from the game Might be useful when the game object is reused for different situations. More...
|
|
void | RemoveUnit (SimulatedGameStochasticUnit unit) |
| Removes a stochastic (performing random actions) unit to the game. Might be useful when the game object is reused for different situations. More...
|
|
Dictionary< ISimulatedGameUnit, List< ISimulatedGameAction > > | GetExpectedPlans () |
| Call this method after certain number of iterations performed (by calling Run() first). More...
|
|
Dictionary< ISimulatedGameUnit, List< SimulatedGameActionMetadata > > | GetExpectedPlansWithMetadata () |
| Call this method after certain number of iterations performed (by calling Run() first). More...
|
|
Dictionary< ISimulatedGameAction, SimulatedGameActionMetadata > | GetStartingUnitActionsMetadata () |
| Call this method after certain number of iterations performed (by calling Run() first). More...
|
|
ISimulatedGameAction | GetStartingUnitBestAction () |
| Call this method after certain number of iterations performed (by calling Run() first). More...
|
|
List< Tuple< ISimulatedGameUnit, ISimulatedGameAction > > | GetExpectedPlayout () |
| Call this method after certain number of iterations performed (by calling Run() first). More...
|
|
The main interface class for the SimulatedGame model based on the MCTS algorithm. The class supports definition of a game, running simulations and obtaining results.
◆ SimulatedGame()
Grail.Simulation.SimulatedGame.SimulatedGame |
( |
int |
teamCount = 2 , |
|
|
double |
maxGameScore = 1.0 , |
|
|
double |
explorationBoost = 1.0 , |
|
|
uint |
freezeVisitsTreshold = uint.MaxValue |
|
) |
| |
|
inline |
Constructs a new SimulatedGame object. This object can be reused.
- Parameters
-
teamCount | This is the number of intelligent players in the game. Each team shares the score that is given when the game ends. |
maxGameScore | The maximum score that can be awarded to a team when the game ends. This value does not need to be given precisely or even correctly. However, the closer to the correct maximum value, the better for the algorithm's efficiency. |
explorationBoost | A modifier that affects how much exploration of state-space is boosted compared to the default value of 1. e Values lower than 1.0 will reduce the exploration. Values lower than 0.1 will be clamped to 0.1. |
freezeVisitsTreshold | When a certain state is visited at least this number of times, then the best action so far will be fixed as the final chosen action (no more exploration here). |
◆ AddUnit() [1/2]
Adds a new stochastic (performing random actions) unit to the game.
///
- Parameters
-
- Returns
- Returns the added unit.
◆ AddUnit() [2/2]
Adds a new regular unit to the game.
- Parameters
-
- Returns
- Returns the added unit.
◆ ClearStatistics()
void Grail.Simulation.SimulatedGame.ClearStatistics |
( |
| ) |
|
|
inline |
This method invalidates the tree built for the game. If any offline learners were attached, their gathered data is cleared too. This method effectively reverts all changes done by the Run() method.
◆ GetExpectedPlans()
Call this method after certain number of iterations performed (by calling Run() first).
- Returns
- List of actions per unit that have are the most promising and probable.
◆ GetExpectedPlansWithMetadata()
Call this method after certain number of iterations performed (by calling Run() first).
- Returns
- List of actions per unit with additional statistics that have are the most promising and probable.
◆ GetExpectedPlayout()
Call this method after certain number of iterations performed (by calling Run() first).
- Returns
- List of ordered pairs (unit, action) that have are the most promising and probable.
◆ GetStartingUnitActionsMetadata()
Call this method after certain number of iterations performed (by calling Run() first).
- Returns
- Currently available actions of the starting unit with additional statistics
◆ GetStartingUnitBestAction()
Call this method after certain number of iterations performed (by calling Run() first).
◆ RemoveUnit() [1/2]
Removes a stochastic (performing random actions) unit to the game. Might be useful when the game object is reused for different situations.
◆ RemoveUnit() [2/2]
Removes a regular unit from the game Might be useful when the game object is reused for different situations.
◆ Run()
int Grail.Simulation.SimulatedGame.Run |
( |
uint |
milisecondsTotal = 30000 , |
|
|
uint |
maxIterationCount = 100000 , |
|
|
SimulatedGameObserverForGUI |
observer = null |
|
) |
| |
|
inline |
Performs simulations of the game. Pass the available time for computations and the maximum number of iterations. Both parameters have relatively high default values. The method returns when at least one termination condition occurs.
- Parameters
-
milisecondsTotal | The time allowed for iterations in miliseconds. |
maxIterationCount | The number of iterations to perform. |
observer | ISimulatedGameObserver object that provides additional feedback from simulations. Used for GUI tools debugging; warning: comes with computational overhead. Pass null for high-performance execution. |
- Returns
- Returns the number of iterations performed.
◆ StartingUnit
Gets or sets the unit that acts first in the starting state of the game.
The documentation for this class was generated from the following file:
- GrailSimulatedGames/source/SimulatedGames/Core/SimulatedGame.cs