B.A.R.G.A.M.E.
v2.0
El Farol Bar Problem Implementation
|
Public Member Functions | |
Strategy () | |
Default Strategy Constructor. | |
~Strategy () | |
Strategy Destructor. | |
Strategy (int numbars) | |
Strategy Constructor. | |
Strategy (Strategy *s) | |
Strategy Copy Constructor. | |
double | getScore () |
Returns a Strategy's current score. | |
int | getBar (long sti) |
double | updateScore (int i) |
Updates a given STM strategy i. | |
int | getStrat (int shortterm) |
returns the strategy to be used by Agent for a given turn. | |
int | hash (int shortterm) |
Randomizes keys. | |
Public Attributes | |
int | st [2048] |
Short Term Structure. | |
double | score |
A strategies Score. |
Strategy Class.
This class is the computaional unit of the Strategies utilized by the Agent Objects. It has simple get functions but also functions which updates and chooses stategies based on their respective score where their score respresents a strategies performance throughout the simulation
Default Strategy Constructor.
Default constructor NOT utilized within code.
Strategy Destructor.
Destructor
Strategy::Strategy | ( | int | numbars | ) |
Strategy Constructor.
Description: Strategy Constructor that is utilized by the Agent class.
numbars | indicates how many bars are present for the given simulation profile. |
Strategy::Strategy | ( | Strategy * | s | ) |
int Strategy::getBar | ( | long | sti | ) |
Description: Returns which bar number the Agent will go to for a given round. This is our hashing function.
sti | short term index |
double Strategy::getScore | ( | ) |
int Strategy::getStrat | ( | int | shortterm | ) |
returns the strategy to be used by Agent for a given turn.
Description: Gets either strategy 0, 1, or, 2 because each Agent has 3 strategies to choose from.
int Strategy::hash | ( | int | shortterm | ) |
Randomizes keys.
Description: Randomizes keys that are greater than 2048 in order to attempt to minimize memory usage. Is an explicit Hash function.
shortterm | the value that is greater than 2048 (2^11) |
double Strategy::updateScore | ( | int | i | ) |
Updates a given STM strategy i.
Description: A strategies previous score is updated for a given turn.
i | One of the STM stragtegies stored in strats[] |
double Strategy::score |
A strategies Score.
Contains the score of a strategy
int Strategy::st[2048] |
Short Term Structure.
The structure used to store all possible STM combinations