"Dynamic Project Aggregation"

No preview image

1 collaborator

Seth-cropped Seth Brown (Author)

Tags

(This model has yet to be categorized with any tags)
Child of model Project Aggregation preview imageProject Aggregation
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 652 times • Downloaded 27 times • Run 0 times
Download the '"Dynamic Project Aggregation"' 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

breed [investors investor]

patches-own [
  favorability-level?         ;; indicates level of favorability for cell, -2 for unfavorable, -1 for 
                              ;; less favorable, 0 for neutral, 1 for more favorable, 2 for favorable
  favorable-neighbors  ;; counts how many neighboring cells make a favorable match
near-patches
]

to setup
  clear-all
  ask patches
  ;; sets patch colors randomly ranging between 1-5   
    [if distribution = "random" [ set pcolor ((random 5) + 102) ]
      if distribution = "normal" [set pcolor (round (random-normal 2.5 1) + 102)]
    ]
  ask patches
    [ set pcolor [pcolor] of one-of neighbors ] 
  ask n-of num-turtles patches [ sprout 1 ] 
  ask patches with [pcolor <= 102]
  [set favorability-level? -2]
  ask patches with [pcolor = 103]
  [set favorability-level? -1]
  ask patches with [pcolor = 104]
  [set favorability-level? 0]
  ask patches with [pcolor = 105]
  [set favorability-level? 1]
  ask patches with [pcolor >= 106]
  [set favorability-level? 2]
  ask turtles [set shape "tree" set color 45]
  reset-ticks
;  go
;  determine-competitors
;  neighbors-test
;  grow
;  do-plot
end 

to go
  determine-competitors
  neighbors-test
  grow
  do-plot
  tick
end 

to determine-competitors
  ask turtles [
    let competitors count turtles-on neighbors 
    if competitors >= level-of-competition  
    [die]
  ]
end 

to neighbors-test ;; determining if neighbors are good for investment
;  repeat 10
;  [
    ask n-of 2 patches [
      let added-self [favorability-level?] of patch-at 0 0
      let added-east [favorability-level?] of patch-at 1 0
      let added-west [favorability-level?] of patch-at -1 0
      let added-north [favorability-level?] of patch-at 0 1
      let added-south [favorability-level?] of patch-at 0 -1
      let added-southeast [favorability-level?] of patch-at 1 -1
      let added-northeast [favorability-level?] of patch-at 1 1
      let added-southwest [favorability-level?] of patch-at -1 -1
      let added-northwest [favorability-level?] of patch-at -1 1
      
      if added-self + added-east >= favorability-need 
      and 
      (any? turtles-here)
      and
      added-self >= favorability-threshold [ask patch-at 1 0 [set pcolor 55 ] ]
      
      if added-self + added-west >= favorability-need 
      and 
      (any? turtles-here)
      and
      added-self >= favorability-threshold  [ask patch-at -1 0 [set pcolor 55 ] ]
      
      if added-self + added-north >= favorability-need 
      and 
      (any? turtles-here)    
      and
      added-self >= favorability-threshold  [ask patch-at 0 1 [set pcolor 55 ] ]
      
      if added-self + added-south >= favorability-need    
      and
      (any? turtles-here)
      and
      added-self >= favorability-threshold  [ask patch-at 0 -1 [set pcolor 55 ] ]
      
      if added-self + added-southeast >= favorability-need 
      and 
      (any? turtles-here) 
      and
      added-self >= favorability-threshold [ask patch-at 1 -1 [set pcolor 55 ] ]
      
      if added-self + added-northeast >= favorability-need 
      and 
      (any? turtles-here)
      and
      added-self >= favorability-threshold [ask patch-at 1 1 [set pcolor 55 ] ]
      
      if added-self + added-southwest >= favorability-need 
      and 
      (any? turtles-here)
      and
      added-self >= favorability-threshold [ask patch-at -1 -1 [set pcolor 55 ] ]
      
      if added-self + added-northwest >= favorability-need    
      and
      (any? turtles-here) 
      and
      added-self >= favorability-threshold [ask patch-at -1 1 [set pcolor 55 ] ]
    
      if any? neighbors with [ pcolor = 55 ]  
      and
      (any? turtles-here) 
      and 
      favorability-level? >= favorability-threshold
      [set pcolor 55]   
    ]
;  ]
  ask turtles [
;    if one-of neighbors with [ pcolor = 55 ]  
    if any? neighbors with [ pcolor = 55 ]  
    and
    (any? turtles-here) 
    and 
    favorability-level? >= favorability-threshold
    [hatch-investors 1 [set color 105 set shape "tree"]]
    if any? investors-here [die] 
  ]
end 

