Civ

No preview image

1 collaborator

Default-person Kay Ramey (Author)

Tags

(This model has yet to be categorized with any tags)
Model group LS426-2012 | Visible to everyone | Changeable by group members (LS426-2012)
Model was written in NetLogo 5.0RC7 • Viewed 483 times • Downloaded 35 times • Run 0 times
Download the 'Civ' 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 model is designed to show how populations shift by highlighting the factors influencing people's decisions to move or not move and the effect that these decisions have on the aggregate arrangement of the population.

HOW IT WORKS

The rules governing agent behavior in the model are:

1) There is a maximum distance that people can reasonably travel to access water or other people. 2) People like to be near other people. 3) People like to be near water. 4) People can be lazy. 5) People can be spontaneous or illogical.

HOW TO USE IT

The relative weight in the decision making process given to the considerations listed above can be regulated through the use of sliders.

Sphere-of-activity is the radius of patches with which the agents are able to interact, i.e. water or other people within this many patches of them are registered. All people within this radius are treated the same (i.e. once you're within this radius, it doesn't matter if you're right near a person or if he/she is on the edge of the radius).

The affinity-to-water and affinity-to-people sliders indicate how much the person cares about being near water or being near people (%). Somebody with a value of 0 is indifferent to water or people, whereas someone with a value of 100 for both cares deeply about each. We model affinity-to-people as a decreasing function, and specifically assign the utility value 1/n to the nth neighbor within the sphere-of-activity. We model affinity-to-water as a very sharply decreasing function, and specifically assign the utility value 1/(n^2) to the nth patch within the sphere-of-activity that has water.

Impulsiveness is how likely people are (%) to just move randomly for no reason, even if they are happy where they are. When they do move, they truly move randomly (1 unit in a random direction).

Laziness indicates the propensity for a person not to move at all. A very lazy person will not move even if they are unhappy where they are.

Finally, the population slider simply allows the user to regulate the total population of the model (between 0 and 1000).

THINGS TO NOTICE

When you press the SETUP button, the model creates a landscape with water features and randomly distibutes the number of people indicated on the POPULATION slider only on the land portions of the landscape. Then at each tick, every person will make a decision to move or not move one unit in a direction that will make them the happiest, according to the settings on the AFFINITY-TO-WATER, AFFINITY-TO-PEOPLE, SPHERE-OF-ACTIVITY, IMPULSIVENESS, and LAZINESS sliders.

For example, if AFFINITY-TO-WATER is set higher than AFFINITY-TO-PEOPLE, IMPULSIVENESS and LAZINESS, then people will be more likely to move toward water than they will be to move toward other people, to move in a random direction or to stay where they are. If water is already within their SPHERE-OF-ACTIVITY, the radius of which gets larger as you increase the slider, then they will stay where they are.

Similarly, if AFFINITY-TO-PEOPLE is set higher than the other sliders, people will move toward other people.

If IMPULSIVENESS is the highest setting, people will be most likely to move one unit in a random direction at each tick.

If LAZINESS is the highest setting, people will be most likely to stay where they are.

The smaller the SPHERE-OF-ACTIVITY, the closer people have to be to water or other people to make them want to stay where they are.

THINGS TO TRY

To model a population comprised of people who are driven first by the need for water and second by the need to be near other people, who have only low levels of impulsivity and laziness, and who, once settled are not willing/able to travel far to access water or other people, you can set the sliders to: POPULATION = 395, AFFINITY-TO-WATER = 100, AFFINTY-TO-PEOPLE = 31, SPHERE-OF-ACTIVITY = 1, IMPULSIVENESS = 6, LAZINESS = 6. With these settings, people will gradually move toward other people and toward the water, forming tight-knit clumps scattered across the landscape. As the model progresses, more and more of these clumps of people will make their way toward water.

However, you increase the SPHERE-OF-ACTIVITY to 10, indicating that people are willing/able to travel farther to access people and water, you will see a much more rapid movement of people to form loose settlements around the water supplies. As the model progresses, these settlements will become increasingly close-knit and remain adjacent to water supplies.

By setting IMPULSIVENESS and LAZINESS to 100, you will see that rather than congregating near other people or near water, people remain scattered randomly across the landscape.

EXTENDING THE MODEL

Right now, the way this model works, additional neighbors make agents happier, albeit in a decreasing fashion. One way to extend the model would be to change the code so that after a certain point, each additional neighbor actually made agents LESS happy.

Another possible extension would be to add reproduction to the model.

A third possible extension would be to have agents change colors to indicate their level of happiness.

NETLOGO FEATURES

This model uses patches as well as affinity to other turtles to influence turtle behavior. It models affinity-to-people as a decreasing function, and specifically assigns the utility value 1/n to the nth neighbor within the sphere-of-activity. It also models affinity-to-water as a very sharply decreasing function, and specifically assigns the utility value 1/(n^2) to the nth patch within the sphere-of-activity that has water.

RELATED MODELS

This model is related to the models in the "Urban Suite" which also model population movement. It is particularly related to "Urban Suite - Path Dependence," which models how firms search for places to locate. In that model, firms choose locations by taking into account the quality of their current location and the number of firms already located there. However, unlike, the the models in "Urban Suite - Path Dependence" model, this model focuses on individual people's decisions to settle, and these people make descisions as to where to move based on the affordances and limitations of the natural landscape and the need for personal contact.

Our model is also similar to the "Segregation" model in NetLogo, as this model also uses proximity to other agents as a criteria for happiness. However, unlike in our model, in the "Segregation" model, the color, as well as the proximity of other agents influences agent happiness.

CREDITS AND REFERENCES

Comments and Questions

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

Click to Run Model

patches-own [water]
globals [people-constant water-constant]

to setup
  clear-all
  draw-terrain 

  crt population
  [
    set color orange
    set size 2
    set shape "person"
    
    ; distribute randomly, making sure none of them are in the water
    setxy random-xcor random-ycor
    while [water = true] [ setxy random-xcor random-ycor ]
  ]
  
  set people-constant 0.0
  let counter 1
  while [counter <= population]
  [
    set people-constant (people-constant + (1.0 / counter))
    set counter (counter + 1)
  ]
  
  ; we don't want to count ourselves
  set people-constant (people-constant - 1)

  reset-ticks
end 


;; draw a fixed terrain

to draw-terrain
  ask patches
  [
    set pcolor 72  ; green
    set water false
  ]
  
  ; ocean along the top
  ask patches with [pycor > 70]
  [
    set pcolor blue
    set water true
  ]
  
  ; ocean along the bottom
  ask patches with [pycor < 3]
  [
    set pcolor blue
    set water true
  ]
  
  ; lake on the left
  ask patches with [distancexy 25 30 < 13]
  [
    set pcolor blue
    set water true
  ]
    
  ; another lake on the right
  ask patches with [distancexy 70 45 < 10]
  [
    set pcolor blue
    set water true
  ]
  
  ; river going down from the second lake  
  ask patches with [pxcor > 67 and pxcor < 73 and pycor < 45]
  [
    set pcolor blue
    set water true
  ]
end 

to go
  
  ask turtles
  [

    ;; the default probability of staying at the current
    ;; patch derives from laziness
    let p ((laziness / 100.0) + (get-happiness-adjustment xcor ycor))

    let r (random-float 1)
    ifelse (r > p)
    [
      move-intelligently
    ] [
      set r (random 100)
      if (impulsiveness > r) [ move-randomly ]
    ]
    
  ]
  
  tick
end 



;; calculate the people index, which we model to have decreasing
;; marginal utility. we go with a harmonic sum as a rough
;; approximation, i.e. the nth neighbor adds value 1/n

to-report get-people-index [x y]

  let people-index 0.0
  let people-count 0

  ask turtles with [(distancexy x y) < sphere-of-activity]
  [
    set people-count (people-count + 1)
    set people-index people-index + (1.0 / people-count)
  ]
  
  ;; we counted ourselves in the above, so take it back out
  set people-index (people-index - 1)
  
  ;; normalize the people-index against the maximum possible value
  ;; that occurs when everyone is all in the same place. after
  ;; this, people-index will be a number between 0 and 1.
  set people-index (people-index / people-constant)
  
  report people-index
end 


;; calculate the water index, which we model to have a sharply
;; decreasing marginal utility. we go with the nth neighboring
;; water patch adding value 1/n^2

to-report get-water-index [x y]
  let water-index 0.0
  let water-count 0
  ask patches with [(distancexy x y) < sphere-of-activity]
  [
    if (water = true)
    [
      set water-count (water-count + 1)
      set water-index water-index + (1.0 / (water-count * water-count))
    ]
  ]
  
  ;; normalize the water-index against the maximum possible value
  ;; after this, water-index will be a number between 0 and 1
  set water-index (water-index / 1.65)

  report water-index  
end 


;; reports the probability adjustment of staying, as influenced
;; by being close to water and people.

to-report get-happiness-adjustment [x y]
  let people-index (get-people-index x y)
  let water-index (get-water-index x y)
    
  ;; we define leeway to be the amount of influence either proximity
  ;; to water or proximity to people can have, and we give these
  ;; equal parts of the remaining probability. for example,
  ;; if the default probability of staying is 40%, then we allow
  ;; each of these two factors to increase the probability by up to 
  ;; 30%, so that if both of them were to be maxed out, and the person
  ;; had 100% affinity to both, then the probability
  ;; of staying would be 100%.
  let leeway ((100.0 - laziness) / 200.0)

  report (people-index * (affinity-to-people / 100.0) * leeway) + (water-index * (affinity-to-water / 100.0) * leeway)  
end 


;; checks the up/down/left/right squares and moves to the
;; one that makes you the happiest

to move-intelligently
  let x xcor
  let y ycor
  
  ; adjustments in the four directions
  let adj1 -1
  let adj2 -1
  let adj3 -1
  let adj4 -1
  
  
  ;; up, idx = 1
  set ycor (y + 1)
  if (water = false) [ set adj1 (get-happiness-adjustment xcor ycor) ]
  
  ;; down, idx = 2
  set ycor (y - 1)
  if (water = false) [ set adj2 (get-happiness-adjustment xcor ycor) ]
    
  ;; left, idx = 3
  set ycor y
  set xcor (x - 1)
  if (water = false) [ set adj3 (get-happiness-adjustment xcor ycor) ]
  
  ;; left, idx = 4
  set xcor (x + 1)
  if (water = false) [ set adj4 (get-happiness-adjustment xcor ycor) ]


  ;; figure out what the max adjustment is, and how many
  ;; of the four directions tie for max
  let max-adj adj1
  let max-count 1
  
  if (adj2 = adj1) [ set max-count (max-count + 1) ]
  if (adj2 > adj1) [ set max-adj adj2 set max-count 1 ]
  
  if (adj3 = adj2) [ set max-count (max-count + 1) ]
  if (adj3 > adj2) [ set max-adj adj3 set max-count 1 ]
  
  if (adj4 = adj3) [ set max-count (max-count + 1) ]
  if (adj4 > adj3) [ set max-adj adj4 set max-count 1 ]
  
  ;; now, randomly choose one of the directions that tie for
  ;; the max adjustment
  let max-idx (random max-count)
  
  if (adj1 = max-adj)
  [
    if (max-idx = 0) [ set xcor x set ycor (y + 1) stop ]
    set max-idx (max-idx - 1)
  ]
  
  if (adj2 = max-adj)
  [
    if (max-idx = 0) [ set xcor x set ycor (y - 1) stop ]
    set max-idx (max-idx - 1)
  ]  
  
  if (adj3 = max-adj)
  [
    if (max-idx = 0) [ set xcor (x - 1) set ycor y stop ]
    set max-idx (max-idx - 1)
  ]  
     
  if (adj4 = max-adj)
  [
    if (max-idx = 0) [ set xcor (x + 1) set ycor y stop ]
    set max-idx (max-idx - 1)
  ]  
end 

to move-randomly
  let legal-move false
  let r 0
  
  while [legal-move = false]
  [
    set r (random 360)
    rt r fd 1
    ifelse (water = true)
    [
      set legal-move false
      bk 1 lt r
    ] [
      set legal-move true
    ]
  ]
end 

There is only one version of this model, created over 13 years ago by Kay Ramey.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.