B.A.R.G.A.M.E.
v2.0
El Farol Bar Problem Implementation
|
Public Member Functions | |
Group () | |
Default Agent Constructor. | |
~Group () | |
Agent Destructor. | |
Group (int nump, int numb, int avgAge, int drop) | |
Group Constructor (creates group with Agents assigned) | |
Group (int nump, int numb) | |
Group Constructor (No Agents initially Assigned to group) | |
int | isGoingToBar (int STI) |
Groups decision of which Bar to visit for a given round. | |
int | getNumPeeps () |
Number of people in a griven group. | |
void | addAgent (int avgAge, int drop) |
Adding a new person to an existing group. | |
void | addAgent (Agent *f) |
Adding a new person to an existing group. | |
bool | isEmpty (int *g, pass_graph *stuff) |
Determines if a group is empty. | |
Strategy ** | tellWins (int *winners, int STM, int *g) |
Group attribute Updater. | |
Protected Attributes | |
Agent ** | peeps |
Agent Holding Structure. | |
int | numPeeps |
Number of Agents within Group. | |
int | numBars |
Number Of Bars. | |
int * | LTM |
Groups LTM. | |
int | avgAge |
Average Age. |
Group Class.
This is the Group class which contains the new needed member functions which make the group option in our Simulation Application be available to be selected as an additional "Population Variable" by the user to affect the simulation with "Group Behavior"
Group::Group | ( | ) |
Default Agent Constructor.
Default constructor NOT utilized within code.
Group::~Group | ( | ) |
Agent Destructor.
Deletes a group, when the set of ALL Agents within the group is NULL.
Group::Group | ( | int | nump, |
int | numb, | ||
int | avgAge, | ||
int | drop | ||
) |
Group Constructor (creates group with Agents assigned)
Description: Initializes a Group within a Simulation profile.
nump | number of people going to be in the group |
numb | number of bars in the simulation |
avgAge | average death age of Agents within this group |
drop | the threshold value at which an Agent drops a strategy |
Group::Group | ( | int | nump, |
int | numb | ||
) |
Group Constructor (No Agents initially Assigned to group)
Description: Initializes a Group within a Simulation profile.
nump | number of people going to be in the graph |
numb | number of bars in the simulation |
void Group::addAgent | ( | int | avgAge, |
int | drop | ||
) |
Adding a new person to an existing group.
Description: This function adds a newly created person to an existing group during the propagation of an ongoing simulation,
avgAge | average death age of Agents within this group |
drop | the threshold value at which an Agent drops a strategy |
void Group::addAgent | ( | Agent * | f | ) |
Adding a new person to an existing group.
Description: This function adds a newly created person to an existing group during the propagation of an ongoing simulation,
f | A reference to an Agent object. |
int Group::getNumPeeps | ( | ) |
Number of people in a griven group.
Description: Returns an integer representing the number of people currently within a group for any given time during a simulation.
bool Group::isEmpty | ( | int * | g, |
pass_graph * | stuff | ||
) |
Determines if a group is empty.
Description: This function returns a boolean of whether or not the specified group is or is NOT empy. Where empty represents a NULL set of Agents.
g | Pointer to integer that keeps track of dead people. |
stuff | Pointer to structure holding data for graphs |
int Group::isGoingToBar | ( | int | STI | ) |
Groups decision of which Bar to visit for a given round.
Description: Variation of an Agent's isGoingToBar() function. This function takes a consensus of all agents within the given group and decides to which Bar the given group would attend.
STI | pointer to short term index of the combined Agents best scoring strategy's. If there is a tie, it is broken by comparing which bar has resulting in Agents having a better time for past turns. If that factor is also a tie then it is randomly assigned. |
Strategy** Group::tellWins | ( | int * | winners, |
int | STM, | ||
int * | g | ||
) |
Group attribute Updater.
Description: This function takes in an array of the current turn bar winners and the current STM, it then uses this information to update Strategy scores (in this case the groups) and if score drops below predefined threshold the strategy is replaced with another. It then returns needed variables. to the GUI.
winners | holds 1 if bar won 0 if bar lost |
STM | Short Term Memory |
g | TEMP |
int Group::avgAge [protected] |
Average Age.
Indicates what the Gaussian Mean should be for the entire Simulation profile.
int* Group::LTM [protected] |
Groups LTM.
A pointer containing the long term memory which stores how many times an Agent has had a good time at certain bar so far in the simulation.
int Group::numBars [protected] |
Number Of Bars.
Indicates how many bars are present in the Simulation
int Group::numPeeps [protected] |
Number of Agents within Group.
Indicates the number of Agents currently within the group.
Agent** Group::peeps [protected] |
Agent Holding Structure.
This structure contains all the Agents currently in the group.