NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo User Community Models

(back to the NetLogo User Community Models)


by David McAvity (Submitted: 06/23/2006)

[screen shot]

Download Fitness_Landsacape
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

(You can also run this model in your browser, but we don't recommend it; details here.)


Fitness Landscape is a NetLogo model that illustrates the principle of evolution as movement of a species through a fitness landscape over time. One imagines that the phenotype of a species is specified by two quantitative varibles, and that the fitness of this species depends on the values of these variables (for example, the fitness of a species of bird might depend on beak size and body mass). For some values of these variables the fitness is high, for others it is low. As individuals from a group die and others reproduce the species drifts acrosss the landscape towards fitness peaks.


The fitness is indicated on the world view by color, with white being high and dark low. The x and y axis represent the two variables that specify the phenotype of the turtles. The landscape in this model is generated by randomly assigning each patch a fitness value and then smoothing the landscape to the desired degree of smoothness by
diffusing the fitness variable between patches a number of times specfied by the smoothness slider on the interface. The range variable on the interface specifies the difference between the maximum fitness and minimum fitness -- this effectively sets the steepness of the fitness slopes.

At the start of the simulation a number of turtles are generated in a small circle near the center of the landscape. The radius of the circle represents the initial variation of the phenotypic variables (For example if these variables represent beak size and body mass then each turtle has slightly different natural beak size and bodymass). The turtles age by one each time step and have a probability of dying which depends on their age and their fitness as determined by the patch they are on. Specifically, if they are older than a random number between 0 and their fitness then they die. Thus as they age they are more likely to die, but if they have high fitness they are less likely to die. If the population is reduced due to death then turtles are selected at random to reproduce until the population recovers. The new turtles are hatched a small distance from the parent in the fitness landscape -- this distance represents a slight mutation in the phenotypic variables of the parent.

There is an option to have the landscape change slowly in time. In the natural world the fittness corresponding to particular values of the phenotypic variables change over time, due to changes in the environment. For example, if changing climate destroys the main food source of birds with long beaks, then long beaked birds would have a reduced fitness. The landscape changes by adding a random number to the fitness, then smoothing and rescaling, so that the range and smoothness are retained. The effect is to have the fitness peaks gradually moving around over time.


Choose values for the smoothness and range of the landscape. Select the number of turtles and the mutation, which indicates both the variation in the initial population and the distance that new turtles hatch from their parent. Click setup and go. You should see the population gradually drifting through the landscape in the general direction of the nearest peak in fitnesss. Individuals do not move through the landscape. Rather, turtles that are fitter are less likely to die and hence have more opportuntities of reproduce offspring. The offspring are hatched some distance from their parent and it is in this way that the population drifts up the fitness peaks.

If you want the landsacpe to change in time turn on changing landsacpe and choose the rate at which you want it to change.


With a constant landsape, the first thing to notice is that the population of turtles does gradually drift up the fitness landsacpe to local fitness peaks, although there are frequently groups of turtles that survive for a time away from the peaks. These are less than optimally fit subgroups who survive by random chance. The graph will show average fitness increasing, but with some fluctuations.

You will notice that the initial turtle population is randomly colored, but after some time one color comes to dominate. There is no selection pressure on the color of the turtles. The fact that one color ends up dominating is a result of what is known as genetic drift. If two species are equally fit in an environment with limited resources, then over time, due to random fluctuations in population size one species will end up taking over. Sometimes you will see genetic drift acting when the population splits into two groups, one will die out, even if both groups have similar fitness. (Indeed occassionally a "fitter" but smaller group will die out for the same reason.)


As the simulation runs try increasing the mutation. As a result the average fitness of the population will usually decrease, but over time it will increase again as the population settles on a higher peak. One way to get to a high peak of fitness is to have the mutation high initially and then gradually decrease it. This illustrates how mutation rates determine the rate and degree of evolution. A higher mutation rate allows more possibility to explore phenotype space over time, but in the short term a smaller mutation rate allows for a higher average fitness.

Allow the population to drift to a fitness peak and then drop the mutation rate low (around 0.2). Now allow the landscape to change. You will see that if the landscape changes rapidly the fitness of the population drops as the peak moves a way. This illustrates how phenotypic variables that are not suseptible to mutation can be detrimental to a species in the event catastrophic changes to environment.

Try reducing the range of the landscape to zero. Then all turtles are equally fit. Turtles should spread out somewhat but will still be localized in a group. The group will randomly drift around the landscape. Notice that one color ends up taking over; another demonstration of genetic drift.


One extension to the model would be to allow groups of individauls which are suffienctly far apart in phenotype space to be independent of each, in that they no longer compete for the same resources. This is one way that speciation can occur innature. This might be achieved by restricting the number of new turtles born in a way that depends on the number of turtles in the neighbourhood of the turtles that die. Turtles that are a long way in phenotype space may have such different features that they no longer compete (for example, long and short beaked birds might learn to eat different food sources, and hence will no longer be in direct competition for limited resources -- they will only compete with birds who eat the same food.


See other Evolution based models in this series


Copyright 2006 David McAvity

This model was created at the Evergeen State College, in Olympia Washington
as part of a series of applets to illustrate principles in physics and biology.

Funding was provided by the Plato Royalty Grant.

The model may be freely used, modified and redistribued provided this copyright is included and the resulting models are not used for profit.

Contact David McAvity at if you have questions about its use.

(back to the NetLogo User Community Models)