262
X-Machines for Agent-Based Modeling: FLAME Perspectives
return 0;
}
/** \fn Firm_3()
* \brief Calculates the total wage bill of the workers,
* lowest price of the goods, and the amount of stock
*/
__FLAME_GPU_FUNC__ int Firm_3(xmachine_memory_Firm* agent,
xmachine_message_employed_list* employed_messages,
xmachine_message_firm_stock_price_list* firm_stock_price_messages,
RNG_rand48* rand48)
{
float wage_bill = 0.0f;
float lowest_price = 0.0f;
agent->workersize=0;
/* Reset the hired worker lists to zero */
//xmemory->workerid.size = 0;
//xmemory->workerwage.size = 0;
float random_no=rnd(rand48);
int mall_chosen;
//int workeridarray[20];
//float workerwagearray[20];
/* Read employment messages */
xmachine_message_employed* current_message = get_first_employed_message
(employed_messages);
while(current_message)
{
/* If the employment message refers to this worker */
if(agent->id == current_message->firm_id)
{
/* Update workers firm id */
//save upto 20 workers
if(agent->workersize<20)
{
agent->workersize=agent->workersize++;
wage_bill += current_message->person_wage;
}
}
/* Move onto next message to check */
current_message
= get_next_employed_message(current_message,employed_messages);
}
agent->numberofworkers=agent->workersize;
agent->avewage=wage_bill / agent->numberofworkers;
agent->totalwagebill=wage_bill;
/* calculate lowest price for goods - Refer to equation (5) */
lowest_price = wage_bill / (int)(agent->productivity);
/* save the old price of the goods before changing them */
agent->oldprice=agent->price;
/* Calculate new offer price - if the satisticing price is less than
the lowest price then set the price to the lowest price the firm can have.
This lowest price is the lowest the firm can keep to stop suffering losses
else use the satisficing price to gain profits
(Rule stated in the paper to prevent firm from suffering loss) */
if(agent->sprice < lowest_price)
X-Machines for Agent-Based Modeling: FLAME Perspectives
return 0;
}
/** \fn Firm_3()
* \brief Calculates the total wage bill of the workers,
* lowest price of the goods, and the amount of stock
*/
__FLAME_GPU_FUNC__ int Firm_3(xmachine_memory_Firm* agent,
xmachine_message_employed_list* employed_messages,
xmachine_message_firm_stock_price_list* firm_stock_price_messages,
RNG_rand48* rand48)
{
float wage_bill = 0.0f;
float lowest_price = 0.0f;
agent->workersize=0;
/* Reset the hired worker lists to zero */
//xmemory->workerid.size = 0;
//xmemory->workerwage.size = 0;
float random_no=rnd(rand48);
int mall_chosen;
//int workeridarray[20];
//float workerwagearray[20];
/* Read employment messages */
xmachine_message_employed* current_message = get_first_employed_message
(employed_messages);
while(current_message)
{
/* If the employment message refers to this worker */
if(agent->id == current_message->firm_id)
{
/* Update workers firm id */
//save upto 20 workers
if(agent->workersize<20)
{
agent->workersize=agent->workersize++;
wage_bill += current_message->person_wage;
}
}
/* Move onto next message to check */
current_message
= get_next_employed_message(current_message,employed_messages);
}
agent->numberofworkers=agent->workersize;
agent->avewage=wage_bill / agent->numberofworkers;
agent->totalwagebill=wage_bill;
/* calculate lowest price for goods - Refer to equation (5) */
lowest_price = wage_bill / (int)(agent->productivity);
/* save the old price of the goods before changing them */
agent->oldprice=agent->price;
/* Calculate new offer price - if the satisticing price is less than
the lowest price then set the price to the lowest price the firm can have.
This lowest price is the lowest the firm can keep to stop suffering losses
else use the satisficing price to gain profits
(Rule stated in the paper to prevent firm from suffering loss) */
if(agent->sprice < lowest_price)
