220
X-Machines for Agent-Based Modeling: FLAME Perspectives
add_pheromoneIncreased_message(pheromoneInformation_message->
pheromoneID, antPheromoneDepositionUnit); //0.0496
}
}
pheromoneInformation_message = get_next_pheromoneInformation_message
(pheromoneInformation_message);
}
return 0;
}
int depositPheromone()
{
//printf("phero not found, create one at ant coordinates %f %f\n" ,ANTX,ANTY);
add_newPheromoneInput_message(ANTX, ANTY);
return 0;
}
//Pheromone agent
//decrease pheromoneLife at each iteration
int decreasePheromoneLife() {
if (LIFE >= 0.02) {
LIFE = LIFE - (pheromoneDecay * LIFE);
}
if (LIFE < 0.02) { //pheromone evaporated
return 1;
}
return 0;
}
//Pheromone agent
//increases the life of a previously deposited pheromone at a specific location
int increasePheromoneLife() {
pheromoneIncreased_message = get_first_pheromoneIncreased_message();
while (pheromoneIncreased_message) {
int localPheromoneID = pheromoneIncreased_message->pheromoneID;
if (localPheromoneID == PHEROMONEID) {
LIFE = LIFE + pheromoneIncreased_message->increase;
}
pheromoneIncreased_message = get_next_pheromoneIncreased_message
(pheromoneIncreased_message);
}
return 0;
}
//Generator agent
//produces a pheromone agent dynamically
//prevents duplicate deposition
int produce() {
newPheromoneInput_message = get_first_newPheromoneInput_message();
struct Data data;
data.maxIndex = 0;
while (newPheromoneInput_message)
{
double x = newPheromoneInput_message->pheromoneX;
double y = newPheromoneInput_message->pheromoneY;
int found = 0;
for (int i = 0; i < data.maxIndex; i++)
X-Machines for Agent-Based Modeling: FLAME Perspectives
add_pheromoneIncreased_message(pheromoneInformation_message->
pheromoneID, antPheromoneDepositionUnit); //0.0496
}
}
pheromoneInformation_message = get_next_pheromoneInformation_message
(pheromoneInformation_message);
}
return 0;
}
int depositPheromone()
{
//printf("phero not found, create one at ant coordinates %f %f\n" ,ANTX,ANTY);
add_newPheromoneInput_message(ANTX, ANTY);
return 0;
}
//Pheromone agent
//decrease pheromoneLife at each iteration
int decreasePheromoneLife() {
if (LIFE >= 0.02) {
LIFE = LIFE - (pheromoneDecay * LIFE);
}
if (LIFE < 0.02) { //pheromone evaporated
return 1;
}
return 0;
}
//Pheromone agent
//increases the life of a previously deposited pheromone at a specific location
int increasePheromoneLife() {
pheromoneIncreased_message = get_first_pheromoneIncreased_message();
while (pheromoneIncreased_message) {
int localPheromoneID = pheromoneIncreased_message->pheromoneID;
if (localPheromoneID == PHEROMONEID) {
LIFE = LIFE + pheromoneIncreased_message->increase;
}
pheromoneIncreased_message = get_next_pheromoneIncreased_message
(pheromoneIncreased_message);
}
return 0;
}
//Generator agent
//produces a pheromone agent dynamically
//prevents duplicate deposition
int produce() {
newPheromoneInput_message = get_first_newPheromoneInput_message();
struct Data data;
data.maxIndex = 0;
while (newPheromoneInput_message)
{
double x = newPheromoneInput_message->pheromoneX;
double y = newPheromoneInput_message->pheromoneY;
int found = 0;
for (int i = 0; i < data.maxIndex; i++)
