194
X-Machines for Agent-Based Modeling: FLAME Perspectives
Y=Y+random_int(1,10);
if(Y>15)
{
Y=Y-5;
}
COMPARTMENT_ID=next_id;//moving right
}
}
}
TIME_LAST_MOVE=TIME_COUNTER;
}
TIME_COUNTER++;
return 0;
}
/**** Source Agent Functions***/
int Source_basic_posts()
{
TIMECOUNTER++;
return 0;
}
int Source_idle()
{
return 0;
}
int Source_decaying()
{
double temp_double=0.0;
if(TIMECOUNTER>SOURCETIMEDECAY)
{
temp_double=LIFE*SOURCEDECAYRATE;
LIFE=LIFE - temp_double;
}
return 0;
}
int Source_producing()
{
double temp=0.0;
double source_production=0.0;
double temp_time=0.0;
int i=0;
if(TIMECOUNTER>SOURCETIMEPRODUCE)
{
temp=random_double(0.0,1.0);
if(TIMECOUNTER>SOURCETIMEDECAY) //OLD case
{
temp_time=TIMECOUNTER-SOURCETIMEDECAY;
temp_time=-1*(temp_time/540);
source_production=CONSTANT * exp(temp_time);
}
else
{
source_production=SOURCE_PRODUCTION_PROB;
}
Précédent

- 223/329

Suivant