Mechanisms of Evolutionary Change

Mechanisms of Evolutionary Change preview image

1 collaborator

Default-person Andrew McDevitt (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0 • Viewed 320 times • Downloaded 84 times • Run 0 times
Download the 'Mechanisms of Evolutionary Change' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

turtles-own [mat-chrom pat-chrom]

globals [
  max-percent  ;; percent of the total population that is in the
  population-to-cull ;; global population size for culling procedure
  hw-rec
  hw-dom
  hw-homo-rec
  hw-hetero
  hw-homo-dom
]

to setup
  ;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  clear-all
  reset-ticks
  ;; create turtles with random colors and locations
  crt initial-population-size [
    spawn
  ]
 set hw-dom ((count turtles with [mat-chrom = 1] + count turtles with [pat-chrom = 1]) / (2 * initial-population-size))
 set hw-rec ((count turtles with [mat-chrom = 2] + count turtles with [pat-chrom = 2]) / (2 * initial-population-size))
end 

to spawn
  ifelse random 100 < (proportion-allele-A * 100)
    [ set mat-chrom 1 ]
    [ set mat-chrom 2 ]
  ifelse random 100 < (proportion-allele-A * 100)
    [ set pat-chrom 1 ]
    [ set pat-chrom 2 ]
  ifelse (mat-chrom = 1 or pat-chrom = 1)
    [ set color blue ]
    [ set color red ]
  setxy random-xcor random-ycor
  let agent-shape species
  if agent-shape = "human" [ set agent-shape "person"]
  if agent-shape = "ant" [ set agent-shape "bug"]
  set shape agent-shape
end 

to run-99
  setup
  repeat 99 [go]
end 

to go
  if ( ((count turtles with [mat-chrom = 1] = 0 and count turtles with [pat-chrom = 1] = 0) or (count turtles with [mat-chrom = 2] = 0 and count turtles with [pat-chrom = 2] = 0))) or (99 > 0 and ticks > 99 or count turtles = 0)
    [ stop ]
  ask turtles [
    if ticks = 1 [
      cull
    ]
    rt random 50 - random 50
    fd 1
    mutate
    meet
  ]
  immigrate
  set population-to-cull count turtles
;;  show ((population-to-cull - population-size) / population-to-cull) * 100
  ask turtles [
    cull
  ]

  tick
end 

to immigrate
  crt (initial-population-size * homo-dominant-immigration * .01) [
    set mat-chrom 1
    set pat-chrom 1
    set color blue
    setxy random-xcor random-ycor
    let agent-shape species
    if agent-shape = "human" [ set agent-shape "person"]
    if agent-shape = "ant" [ set agent-shape "bug"]
    set shape agent-shape
  ]
    crt (initial-population-size * hetero-immigration * .01) [
    set mat-chrom 1
    set pat-chrom 2
    set color blue
    setxy random-xcor random-ycor
    let agent-shape species
    if agent-shape = "human" [ set agent-shape "person"]
    if agent-shape = "ant" [ set agent-shape "bug"]
    set shape agent-shape
  ]
  crt (initial-population-size * homo-recessive-immigration * .01) [
    set mat-chrom 2
    set pat-chrom 2
    set color red
    setxy random-xcor random-ycor
    let agent-shape species
    if agent-shape = "human" [ set agent-shape "person"]
    if agent-shape = "ant" [ set agent-shape "bug"]
    set shape agent-shape
  ]
end 

to meet    ;; turtle procedure - when two turtles are adjacent, reproduce (but no self-fertilization!)
  let mom self
  let mate nobody
  ifelse mate-with = "random"
  [ set mate one-of other turtles ]
  [ set mate one-of other turtles in-radius 1 ]
  if mate != nobody [
    hatch 1 [
      ifelse random 100 < 50
        [ set mat-chrom [mat-chrom] of mom ]
        [ set mat-chrom [pat-chrom] of mom ]
      ifelse random 100 < 50
        [ set pat-chrom [mat-chrom] of mate ]
        [ set pat-chrom [pat-chrom] of mate ]
      ifelse (mat-chrom = 1 or pat-chrom = 1)
        [ set color blue ]
        [ set color red ]
      let agent-shape species
      if agent-shape = "human" [ set agent-shape "person"]
      if agent-shape = "ant" [ set agent-shape "bug"]
      set population-to-cull count turtles
      set shape agent-shape
      cull
    ]
  ]
end 

to mutate
      ifelse mat-chrom = 1
         [ if random 10000 < mutation-dominant-to-recessive * 100 [ set mat-chrom 2] ]
         [ if random 10000 < mutation-recessive-to-dominant * 100 [ set mat-chrom 1] ]
      ifelse pat-chrom = 1
         [ if random 10000 < mutation-dominant-to-recessive * 100 [ set pat-chrom 2] ]
         [ if random 10000 < mutation-recessive-to-dominant * 100 [ set pat-chrom 1] ]
end 

to cull

  let death-chance ((population-to-cull - initial-population-size) / population-to-cull) * 100
    if (selection-against-blue > 0 and color = blue) [
      set death-chance death-chance + ((100 - death-chance) * selection-against-blue * .01)
    ]
    if (selection-against-red > 0 and color = red) [
      set death-chance death-chance + ((100 - death-chance) * selection-against-red * .01)
    ]
  if random 100 < death-chance [ die ]
end 

There are 12 versions of this model.

Uploaded by When Description Download
Andrew McDevitt almost 6 years ago graph updates Download this version
Andrew McDevitt almost 6 years ago Reverted to older version Download this version
Andrew McDevitt almost 6 years ago Reverted to older version Download this version
Andrew McDevitt almost 6 years ago Reverted to older version Download this version
Andrew McDevitt almost 6 years ago Reverted to older version Download this version
Andrew McDevitt almost 6 years ago Reverted to older version Download this version
Andrew McDevitt almost 6 years ago Reverted to older version Download this version
Andrew McDevitt almost 6 years ago Reverted to older version Download this version
Andrew McDevitt almost 6 years ago graph updates Download this version
Andrew McDevitt almost 6 years ago minor bug fixes (ca-rt) Download this version
Andrew McDevitt almost 6 years ago minor bug fixes (ca-rt) Download this version
Andrew McDevitt almost 6 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Mechanisms of Evolutionary Change.png preview Preview for 'Mechanisms of Evolutionary Change' almost 6 years ago, by Andrew McDevitt Download

This model does not have any ancestors.

This model does not have any descendants.