« first  « prev 

Jump to:


Emergent Behaviour and Artificial Life

1. Animal Deliveries



The Animal Kingdom simulation is interesting enough. It illustrates many emergent behaviours among populations of simple interacting artificial organisms. It isn't a very "real world" simulation though, and fails to demonstrate how we can design things using emergent behaviours. This section details the other demo program I developed: Animal Deliveries. This program illustrates how a complex task can be solved by a set of cooperating agents. The problem is best described using the rough sketch from my lab book shown in figure 15.

The Animal Deliveries problem
Figure 1: The Animal Deliveries problem


Basically the animals are replaced by two types of robot, water robots (boats) and land robots (trucks). The job of the robots is to deliver parcels from the left hand side of the world to the right. Cooperation is required as there is a big river in the middle of the map. Boats can not sail on land and trucks can not drive through water, but both can meet on a thin strip of beach on each side of the river, where parcels must be exchanged.

The task in hand is to develop some very simple rules for both types of robot to get them to deliver packages successfully. Figure 16 is a screen shot of the robots and the new tarmac world.


The Animal Deliveries world
Figure 2: The Animal Deliveries world


Listing 4 shows the behaviour for the Boat and Truck agents. Both types of agent have the same behaviour at the moment. If they are hungry (i.e. their batteries are running low) they head towards a charging point. Otherwise they head left. When they reach the far left edge of the map they randomly "search" for a parcel. When they reach a parcel they pick it up and head right. When they can not travel any further to the right they drop the parcel and head back towards the left to find another. The "Searching" boolean is an internal state variable which is used to control this behaviour.

procedure TBoat.ProcessTurn;
var
Charger : IThing;
Parcel : IThing;
begin
inherited ProcessTurn;

//References to anything interesting we might be stood on
Charger := Tile.ThingByType('TChargingStation');
Parcel := Tile.ThingByType('TParcel');

if Assigned(Charger) and not Carrying then
  Eat(Charger);

if IsHungry then
begin
 if Carrying then
   PutDown(Thing, Tile)
 else
  Move(TileTowardsChargingPoint(25));
end
else if Carrying then
begin
  if not CanSurviveOn(Tile.EastTile) then
    PutDown(Thing, Tile)
  else
    Move(TileInGeneralDirection(2));
end
else if Seeking and Assigned(Parcel) then
begin
  Pickup(Parcel, Tile);
end
else if not Seeking then
begin
  if not CanSurviveOn(Tile.WestTile) then
    Seeking := True
  else
    Move(TileInGeneralDirection(6));
end
else
begin
  Move(RandomTile);
end;
end;


Figure 17 shows the Animal Deliveries simulation running. Note that even though there is no global control for the simulation and the robots are incapable of communicating and have no understanding of the size and topology of the environment in which they live, they are still able to cooperate to deliver the parcels to the right hand side of the map. Green blobs are parcels, red blobs are trucks, light blue blobs are boats and the white blobs correspond to charging stations - though these are not used properly yet.

The Animal Deliveries simulation running.  Trucks are red, boats are blue and parcels are green
Figure 3: The Animal Deliveries simulation running. Trucks are red, boats are blue and parcels are green


As you can see, the parcels appear in the left hand 6th of the world and are quickly dispatched to the right hand side. In order to do this I had to implement two new types of tile: Depot tiles, where parcels can be dropped off and Beach tiles, which can be occupied by both boats and trucks (in order to allow for parcel changeover). Figure 18 shows a picture of trucks and boats exchanging parcels on the left hand beach:

Trucks and boats exchanging parcels on the left hand beach
Figure 4: Trucks and boats exchanging parcels on the left hand beach


Figure 19 is a picture of trucks dropping off parcels on the right hand side of the map:

Trucks dropping off parcels on the right hand side of the map
Figure 5: Trucks dropping off parcels on the right hand side of the map


2. Downloads



Feel free to download, play with, alter and extend the demo programs as you see fit. If you manage to generate any interesting behaviours or would like to discuss the software then feel free to get in touch via email or the Logical Genetics Forums. I'd be very interested to hear from anyone who has created more animal classes or demonstrated any interesting new emergent behaviours.

Animals.zip - A Zip archive of all the Delphi code for the project (3.06Mb)

« first  « prev 

Jump to: