MalansonReslerJTB2014

MalansonReslerJTB2014 preview image

1 collaborator

Default-person George Malanson (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.1.0 • Viewed 138 times • Downloaded 21 times • Run 0 times
Download the 'MalansonReslerJTB2014' modelDownload this modelEmbed this model

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


WHAT IS IT?

This project models the behavior of ants following a leader towards a food source. The leader ant moves towards the food along a random path; after a small delay, the second ant in the line follows the leader by heading directly towards where the leader is located. Each subsequent ant follows the ant ahead of it in the same manner.

Even though the leader may take a very circuitous path towards the food, the ant trail, surprisingly, adopts a smooth shape. While it is not yet clear if this model is a biologically accurate model of ant behavior, it is an interesting mathematical exploration of the emergent behavior of a series of agents following each other serially.

HOW TO USE IT

The SETUP button initializes the model. A brown ant nest is placed on the left side of the world. Inside it are a number of ants (yellow) determined by the NUM-ANTS slider. On the right hand of the world is an orange source of food.

The GO button starts the ants moving. The leader ant (turtle 0) is set in motion roughly in the direction of the food. It wiggles as it moves. That is, it does not head directly towards the food, but changes its heading a random amount to the left or right before it takes each step.

The maximum amount the leader ant can wiggle at each step (and therefore the raggedness of the leader ant's path) is governed by the LEADER-WIGGLE-ANGLE slider. When the leader ant gets close enough to the food to "smell" it, it stops wiggling and heads directly for the food. The leader ant leaves a red trace as it moves.

Each subsequent ant follows the ant ahead of it by heading directly towards it before it takes each step. The follower ants do not leave a trace. The yellow line of ants, however, traces out a curve in the drawing. The last ant to go leaves a blue trace.

The amount of time between ants departing their nest is governed by the START-DELAY slider (plus some random factor).

The ANTS-RELEASED monitor shows you how many ants have left the nest. The other monitor shows you the heading of the lead ant.

THINGS TO NOTICE

How does the shape of the ant line change over time?

How does the path of the initial ant compare with the path of the final ant?

THINGS TO TRY

Try varying the maximum wiggle angle (LEADER-WIGGLE-ANGLE). How does that affect the shape of initial and final ant lines?

Try varying the delay. How does that affect the shape of initial and final ant lines?

How can you slow down the flattening out of the ant line? Can you make the path fail to converge to a straight line?

How can you speed up the flattening out of the ant line?

EXTENDING THE MODEL

How might you keep track of, measure, or plot the flattening process?

What if you relaxed the ant following rules -- maybe add some "wiggle" to their behavior?

NETLOGO FEATURES

In NetLogo, the default behavior of the ants is to move in parallel. Notice the use of delays based on turtle ids in the TIME-TO-START? reporter to make the turtles leave the nest serially.

CREDITS AND REFERENCES

The model was inspired by the work of Alfred Bruckstein (see Bruckstein 1993: "Why the ant trails look so straight and nice", The Mathematical Intelligencer, Vol. 15, No. 2).

HOW TO CITE

If you mention this model in an academic publication, we ask that you include these citations for the model itself and for the NetLogo software:

In other publications, please use:

COPYRIGHT NOTICE

Copyright 1997 Uri Wilensky. All rights reserved.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:
a) this copyright notice is included.
b) this model will not be redistributed for profit without permission from Uri Wilensky. Contact Uri Wilensky for appropriate licenses for redistribution for profit.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

Comments and Questions

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

Click to Run Model

globals [ pseeds sseeds parentid originage branchpine branchspruce branchkill treecount edgedensity zengsum ndense neibo year potential cover edges pinec sprucec pinef pinefile sprucef sprucefile sprucecount pinecount ]

breed [pines]
 
breed [pbranch]

breed [sbranch]

breed [spruce] 
 
breed [deadguy]
breed [deadguy-branch] 
 
turtles-own [origin  parent age canker brage branchparent pinepine ]

pines-own [infectp ]
 
