Speciation mechanisms

Speciation mechanisms preview image

1 collaborator

Screen_shot_2018-02-02_at_12.53.50_pm lin xiang (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.1.0 • Viewed 39 times • Downloaded 1 time • Run 0 times
Download the 'Speciation mechanisms' 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

;;;;;;;;;;;;;set breeds and global variables;;;;;;;;;;
breed [females female]
breed [males male]


turtles-own [age]
globals [
  attribute
  isolation?
         environ?
          iso-position ]


;;;;;;;;;;;;;reporter;;;;;;;;;;;;;;;;;;

to-report years
  report ticks / 100
end 

to-report front-color
  report [pcolor] of (patch-ahead 1)
end 

to-report upper-tt-color
ifelse any? turtles with [ycor > iso-position] [report mean [color] of turtles with [ycor > iso-position]][report 0]
end 

to-report down-tt-color
ifelse any? turtles with [ycor < iso-position] [report mean [color] of turtles with [ycor < iso-position]][report 0]
end 

to-report diff-bk
report abs (color - pcolor)
end 

;to-report max-tt
;report (max-pxcor * max-pycor)
;end


;;;;;;;;;;;;;;;;;set up;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to reset
 set Number-of-visual-predators 0
 set heritable-color? true
 set Initial-fish-color-variation 7
 set mutation-rate 1
 set Strength-of-mating-preference 0
 set Dispersal 0.01
end 

to setup
clear-all
set iso-position 0
setup-patches

set-default-shape females "fish-2"
set-default-shape males "fish-2"
create-females 50
[set size 1.75
 set color 81 + random-float Initial-fish-color-variation
 set age random 10
 setup-position]
create-males 50
[set size 1.75
 set color 81 + random-float Initial-fish-color-variation
 set age random 10
 setup-position]

set isolation? false
set environ? false
reset-ticks
do-plot1
;do-plots
end 

to setup-patches
ask patches [set pcolor 82.5]
;ask patches with [abs pxcor = max-pxcor]  [set pcolor 35]
;ask patches with [abs pycor = max-pycor]  [set pcolor 35]
end 

to setup-position
setxy random-xcor random-ycor
if pcolor = 35
[setup-position]
end 

to set-isolation
ask patches [if (abs pycor = max-pycor) or (abs pxcor = max-pxcor) or (pycor = iso-position) or (pycor = iso-position - 1 ) or (pycor = iso-position )  [set pcolor 35]]
set isolation? true
;do-plots
end 

to set-environ
ask patches
[if isolation? [if abs pxcor < max-pxcor and abs pycor < max-pycor and pycor > iso-position    [set pcolor 87.5]
                if abs pxcor < max-pxcor and abs pycor < max-pycor and pycor < iso-position - 1   [set pcolor 82.5]]]
set environ? true
end 

to set-environ-1
ask patches
[if abs pxcor <= max-pxcor and abs pycor <= max-pycor and pycor >= iso-position    [set pcolor 87.5]
                if abs pxcor <= max-pxcor and abs pycor <= max-pycor and pycor <= iso-position - 1   [set pcolor 82.5]]
set environ? true
end 

to initial
setup-patches
set isolation? false
set environ? false
if abs (upper-tt-color - down-tt-color) > 3.5
[let mid-color (upper-tt-color + down-tt-color) / 2
  ask turtles with [color > (mid-color - 1.75) and color < (mid-color + 1.75 )] [die]]
end 


;;;;;;;;;;;;;go;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  tick

if (count turtles > max-lake-capacity * 3) or (not any? turtles) [stop]

ask turtles
[move
  if pcolor = 35 [die]]
growth
mating
over-repro
diff-survival
if ticks > years-to-run * 100  [user-message "The year has reached the defined value. Click 'setup' to restart the experiment or extend the number of years." stop]

if isolation? [if (count turtles with [pycor > iso-position]) = 0 [user-message "One of the subpopulation has gone extinct." stop]
               if (count turtles with [pycor < iso-position]) = 0 [user-message "One of the subpopulation has gone extinct." stop]
                              ]

;if isolation? [do-plots]
do-plot1
end 

to diff-survival
ask turtles
 [if random 20 = 0 [if random-float 1000 < (diff-bk * Number-of-visual-predators * 0.5) ^ 2  [die]]]
end 

to move
    ifelse front-color = 35 [rt random 360]
                            [ifelse random 50 = 0 [rt random 90 lt random 90 ifelse front-color = 35 [rt random 360]
                                                                                                 [;fd 0.05
                                                                                                   fd Dispersal]]
                                              [;fd 0.05
                                                fd Dispersal]]
end 

to growth
ask turtles
[ifelse age > 20
  [die]
  [set age age + 0.01]
  if pcolor = 35 [die]]
end 

to mating
ask females with [age > 1]
[if random 30 = 0

[let partner one-of males-on neighbors                     ;;find a male adult turtle here
   if (partner != nobody) and ([age] of partner > 1) and (abs (color - [color] of partner) <= (3.5 - Strength-of-mating-preference))      ;;if there is one and same species
       [ifelse random 2 = 0
         [hatch-females 1 [ifelse heritable-color?
                           [set age 0
                           ifelse random-float 200 < mutation-rate [ifelse random 2 = 0 [set color ((color + [color] of partner) / 2) + random-float 2]
                                                                                        [set color ((color + [color] of partner) / 2) - random-float 2] ]
                                                                   [set color (color + [color] of partner) / 2]
                           if color >= 89 [set color 88.5]
                           if color <= 81 [set color 81.5]
                                 ]
                           [set age 0 set color 81 + random-float Initial-fish-color-variation]
                           move
                           ]]
         [hatch-males 1 [ifelse heritable-color?
                          [set age 0
                         ifelse random-float 200 < mutation-rate [ifelse random 2 = 0 [set color ((color + [color] of partner) / 2) + random-float 2]
                                                                                      [set color ((color + [color] of partner) / 2) - random-float 2] ]
                                                                 [set color (color + [color] of partner) / 2]
                         if color >= 89 [set color 88.5]
                         if color <= 81 [set color 81.5]
                           ]
                          [set age 0 set color 81 + random-float Initial-fish-color-variation]
                        move
                         ]]]]
  ]
end 

to over-repro
ifelse (isolation? or environ?) ;if barrier or different environments, no compete between different geo population
       [ask turtles with [ycor > iso-position]
             [if count turtles with [ycor > iso-position] > (max-lake-capacity / 2) [if random 2 = 0 [die]]]
        ask turtles with [ycor < iso-position]
             [if count turtles with [ycor <= iso-position] > (max-lake-capacity / 2) [if random 2 = 0 [die]]]]
       [ask turtles [if count turtles > max-lake-capacity [if random 2 = 0 [die]]]]
ifelse (Strength-of-mating-preference > 0)               ;if sexual selection, no compete between different color population
       [ask turtles with [color > 84.5]
         [if count turtles with [color > 84.5] > (max-lake-capacity / 2) [if random 2 = 0 [die]]]
        ask turtles with [color <= 84.5]
         [if count turtles with [color <= 84.5] > (max-lake-capacity / 2) [if random 2 = 0 [die]]]]
       [ask turtles [if count turtles > max-lake-capacity [if random 2 = 0 [die]]]]
end 

to do-plots
set-current-plot "Average Fish Colors in Upper & Lower Areas"
set-current-plot-pen "upper area"
plot upper-tt-color
set-current-plot-pen "lower area"
plot down-tt-color
end 

to do-plot1
set-current-plot "Fish Color Distribution"
set-plot-x-range 80 90
set-plot-y-range 0 round (count turtles / 5)
histogram [color] of turtles
end 

;Developed by Lin Xiang  contact info:lin.xiang@uky.edu

There are 2 versions of this model.

Uploaded by When Description Download
lin xiang 3 months ago agent watching Download this version
lin xiang 6 months ago Initial upload Download this version

Attached files

File Type Description Last updated
Speciation mechanisms.png preview Preview for 'Speciation mechanisms' 6 months ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.