control_model

No preview image

1 collaborator

Default-person Yukio Matsumoto (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 90 times • Downloaded 17 times • Run 0 times
Download the 'control_model' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

breed[homo_mutant_males homo_mutant_male]
breed[homo_mutant_females homo_mutant_female]
breed[hetero_mutant_males hetero_mutant_male]
breed[hetero_mutant_females hetero_mutant_female]
breed[wild_males wild_male]
breed[wild_females wild_female]

globals[wild homo_mutant  hetero_mutant total
  near_male_pink near_male_lime near_male_for_female_red
  distance_male_mutant-female_pink distance_male_mutant-female_lime distance_male_for_female_red
  bin_ct2 X1]

patches-own [mucus]

;;;;;;;;;;;;;;
;;; setpup ;;;
;;;;;;;;;;;;;;

to setup
  __clear-all-and-reset-ticks
  setup-patch

  setup-wild-male
  setup-wild-female
  setup-hetero_mutant_males
  setup-hetero_mutant_females

  reset-ticks
end 

to setup-patch
  ask patches [set pcolor 97]
end 

to setup-wild-male
 create-wild_males 4995  [setxy random-xcor random-ycor]
 ask wild_males [
 set pen-size 2
 set color blue
 set size 0.5
 ]
end 

to setup-wild-female
create-wild_females  4995  [setxy random-xcor random-ycor]
ask wild_females [
set pen-size 2
set color red
set size 0.5
]
end 

to setup-hetero_mutant_females
create-hetero_mutant_females 5 [setxy random-xcor random-ycor]
ask hetero_mutant_females [
set pen-size 2
set color lime
set size 0.5
]
end 

to setup-hetero_mutant_males
create-hetero_mutant_males 5 [setxy random-xcor random-ycor]
ask hetero_mutant_males [
set pen-size 2
set color cyan
set size 0.5
]
end 



;;;;;;;;;;;;;;;;;;;;;
;;; Go procedures ;;;
;;;;;;;;;;;;;;;;;;;;;

to go

  if ticks >= 100  [ stop ]
  if ticks > 1 [
  if count hetero_mutant_females = 0 and count hetero_mutant_males = 0 and count homo_mutant_males = 0 and count homo_mutant_females = 0[ stop ]
 ]

  set-mucus

 repeat 30 [
  move-wild-abalone
  move-mutant-abalone
  disapper-of-mucus
 ]

  fertilization
  count-offsprings
  produce-next-generation

  tick
end 


;;;;;;;;;;;;;;;;;;
;;; procedures ;;;
;;;;;;;;;;;;;;;;;;

to set-mucus
  ask turtles [
   set mucus mucus *  0
   set mucus mucus + 1
    if (mucus > 0)
   [set pcolor gray]
   ]
end 

;;;abalones move according to the behavioral rules consist with behaviour of H.discus hannai

to move-wild-abalone
ask-concurrent turtles with [ color = red or color = blue][
  set X1 random-exponential 48.76 ;;;set the locomotion distance
   repeat X1[
   ifelse random 1 < 0 [rt random 360][lt random 360]
     forward 1  set mucus mucus *  0 set mucus mucus + 1 if (mucus > 0)
   [set pcolor gray]
 ]
]
end 

to move-mutant-abalone
ask-concurrent turtles with [ color = lime or color = pink or color = cyan or color = sky][
  set X1 random-exponential 48.76 ;;;set the locomotion distance
   repeat X1[
   ifelse random 1 < 0 [rt random 360][lt random 360]
     forward 1  set mucus mucus *  0 set mucus mucus + 1 if (mucus > 0)
   [set pcolor gray]
   ]
]
end 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to disapper-of-mucus
  ask patches with [pcolor = gray][
  set mucus mucus - 1
  if (mucus < 0)
  [set pcolor 97]
   ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to fertilization
ask turtles with [color = pink] [

    set near_male_pink min-one-of turtles with [color = blue or color = sky or color = cyan ] [distance myself]

    let mutant-near_male_positiony_pink  [ycor] of near_male_pink
    let mutant-near_male_positionx_pink  [xcor] of near_male_pink
    let mutant-female_positiony_pink  [ycor] of self
    let mutant-female_positionx_pink  [xcor] of self

    set distance_male_mutant-female_pink (sqrt ( (mutant-female_positionx_pink - mutant-near_male_positionx_pink) ^ 2 +  (mutant-female_positiony_pink - mutant-near_male_positiony_pink) ^ 2))
    let fertilization_pink  (88.31 * exp(-0.32 * (distance_male_mutant-female_pink / 10 )))

    if [color] of near_male_pink = sky [hatch fertilization_pink / 10 [setxy random-xcor random-ycor set color yellow]]


    if [color] of near_male_pink = cyan [hatch (fertilization_pink / 10 * 2) [setxy random-xcor random-ycor set color yellow]
                                              hatch (fertilization_pink / 10 * 2) [setxy random-xcor random-ycor set color green]]

    if [color] of near_male_pink = blue [hatch fertilization_pink / 10 [setxy random-xcor random-ycor set color green]]

    die
      ]

 ask turtles with [color = lime] [

    set near_male_lime min-one-of turtles with [color = blue or color = sky or color = cyan ] [distance myself]

    let mutant-near_male_positiony_lime  [ycor] of near_male_lime
    let mutant-near_male_positionx_lime  [xcor] of near_male_lime
    let mutant-female_positiony_lime  [ycor] of self
    let mutant-female_positionx_lime  [xcor] of self

    set distance_male_mutant-female_lime (sqrt ( (mutant-female_positionx_lime - mutant-near_male_positionx_lime) ^ 2 +  (mutant-female_positiony_lime - mutant-near_male_positiony_lime) ^ 2))
    let fertilization_lime  (88.31 * exp(-0.32 * (distance_male_mutant-female_lime / 10 )))

    if [color] of near_male_lime = sky [ hatch (fertilization_lime / 10)* 0.75 [setxy random-xcor random-ycor set color yellow]
                                              hatch (fertilization_lime / 10) * 0.25 [setxy random-xcor random-ycor set color green] ]

    if [color] of near_male_lime = blue [ hatch (fertilization_lime / 10)* 0.75 [setxy random-xcor random-ycor set color magenta]
                                              hatch (fertilization_lime / 10)* 0.25 [setxy random-xcor random-ycor set color yellow] ]

    if [color] of near_male_lime = cyan  [ hatch (fertilization_lime / 10)* 0.75 [setxy random-xcor random-ycor set color yellow]
                                              hatch (fertilization_lime / 10)* 0.25 [setxy random-xcor random-ycor set color green] ]

  die
 ]


ask turtles with [color = red] [

    set near_male_for_female_red min-one-of turtles with [color = blue or color = sky or color = cyan or color = brown] [distance myself]

    let near_male_positiony_red  [ycor] of near_male_for_female_red
    let near_male_positionx_red  [xcor] of near_male_for_female_red
    let female_positiony_red  [ycor] of self
    let female_positionx_red  [xcor] of self

    set distance_male_for_female_red (sqrt ( (female_positionx_red - near_male_positionx_red) ^ 2 +  (female_positiony_red - near_male_positiony_red) ^ 2))
    let fertilization_red   (88.31 * exp(-0.32 * (distance_male_for_female_red / 10)))


    if [color] of near_male_for_female_red = blue [hatch (fertilization_red / 10) [setxy random-xcor random-ycor set color magenta]]


    if [color] of near_male_for_female_red = cyan [ hatch (fertilization_red / 10)* 0.5 [setxy random-xcor random-ycor set color magenta]
                                              hatch (fertilization_red / 10)* 0.5 [setxy random-xcor random-ycor set color yellow] ]

    if [color] of near_male_for_female_red = sky [hatch (fertilization_red / 10) [setxy random-xcor random-ycor set color green]]

   die

]
end 

to count-offsprings
set homo_mutant (count turtles with [color = yellow]);;
set hetero_mutant ((count turtles with [color = green]));;

set wild (count turtles with [color = magenta]);;
set total (homo_mutant + hetero_mutant + wild )
ask turtles [die]
end 

to produce-next-generation

   create-homo_mutant_males (10000  * (homo_mutant  / total)) / 2
       [set size 0.5 setxy random-xcor random-ycor set color sky ]

   create-homo_mutant_females (10000  * (homo_mutant  / total)) / 2
       [set size 0.5 setxy random-xcor random-ycor  set color pink ]

   create-hetero_mutant_males (10000  * ( hetero_mutant / total)) / 2
       [set size 0.5 setxy random-xcor random-ycor set color cyan]

   create-hetero_mutant_females (10000  * (hetero_mutant / total)) / 2
       [set size  0.5 setxy random-xcor random-ycor set color lime]

   create-wild_males (10000  * ( wild  / total)) / 2
       [set size 0.5 setxy random-xcor random-ycor set color blue ]

   create-wild_females (10000  * ( wild  / total)) / 2
       [set size 0.5 setxy random-xcor random-ycor set color red ]
end 

There is only one version of this model, created over 5 years ago by Yukio Matsumoto.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.