pbranch-own [infectb  ]
patches-own [ quality zeng zengX prob  dense ]

to setup
 
  __clear-all-and-reset-ticks
    set-default-shape pines "tree pine" 
    set-default-shape pbranch "plant"
    set-default-shape sbranch "plant"
    set-default-shape spruce "tree pine"
    set-default-shape deadguy "tree pine"
    set-default-shape deadguy-branch "plant"
   
      set year 0 
    ask patches [
       set quality 0
      
       set zeng 0
       set prob 0
       set potential 0
       set cover 0
       set edges 0
       set pinec 0
       set sprucec 0

       
      
       set dense 0
       set pinecount 0
       set sprucecount 0
       set pinefile 0
       set sprucefile 0
       set pinef 0
       set sprucef 0

       

              set quality ( (1 - (pycor / 500)) * .5)
              set pcolor white
             
       if (startspruce > 0) AND (startpine > 0 ) [         
         ifelse (random-float 1 < quality * startspruce ) [
           sprout-spruce 1 [ 
             set color 2 
             set size 2
           ]
          ]
          [ ; else
       
         if (random-float 1 < quality * startpine ) [
           sprout-pines 1 [
             set color 5
             set size 2 
             ]
           ]
         ]
       ]
    ]
      
  
    ages
  
  
  reset-ticks    
end 


;;___PROCEDURES__________

to ages
  ask turtles [
    set age ( 50 + random 50 )
    set brage 0
   
  ] 
end 

to go
  ifelse (year < 101) [
    ager
 
  feedback
  seeds 
  spruces 
    whiteb 

  grow  
  death
  feedback 
  
  edgepro
  profilepro

  tick  
  ]
  [ 
  
       
    
    stop ]
end 
  
  ; NOTE  using procedure within procedure is to avoid having the observer call a turtle or patch directly

to ager
    agerpro
end 

to agerpro
    set year (year + 1)
    set pinec (count patches with [any? pines-here] + count patches with [any? pbranch-here]) 
    set sprucec (count patches with [any? spruce-here] + count patches with [any? sbranch-here] ) 
   
        set cover (count patches with [any? spruce-here] + count patches with [any? sbranch-here] + count patches with [any? pines-here] + count patches with [any? pbranch-here]) 
     set edges edgedensity
       
    set potential ( zengsum / ( 50000 - (pinec + sprucec) ) )
   
     ask turtles [
     set age (age + 1)
     set brage (brage + 1)
     ]
end 

to seeds
  set pseeds 0
  set sseeds 0
  seedspro
end 

to seedspro
     
    ask pines [
    
       if (age > 50) AND (random-float 1 < pineseeder * (quality + zeng)) [
         set pseeds  pseeds + 1 
       ]]
     
         
    ask spruce [
       if (age > 50) AND (random-float 1 < spruceseeder * (quality + zeng)) [
         set sseeds sseeds + 1
       ]
    ]    
end 

to whiteb
  whitebpro 
end 

to whitebpro
  
    repeat pseeds [
      
      
      ask patches [
         if (not any? turtles-here) [    
                      
          
             set prob pinestab * (quality + zeng )]   
           
           
           if (random-float 1 < prob) [
             sprout-pines 1 [
               set age 0
               set brage 0
                 ; print 111
                 ; set origin who
               set origin 1
               set parent 1
               set parentid 1
               ; set pinedead 0
               set infectp 0
         
               set canker 0 
             
               set color 5
               set size 2
           ]
          ]
         ]
      ]     
end 

to spruces
  sprucespro
end 

to sprucespro
  
    repeat sseeds [
   
      
      ask patches [
        if (not any? turtles-here) [ 
     
        
          set prob  sprucestab * (quality + (zeng * 2) )  
          
           if (random-float 1 < prob  ) 
          [
   
            sprout-spruce 1 [
              set age 0
              set brage 0
              ; set origin who
              set origin 2
              set parent 2
              set parentid 2
              ; set infectb 0
               set color 2
               set size 2
              ]
          ]
        ]
      ]
    ] 
