The process of replication dominates the dynamics of the system. Here, we present an overview of the method by which programs reproduce, and we then discuss the exact implementation.
Reproduction in avida is typically carried out in four distinct processes:
The first three processes are implemented in the instruction set (and are thus the responsibility of the individual program), while the fourth process is automatically handled by the environment when a successful division takes place.
In a correctly self-replicating program (see the example program in the Virtual CPU section), the size of the allocated memory is typically exactly the program's size (doubling the total memory from its original size), with division occurring at its midpoint after the copying process is finished. In principle, there is no reason that a program could not use a different method (such as tripling its size, and making two copies of itself, or creating a self-extracting smaller program); however, the instruction set (and the handwritten ancestor) are biased towards the first method.
The reproduction system is separated into two conceptual parts: first, the generation of offspring, which is handled by individual cells; and second, the placement of offspring, which is handled by the interaction lattice or the world structure.
Placement of the offspring is done in a localized manner; the offspring of a program can only be placed within the immediate neighborhood of that program's location (the near eight grid positions on a 2-D lattice). First, an empty location is sought; if no free location exists, the oldest cell (in the default scheme) is chosen and replaced with the offspring. The search for the oldest cell includes the parent program; thus, a creature can actually cause itself to be killed by the placement of its child.
The process of placement is entirely a function of the environment; as soon as a successful division occurs, the new program is automatically placed. It is intrinsically part of the ``physics'' of the system, while the replication process itself (the allocation, copying, and division) is part of the instruction set.
In order to choose a method of placing a daughter cell, edit the ``Reproduction'' section of the genesis file (see the Configuration section). The BIRTH_METHOD variable determines how new offspring are placed, and this can have a large effect on the soup. If there are any empty cells available, they will always have top priority as possible locations. If none of the eight immediate cells connected to the mother are vacant, one of the surrounding creatures (or the mother herself) must be removed to make room for this new child. The options are:
Choosing a DEATH_METHOD for the soup is somewhat less complicated. In this version of avida, there are three methods available. The first is to simply turn death off such that creatures can only die from being replaced by a newborn, and not through old age. The second way is to fix the maximum number of instructions that any creature can execute, effectively giving them a finite lifetime akin to decay. Creatures that hit this age limit are replaced by empty space. This age limit is specified by the AGE_LIMIT variable. Finally, the last method is to have the maximum number of instructions a creature can execute be a multiple of that creature's length. If you select this method, the maximum number of instructions that a creature can live is its length multiplied by AGE_LIMIT.
NEXT: The Virtual CPU
PREV: Time Slicing and the Fitness Landscape
Page maintained by Charles Ofria
Send all comments to
charles@krl.caltech.edu