Hi,
As GAMA provides all classic structures of a programming language (loop, test...), it is of course possible to implement a greedy approach.
Just to be sure: can you give a more details example of what you mean by the best place on the road shapefile (with a drawing if possible :) ).
However, you can just created all your agents, then make a loop on all of them. One solution :
create agentA number: 100;
create agentB number: 100;
geometry possible_place <- .... //initial possible locations for the agents, can be the union of road geometries, or the same geometry as in the last example
geometry possible_place_agentA <- copy(possible_place);
geometry possible_place_agentB <- copy(possible_place);
ask shuffle(agentA + agentB) {
if (species(self) = agentA) {
location <- .... //choose the best place in possible_place_agentA;
possible_place_agentA <- possible_place_agentA - (shape + distance_same_species);
possible_place_agentB <- possible_place_agentB - (shape + distance_different_species);
else {
location <- .... //choose the best place in possible_place_agentB;
possible_place_agentB <- possible_place_agentB - (shape + distance_same_species);
possible_place_agentA <- possible_place_agentA - (shape + distance_different_species);
}
}
Cheers,
Patrick