end 

to grow
  growpro
end 

to growpro  
 
    ask pines [
      if brage > 10 [
      set parentid 1
      set originage age
      set branchpine who
      
        let seeding-place nobody
        set seeding-place one-of neighbors with [not any? turtles-here]
  
        if (seeding-place != nobody) AND (random-float 1 <  pinegrow * (quality + zeng))
          [
          ask seeding-place [
            sprout-pbranch 1 [
              set age originage
              set brage 0
              set parent parentid 
              set branchparent branchpine
              set color 5
              set size 2
              ]
          
            ] 
          ] ]
    ]
    
    
    ask spruce [
      if brage > 10 [
        set parentid 2
        set originage age
        set branchspruce who
        
         let seeding-place nobody
         set seeding-place one-of neighbors with [not any? turtles-here]
  
     if (seeding-place != nobody) AND (random-float 1 <  sprucegrow * (quality + zeng))
       [
       ask seeding-place [
         sprout-sbranch 1 [
           set age originage
           set brage 0
           set parent parentid 
           set branchparent branchspruce
           set color 2
           set size 2
           ]
      
         ] 
       ] 
     ]
 ]
    
    
  ask pbranch [
     if brage > 10 [
      set parentid parent
      set branchpine branchparent 
      set originage age
      let seeding-place nobody
      set seeding-place one-of neighbors with [not any? turtles-here]
      if (seeding-place != nobody) AND (random-float 1 < pinegrow * (quality + zeng) )
        [
        ask seeding-place [sprout-pbranch 1 [
          set age originage
          set parent parentid
          set brage 0
        
         set branchparent branchpine
           set color 5
                set size 2  
                ]
          ]                    
]]]

ask sbranch [
     if brage > 10 [
      set parentid parent
      set branchspruce branchparent 
      set originage age
      let seeding-place nobody
      set seeding-place one-of neighbors with [not any? turtles-here]
      if (seeding-place != nobody) AND (random-float 1 <  sprucegrow * (quality + zeng) )
        [
        ask seeding-place [sprout-sbranch 1 [
          set age originage
          set parent parentid
          set brage 0
          
         set branchparent branchspruce
           set color 2
                set size 2  
                ]
          ]                     
]]]
end 

to death
  deathpro
end 

to deathpro
 

  
  ask pines [  
  
       ifelse (age <= 10) and (random-float killer > (lowsurviv * (quality + zeng)  ) )
         [ die ]
         [ifelse (age > 10 and age < 350) and (random-float killer > (highsurviv * (quality + zeng)) ) 
         [ die ]
         
    [if (age >= 350) and (random-float killer > (lowsurviv * (quality + zeng)) )
     [  
           ask patch-here  [       sprout-deadguy 1 [
             set color black
             set size 2 
             set age 0 
         ;    print 99
             ]]
               die  
              ]

        ]
    
    
    ]
     
    ]
  
  
  
 ask pbranch [   
  
       ifelse (age <= 10) and (random-float killer > (lowsurviv * (quality + zeng)  ) )
    [ die ]
    [ifelse (age > 10 and age < 350) and (random-float killer > (highsurviv * (quality + zeng)) ) 
    [ die ]
    
    [if (age >= 350) and (random-float killer > (lowsurviv * (quality + zeng)) )
     [  
           ask patch-here  [       sprout-deadguy-branch 1 [
             set color black
             set size 2 
             set age 0 
          ;   print 9999
             ]]
               die   ]

        ]
    
    
    ]
     
    ]
 
  
  ask spruce  [  
       ifelse (age <= 10) and (random-float killer > (lowsurviv * (quality + zeng)  ) )
    [ die ]
    [ifelse (age > 10 and age < 200) and (random-float killer > (highsurviv * (quality + zeng)) ) 
    [ die ]
    
    [if (age >= 200) and (random-float killer > (lowsurviv * (quality + zeng)) )
     [  
           ask patch-here  [       sprout-deadguy 1 [
             set color black
             set size 2 
             set age 0 
          ;   print 8
             ]]
           die
                  ]

        ]
    
    
    ]
     
    ]
  
  
  ask sbranch  [   
       ifelse (age <= 10) and (random-float killer > (lowsurviv * (quality + zeng)  ) )
    [ die ]
    [ifelse (age > 10 and age < 200) and (random-float killer > (highsurviv * (quality + zeng)) ) 
    [ die ]
    
    [if (age >= 200) and (random-float killer > (lowsurviv * (quality + zeng)) )
     [  
           ask patch-here  [       sprout-deadguy-branch 1 [
             set color black
             set size 2 
             set age 0 
          ;   print 88
             ]]
           die
                  ]

        ]
    
    
    ]
     
    ]


  ask pbranch [ set pinepine branchparent   
                if ( turtle pinepine = nobody ) [ 
             
              if (age > 350) [ ask patch-here  [       sprout-deadguy-branch 1 [
             set color black
             set size 2 
             set age 0 
           
             ]]]
              die
            ] ]
  
  ask deadguy 
    [ if (age > 10) 
      [ die ]
      ]
  
  ask deadguy-branch [ if (age > 5) [ die ] ]
