Sea Crossings (base model)

Sea Crossings (base model) preview image

1 collaborator

Default-person Bailey Baumann (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0 • Viewed 203 times • Downloaded 14 times • Run 0 times
Download the 'Sea Crossings (base 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.)


Data

Four ASCII Files are needed for each run. They can be found on GitHub here: https://github.com/Bailey-B/sea-crossings

Comments and Questions

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

Click to Run Model

breed[persons person]
breed[trails trail]

extensions [
  gis
]

globals [
  competition-value
  land.or.sea-dataset
  cost-dataset
  motivation-dataset
  boundary-dataset
]

patches-own [
  land.or.sea
  cost
  motivation
  boundary
  difference
  times.here
]

;Replace "000" in the environment name with the correct run number from the sea-crossings repository

to setup-gis
  set land.or.sea-dataset gis:load-dataset "environment000L_1.asc"
  set cost-dataset gis:load-dataset "environment000_2.asc"
  set motivation-dataset gis:load-dataset "environment000_3.asc"
  set boundary-dataset gis:load-dataset "environment000_4.asc"
  gis:set-world-envelope (gis:envelope-union-of (gis:envelope-of land.or.sea-dataset)
                                                (gis:envelope-of cost-dataset)
                                                (gis:envelope-of motivation-dataset)
                                                (gis:envelope-of boundary-dataset))
end 

to set-patch-values
  gis:apply-raster land.or.sea-dataset land.or.sea
  gis:apply-raster cost-dataset cost
  gis:apply-raster motivation-dataset motivation
  gis:apply-raster boundary-dataset boundary
end 

to setup
  clear-all
  create-persons 100
  set-default-shape persons "person"
  set-default-shape trails "dot"
  ask patches [
    setup-gis
    ifelse land.or.sea = 1
      [set pcolor green]
      [set pcolor blue]
    set competition-value persons-here
  ]
  set-patch-values
  ask persons [
    setxy random-xcor random-ycor
    set color red
  ]
  reset-ticks
end 

to go
  if ticks >= 1000
    [stop]
  ifelse competition
    [move-persons-with-competition]
    [move-persons]
  remove-persons
  if ((count persons) < 100)
  [replace-persons]
  ask patches [
    if count persons-here > 0 [set times.here (times.here + 1)]
  ]
  tick
end 

to replace-persons
  create-persons (100 - (count persons))
  set-default-shape persons "person"
  ask persons [
    setxy random-xcor random-ycor
    set color red
  ]
end 

to move-persons-with-competition
  if competition-value < max-persons-per-cell [
    ask patches [
      set motivation (motivation * motivation.coefficient)
      set cost (cost * cost.coefficient)
      set difference (motivation - cost)
         ask persons-here [
            uphill4 difference
          ]
        ]
     ]
   ask persons[
    hatch-trails 1 [set color 16]
  ]
end 

to move-persons
  ask patches [
    set motivation (motivation * motivation.coefficient)
    set cost(cost * cost.coefficient)
    set difference (motivation - cost)
     ask persons-here [
        uphill4 difference
      ]
    ]
  ask persons[
    hatch-trails 1 [set color 16]
  ]
end 

to remove-persons
  ask persons [
    if boundary = 1
      [die]
  ]
end 

to export-results
  set times.here gis:patch-dataset times.here
  gis:store-dataset times.here "times.here.asc"
end 

There are 5 versions of this model.

Uploaded by When Description Download
Bailey Baumann almost 7 years ago Minor Edits Download this version
Bailey Baumann almost 7 years ago Corrected world dimensions Download this version
Bailey Baumann almost 7 years ago Added code to import data using GIS extension Download this version
Bailey Baumann about 7 years ago Version 2 Download this version
Bailey Baumann about 7 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Sea Crossings (base model).png preview Preview for 'Sea Crossings (base model)' about 7 years ago, by Bailey Baumann Download

This model does not have any ancestors.

This model does not have any descendants.