Fitness Landscape

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 variables, 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 across the landscape towards fitness peaks.

powered by NetLogo

view/download model file: Fitness_Landscape.nlogo

HOW IT WORKS

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 specified 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 fitness 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.

There is also an option to include a feedback mechanism where the fitness of individuals is reduced if there are too many other individuals with the same, or similar geneome. The result of this type of feed back is speciation so the button to activiate this is called speciation.

 

HOW TO USE IT

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 fitness. Individuals do not move through the landscape. Rather, turtles that are fitter are less likely to die and hence have more opportunities to reproduce. The offspring are hatched a small distance in phenotype space from their parent (the distance being a measure of the amount of mutation) and it is in this way that the population drifts up the fitness peaks.

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

 

THINGS TO NOTICE

With a constant landscape, the first thing to notice is that the population of turtles does gradually drift up the fitness landscape 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 occasionally a "fitter" but smaller group will die out for the same reason.)

 

THINGS TO TRY

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 susceptible 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; which is another demonstration of genetic drift.

 

EXTENDING THE MODEL

One extension to the model would be to allow groups of individuals which are sufficiently 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 in nature. 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.

 

RELATED MODELS

See other Evolution based models in this series

 

CREDITS AND REFERENCES

Copyright 2006 David McAvity

This model was created at the Evergreen 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 redistributed provided this copyright is included and the resulting models are not used for profit.

Contact David McAvity at mcavityd@evergreen.edu if you have questions about its use.

 

PROCEDURES

; A model to illustrate the fitness landscape idea of evolution.
 
patches-own [ fitness change ]
globals [ time ]
 
to setup 
  ca 
  set time 0
  setup-patches 
  setup-turtles 
end 
 
; This creates the fitness landscape by assigning a "fitness" variable for each patch, and then
; smoothing it by diffusing the fitness variable to neighbouring 
; patches a number of times specified by the smoothness slider. 
; The fitness variable is then rescaled to lie between 0 and 100, with a range specified by
; the value on the range slider. The landscape is then colored a scale of green with white 
; corresponding to fitness of 100 and black a fitness of 0.
to setup-patches 
  ask patches [ set fitness (random 100) ]
  repeat smoothness [ diffuse fitness 1 ]
  rescale
  color-landscape
end
 
; The initial turtle population, with random ages and colors is spatially distributed 
; at a distance between 0 and the mutation rate from the origin. This distribution represents
; a variation in the phenotypes of the initial population.
; colors. 
to setup-turtles
    crt number [
        if (shade-of? green color) [ set color red ]
        jump (random-float 10 * mutation)  ]
end
 
 
; Turtles are selected to die with a probability determined by their age and their fitness (see death
; procedure). Surviving turtles are allowed to reproduce to replace lost turtles. There are two
; additional options. If the landscape is selected to change then the fitness of the patches is allowed
; to change in a way that preserves the degree of smoothness, but allowing peaks and valleys to 
; gradually shift. This is achieved by introducing a patch-own "change" variable that is smoothed
; the appropriate amount before being added to the fitness variable in the update-landscape procedure.
; the other option is to add new turtles at the location of your mouse in order to "speed up" the 
; evolutionary process if the turtles are not evolving to highest fitness over time.
to go  
  death
  birth
  do-plots
  if changing-landscape? [
      diffuse change 1  ; this will diffuse "smoothness" number of times before the fitness is changed.
      if time > smoothness [update-landscape set time 0 ]
      set time time + 1 ]
  if mouse-down? [ 
      ask one-of turtles [die]
      crt 1 [
                               set color red
                               setxy mouse-xcor mouse-ycor ] 
      wait 0.1 ]             
end
 
 
; This is the procedure where the fitness of a turtle as determined by its location on the landscape 
; comes into play. If a turtle is older than a random number between 0 and the fitness of its location
; it dies. In this way fitter turtles tend to live longer and hence have more opportunities to reproduce. 
to death  
    ask turtles [
        if count turtles > number  [
            die] ] 
end
 
 
; Turtles are selected at random to reproduce until the maximum number supported by the environment is
; reached. Probability of reproduction is not directly related to fitness. Fitness of real organisms is
; related to probability of surviving to reproductive age and number of offspring produced. However in this
; model we assume that all living turtles have the same probability of reproduction, and fitness only relates to probability
; survival.
to birth
            
            ask  turtles [
              let competition 0
              if speciation? [set competition count turtles in-radius  mutation ]
              if fitness - competition > random 100 [
                hatch 1 [
                    jump (random-float mutation)
                    rt random 360  ]  ] ]
end
 
 
; This a simple linear rescaling that is centered on a fitness of 50 with a total range determined
; by the slider. The maximum allowed range is 100 because we want the maximum allowed fitness to be 
; 100 and the mininum allowed fitness to be 0. If the range is allowed to be larger than 100 then 
; the coloring of the landscape will look strange.
to rescale
   let highest max [ fitness ] of patches
   let lowest min [ fitness ] of patches
   ifelse (highest - lowest) = 0 
      [ask patches [set fitness 50] ]
      [ask patches [ set fitness range * (fitness - lowest) / (highest - lowest) + (99 - range) / 2] ]
end
 
; Color the patches a scale of green according to their fitness value, with 0 being black and 100 being 
; white.
to color-landscape
     ask patches [ set pcolor scale-color green fitness 0 100]
end     
 
; Keep track of average fitness over time
to do-plots
  set-current-plot "Average Fitness"   
  plot mean [ fitness ] of turtles
end
 
; when the landscape is allowed to change over time add the appropriately smoothed change variable
; to the fitness variable, and then recalculate the change for the next time step.
to update-landscape 
  ask patches [set fitness fitness + change
               set change (random landscape-change-rate) ]
  rescale
  color-landscape
end