end 

to feedback
  feedbackpro
end 

to feedbackpro
 
  ask patches [
    set dense 0

      ifelse ( ((sum [count pines-here] of neighbors) + (sum [count spruce-here] of neighbors) + (sum [count pbranch-here] of neighbors) + (sum [count sbranch-here] of neighbors)) < 1 ) 
        [ set dense 0 ]
       
        [ set dense ((sum [count pines-here] of neighbors) + (sum [count spruce-here] of neighbors) + (sum [count pbranch-here] of neighbors) + (sum [count sbranch-here] of neighbors))  ]
       

           if (dense = 0) [set zengX 0]
   if (dense = 1) [set zengX .125   ]
      if (dense = 2) [set zengX .25]
         if (dense = 3) [set zengX .375]
            if (dense = 4) [set zengX .5]
               if (dense = 5) [set zengX .625]
                  if (dense = 6) [set zengX .75]
                     if (dense = 7) [set zengX .875]
                        if (dense = 8) [set zengX 1]
                        
                     
                        
                        set zeng (zengX * (((1 - quality) * .7125) - .2008 ))
]
end 

to edgepro
  set edgedensity  0
  set zengsum 0
  set ndense 0
  ask patches [
    if (not any? turtles-here) [ 
    set edgedensity edgedensity + ((sum [count pines-here] of neighbors4) + (sum [count spruce-here] of neighbors4) + (sum[count pbranch-here] of neighbors4)+ (sum[count sbranch-here] of neighbors4) + (sum[count deadguy-here] of neighbors4)) 
      set zengsum zengsum + zeng
        ]
        if ( any? turtles-here) [ 
      set ndense  ndense + ((sum [count pines-here] of neighbors4) + (sum [count spruce-here] of neighbors4) + (sum[count pbranch-here] of neighbors4)+ (sum[count sbranch-here] of neighbors4) + (sum[count deadguy-here] of neighbors4))
    
    ] 
        set neibo ndense / 2
        ]
end 

to profilepro
    set pinefile 0
    set sprucefile 0
    set pinecount 0
    set sprucecount 0
    ask pines [
      set pinefile (pinefile + pycor)
      set pinecount (pinecount + 1)
    ]
    ask spruce [
      set sprucefile ( sprucefile + pycor)
      set sprucecount (sprucecount + 1)
  ]
  set pinef pinefile / pinecount
  set sprucef sprucefile / sprucecount
end 

There is only one version of this model, created about 10 years ago by George Malanson.

Attached files

File Type Description Last updated
MalansonResler2014.pdf pdf Paper in Journal of Theoretical Biology about 10 years ago, by George Malanson Download
MalansonReslerJTB2014.png preview Preview for 'MalansonReslerJTB2014' about 10 years ago, by George Malanson Download

This model does not have any ancestors.

This model does not have any descendants.