to grow
;  repeat 5
;  [
    ask one-of patches [
   ask investors
    [
      ask patches in-radius investment-limit-radius
          [set near-patches 1]] 
 
;      let near-patches patches in-radius investment-limit-radius

      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at 1 0  >= favorability-threshold
      [ask patch-at 1 0 [set pcolor 55 ]]
        
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at -1 0  >= favorability-threshold
      [ask patch-at -1 0 [set pcolor 55 ]]
      
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at -1 -1  >= favorability-threshold
      [ask patch-at -1 -1 [set pcolor 55 ]]    
      
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at 0 -1  >= favorability-threshold
      [ask patch-at 0 -1 [set pcolor 55 ]]       
      
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at -1 -1  >= favorability-threshold
      [ask patch-at -1 -1 [set pcolor 55 ]]       
      
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at 0 1  >= favorability-threshold
      [ask patch-at 0 1 [set pcolor 55 ]]    
      
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at 1 1  >= favorability-threshold
      [ask patch-at 1 1 [set pcolor 55 ]]          
      
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at 1 -1  >= favorability-threshold
      [ask patch-at 1 -1 [set pcolor 55 ]] 
      
      if count neighbors with [ pcolor = 55 ] >= growth-capacity 
      and 
      favorability-level? >= favorability-threshold
      and
      near-patches = 1
      and 
      [favorability-level?] of patch-at -1 1  >= favorability-threshold
      [ask patch-at -1 1 [set pcolor 55 ]]           
          
;   ]
    ]
  do-plot
end  

to do-plot
  let invested-patches [favorability-level?] of patches with [pcolor = 55]
  set-current-plot "Favorability Levels of Invested Parcels"
  set-current-plot-pen "parcels"
  histogram invested-patches
end 

to-report Active-Investors
    report count patches with [pcolor = 55 and (any? turtles-here) ] 
end 

to-report Potential-Investors
  report count turtles
end 

to-report Invested-Parcels
  report count patches with [pcolor = 55]
end 

to-report Multiple-Investors
  report count patches with [pcolor = 55
and
(count investors-on neighbors > 1)]
end 




;
; sweep-test
;
; this is an automated parameter sweeping test
; it runs num-tests interations of the various configurations
; and prints results to the console
;
;Least Favorable
;  set growth-capacity 8
;  set investment-limit-radius 1
;  set num-turtles 25
;  set favorability-threshold 2
;  set favorability-need 4 
;  set level-of-competition 1

;Reasonable Scenario
;  set growth-capacity 2
;  set investment-limit-radius 1
;  set num-turtles 25
;  set favorability-threshold 1
;  set favorability-need 2 
;  set level-of-competition 2

;Most Favorable
;  set growth-capacity 0
;  set investment-limit-radius 5
;  set num-turtles 700
;  set favorability-threshold 0
;  set favorability-need 0 
;  set level-of-competition 9

to sweep-test
  ;
  ; setup the configuration
  ;
;;  set growth-capacity 1
;;  set investment-limit-radius 5
;;  set num-turtles 700
;;  set favorability-threshold 0
;;  set favorability-need 0 
;;  set level-of-competition 9

 
  let num-tests 10
  let i 0

  set i 0
  while [i <= 10]
    [
      setup
      print (Invested-parcels)
      set i (i + 1)
    ]
end 

to sweep-test-turtles
  ;
  ; setup the configuration
  ;
  set growth-capacity 3
  set investment-limit-radius 3
  set favorability-threshold 1
  set favorability-need 2 
  set level-of-competition 5
  set num-turtles 25
 
  let num-tests 25
  let i 0

  set i 0
  while [i <= 175]
    [
      setup
      print (word "Invested Parcels, " "Multiple Investors, " "Active Investors, " "Potential Investors, "  
        Invested-parcels ", " Multiple-Investors ", " Active-Investors ", " Potential-Investors ", " num-turtles ", " i ", " num-tests)
      set i (i + 1)
      if i = (num-tests) [set num-turtles (50)]
      if i = (num-tests + 50) [set num-turtles (100)]
      if i = (num-tests + 75) [set num-turtles (200)]
      if i = (num-tests + 100) [set num-turtles (300)]
      if i = (num-tests + 125) [set num-turtles (700)]
    ]
end 

to sweep-test-turtles-10
  ;
  ; setup the configuration
  ;
  set growth-capacity 3
  set investment-limit-radius 5
  set favorability-threshold 2
  set favorability-need 4 
  set level-of-competition 2
  set num-turtles 25
 
  let num-tests 10
  let i 0

  set i 0
  while [i <= 60]
    [
      setup
      print (word "Invested Parcels, " "Multiple Investors, " "Active Investors, " "Potential Investors, "  
        Invested-parcels ", " Multiple-Investors ", " Active-Investors ", " Potential-Investors ", " num-turtles ", " i ", " num-tests)
      set i (i + 1)
      if i = (num-tests) [set num-turtles (50)]
      if i = (num-tests + 10) [set num-turtles (100)]
      if i = (num-tests + 20) [set num-turtles (200)]
      if i = (num-tests + 30) [set num-turtles (300)]
      if i = (num-tests + 40) [set num-turtles (700)]
    ]
