FLAME’s Future
261
agent->a=agent->a + ((1.0 - agent->f)* agent->profits);
mean = agent->f /(agent->price * agent->productivity);
agent->productivity=agent->productivity + CHANGEINPRODUCTIVITY;
if(random_no<0.5)
{
if((agent->stock == 0) && (agent->goodsproduced > 0))
{
agent->sprice=agent->price *(1.0 + random_no);
}
if((agent->stock > 0) || (agent->goodsproduced == 0))
{
agent->sprice=agent->price *(1.0 - random_no);
}
}
else
{
if((agent->stock == 0) && (agent->goodsproduced > 0))
{
agent->production=agent->production * (1.0 + random_no);
}
if(agent->stock > 0)
{
agent->production=agent->production * (1.0 - random_no);
}
}
agent->labour= (int)(agent->production/agent->productivity);
if(agent->labour < 1)
{
agent->labour=1;
}
/* Apply to a random Mall */
mall_chosen=floor(GetRandomNumber(1,MALLSNO+1,rand48));
if(mall_chosen>0)
{
agent->mall_vacancy=mall_chosen;
add_vacancy_message(vacancy_messages,agent->id, agent->labour,
agent->mall_vacancy, MESSAGE_RANGE, agent->x, agent->y, 0.0f);
}
else
{
agent->mall_vacancy=0;
}
return 0;
}
__FLAME_GPU_FUNC__ int Firm_1_b(xmachine_memory_Firm* agent,
xmachine_message_priceinflation_list* priceinflation_messages)
{
/* Post message of the price inflation (calculated as a
// difference between the previous and present price)
This is later used to calculate the wages of the workers */
add_priceinflation_message(priceinflation_messages, agent->id,
agent->priceinflation, MESSAGE_RANGE, agent->x, agent->y, 0.0f);
261
agent->a=agent->a + ((1.0 - agent->f)* agent->profits);
mean = agent->f /(agent->price * agent->productivity);
agent->productivity=agent->productivity + CHANGEINPRODUCTIVITY;
if(random_no<0.5)
{
if((agent->stock == 0) && (agent->goodsproduced > 0))
{
agent->sprice=agent->price *(1.0 + random_no);
}
if((agent->stock > 0) || (agent->goodsproduced == 0))
{
agent->sprice=agent->price *(1.0 - random_no);
}
}
else
{
if((agent->stock == 0) && (agent->goodsproduced > 0))
{
agent->production=agent->production * (1.0 + random_no);
}
if(agent->stock > 0)
{
agent->production=agent->production * (1.0 - random_no);
}
}
agent->labour= (int)(agent->production/agent->productivity);
if(agent->labour < 1)
{
agent->labour=1;
}
/* Apply to a random Mall */
mall_chosen=floor(GetRandomNumber(1,MALLSNO+1,rand48));
if(mall_chosen>0)
{
agent->mall_vacancy=mall_chosen;
add_vacancy_message(vacancy_messages,agent->id, agent->labour,
agent->mall_vacancy, MESSAGE_RANGE, agent->x, agent->y, 0.0f);
}
else
{
agent->mall_vacancy=0;
}
return 0;
}
__FLAME_GPU_FUNC__ int Firm_1_b(xmachine_memory_Firm* agent,
xmachine_message_priceinflation_list* priceinflation_messages)
{
/* Post message of the price inflation (calculated as a
// difference between the previous and present price)
This is later used to calculate the wages of the workers */
add_priceinflation_message(priceinflation_messages, agent->id,
agent->priceinflation, MESSAGE_RANGE, agent->x, agent->y, 0.0f);
