B.A.R.G.A.M.E.  v2.0
El Farol Bar Problem Implementation
 All Classes Namespaces Files Functions Variables Typedefs Defines
Public Member Functions | Protected Attributes
Group Class Reference

Group Class. More...

List of all members.

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.

Detailed Description

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"


Constructor & Destructor Documentation

Default Agent Constructor.

Default constructor NOT utilized within code.

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.

Parameters:
numpnumber of people going to be in the group
numbnumber of bars in the simulation
avgAgeaverage death age of Agents within this group
dropthe threshold value at which an Agent drops a strategy
Precondition:
0 < nump < 2*numOfBars, 0 < numb < 256 , 0 < avgAge < 100, 0 < drop < 100, A Town ohject as well as all Agent and Bar ojects have been previously initialized. There is a limit of: numberOfAgents / (2*numberOfBars) initialized groups within the simulation. No more will be created beyond this number.
Postcondition:
One group within the Agent population has been assigned to a certain number of Agents.
Group::Group ( int  nump,
int  numb 
)

Group Constructor (No Agents initially Assigned to group)

Description: Initializes a Group within a Simulation profile.

Parameters:
numpnumber of people going to be in the graph
numbnumber of bars in the simulation
Precondition:
0 < nump < 2*numOfBars, 0 < numb < 256 , 0 < avgAge < 100, 0 < drop < 100, A Town ohject as well as all Agent and Bar ojects have been previously initialized. There is a limit of: numberOfAgents / (2*numberOfBars) initialized groups within the simulation. No more will be created beyond this number.
Postcondition:
An empty group has been created.

Member Function Documentation

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,

Parameters:
avgAgeaverage death age of Agents within this group
dropthe threshold value at which an Agent drops a strategy
Precondition:
A new Agent instance has just been created and at least one group within the population is not at full capacity.
Postcondition:
The newly created Agent has been assigned to a group
Note:
This function is called at any time a new Agent is created.
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,

Parameters:
fA reference to an Agent object.
Precondition:
At least 1 Agent instance exists and at least one group within the population is not at full capacity.
Postcondition:
An Agent that already exists within the population has been assigned to a group
Note:
Used to copy an already existing Agent in the population.

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.

Precondition:
A group has been initialized
Postcondition:
The number of people in the given group has been returned.
Returns:
An integer representing the number of Agents within the specified group.
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.

Parameters:
gPointer to integer that keeps track of dead people.
stuffPointer to structure holding data for graphs
Precondition:
The given group has been initialized.
Postcondition:
None.
Returns:
A boolean representing whether the specified group contains a NULL set of Agents.
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.

Parameters:
STIpointer 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.
Precondition:
A turn has just begun.
Postcondition:
A Bar to visit for the given turn has been decided.
Returns:
The Bar number to visit the specified group will visit for the given turn.
Note:
This function is based on the assumption that friends of a group would always want to stick together when they go to a bar.
See also:
See also: Agent::isGoingToBar(int)
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.

Parameters:
winnersholds 1 if bar won 0 if bar lost
STMShort Term Memory
gTEMP
Precondition:
Bars have decided if they won the current round.
Postcondition:
Strategies score of agent has been updated appropriately and strategies have been replaced of necessary.
Returns:
Strategy pointer referencing maxScore and avgScore

Member Data Documentation

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.

Note:
This attribute is utilized in isGoingToBar() 's secondary decision of how many times each Agent has had a good time at each proposed bar.
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.


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