end 

to sweep-test-growth-capacity
  ;
  ; setup the configuration
  ;
  set growth-capacity 8
  set investment-limit-radius 2
  set num-turtles 300
  set favorability-threshold 1
  set favorability-need 2 
  set level-of-competition 2
 
  let num-tests 25
  let i 0

  set i 0
  while [i <= 175]
    [
      setup
      print (word "Invested Parcels, " "Multiple Investors, " "Active Investors, " "Potential Investors, "  
        Invested-parcels ", " Multiple-Investors ", " Active-Investors ", " Potential-Investors ", " growth-capacity ", " i ", " num-tests)
      set i (i + 1)
      if i = (num-tests) [set growth-capacity (5)]
      if i = (num-tests + 50) [set growth-capacity (4)]
      if i = (num-tests + 75) [set growth-capacity (3)]
      if i = (num-tests + 100) [set growth-capacity (2)]
      if i = (num-tests + 125) [set growth-capacity (1)]
    ]       
end 

to sweep-test-investment-radius
  ;
  ; setup the configuration
  ;
  set growth-capacity 0
  set investment-limit-radius 5
  set num-turtles 700
  set favorability-threshold 0
  set favorability-need 0 
  set level-of-competition 9
 
  let num-tests 25
  let i 0

  set i 0
  while [i <= 150]
    [
      setup
      print (word "Invested Parcels, " "Multiple Investors, " "Active Investors, " "Potential Investors, "  
        Invested-parcels ", " Multiple-Investors ", " Active-Investors ", " Potential-Investors ", " investment-limit-radius ", " i ", " num-tests)
      set i (i + 1)
      if i = (num-tests) [set investment-limit-radius (4)]
      if i = (num-tests + 50) [set investment-limit-radius (3)]
      if i = (num-tests + 75) [set investment-limit-radius (2)]
      if i = (num-tests + 100) [set investment-limit-radius (1)]
    ]       
end 

to sweep-test-favorability-threshold
  ;
  ; setup the configuration
  ;
  set growth-capacity 0
  set investment-limit-radius 5
  set num-turtles 700
  set favorability-threshold 0
  set favorability-need 0 
  set level-of-competition 9
 
  let num-tests 25
  let i 0

  set i 0
  while [i <= 100]
    [
      setup
      print (word "Invested Parcels, " "Multiple Investors, " "Active Investors, " "Potential Investors, "  
        Invested-parcels ", " Multiple-Investors ", " Active-Investors ", " Potential-Investors ", " favorability-threshold ", " i ", " num-tests)
      set i (i + 1)
      if i = (num-tests) [set favorability-threshold (1)]
      if i = (num-tests + 50) [set favorability-threshold (2)]
    ]       
end 

to sweep-test-favorability-need
  ;
  ; setup the configuration
  ;
  set growth-capacity 0
  set investment-limit-radius 5
  set num-turtles 700
  set favorability-threshold 0
  set favorability-need 0 
  set level-of-competition 9
 
  let num-tests 25
  let i 0

  set i 0
  while [i <= 150]
    [
      setup
      print (word "Invested Parcels, " "Multiple Investors, " "Active Investors, " "Potential Investors, "  
        Invested-parcels ", " Multiple-Investors ", " Active-Investors ", " Potential-Investors ", " favorability-need ", " i ", " num-tests)
      set i (i + 1)
      if i = (num-tests) [set favorability-need (1)]
      if i = (num-tests + 50) [set favorability-need (2)]
      if i = (num-tests + 75) [set favorability-need (3)]
      if i = (num-tests + 100) [set favorability-need (4)]
    ]       
end 

to sweep-test-level-of-competition
  ;
  ; setup the configuration
  ;
  set growth-capacity 0
  set investment-limit-radius 5
  set num-turtles 700
  set favorability-threshold 0
  set favorability-need 0 
  set level-of-competition 9
 
  let num-tests 25
  let i 0

  set i 0
  while [i <= 175]
    [
      setup
      print (word "Invested Parcels, " "Multiple Investors, " "Active Investors, " "Potential Investors, "  
        Invested-parcels ", " Multiple-Investors ", " Active-Investors ", " Potential-Investors ", " level-of-competition ", " i ", " num-tests)
      set i (i + 1)
      if i = (num-tests) [set level-of-competition (5)]
      if i = (num-tests + 50) [set level-of-competition (4)]
      if i = (num-tests + 75) [set level-of-competition (3)]
      if i = (num-tests + 100) [set level-of-competition (2)]
      if i = (num-tests + 125) [set level-of-competition (1)]
    ]       
end 

There is only one version of this model, created over 10 years ago by Seth Brown.

Attached files

File Type Description Last updated
GI_Investment_CSS899_Project-Final view.png png Dynamic Project Aggregation Image over 10 years ago, by Seth Brown Download

Parent: Project Aggregation

This model does not have any descendants.

Graph of models related to '"Dynamic Project Aggregation"'