testing encoding - again :)

No preview image

1 collaborator

Default-person Arthur Hjorth (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 4.1.1 • Viewed 90 times • Downloaded 6 times • Run 0 times
Download the 'testing encoding - again :)' 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 is a model that explores the indeterminacy of the concept of 'public good'.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

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

Click to Run Model

;; Interpreting Congestion Charge ;;
;; This model is based on Michael Freeden's example from 
;; The purpose of this model is to show the ambiguity of political concepts such as 'public goods'
;; and the interpretation of policies.
;; TODOS: price sensitivity 

globals [
  
  global-pollution-per-day               ;; pollution variable
  travel-time-added                      ;; traffic congestion, how congested is traffic. 
                                         ;; this variable adds itself to a vehicle's travel time
  average-travel-time                    ;; average travel time calculated per day per person
  
  yesterdays-travel-time-added           ;; the average travel time added per vehicle yesterday
                                         ;; this is key in people's decision making process for whether they want
                                         ;; to go by car or bus.
  turtles-driving                        ;; number of turtles driving on any day
  median-income-drivers                  ;; the median income of turtles who drive
  median-income-bussers                  ;; the median income of turtles who take the bus
  cars                                   ;; number of cars
  busses                                 ;; number of busses
  median-income-preference-met           ;; median income for those whose transport preference was met
  median-income-preference-not-met       ;; median income for those whose transport preference was not met
  turtles-preference-met                 ;; number of people whose prefernces are met
  turtles-preference-not-met             ;; number of people whose preferences are not met
]

turtles-own [
  income                                 ;; income level of turtle, 1-100
  car-love                               ;; how much the person wants to drive their car, 1-100
  willing-to-wait                        ;; how willing the person is to spend extra time on travelling by car
                                         ;; rather than travelling by public transport, 1-100
  wishes-to-drive?                       ;; would this person ideally drive today?
  can-afford-to-drive?                   ;; can this person afford to drive today
  will-drive-today?                      ;; will this person actually drive today
  preference-met?                        ;; true if person travels by preferred medians
]

;;;
;;; SETUP PROCEDURES
;;;

to setup
  ;; clean up
  reset-ticks
  clear-all
  
  


  ;; create population
  create-turtles population
  [
    ;; setting shape person
    set shape "person"
    ;; placing randomly on map in unoccupied location
    move-to one-of patches with [any? other turtles-here = false]
    
    

    
    ;; setting income randomly (will be changed as part of gini coefficient implementation)
    set income random 99
    color-turtle
    set car-love random 99
    set willing-to-wait random 99

    ;; adding 1 to all turtle properties to avoid divide by zero errors. Look up how to set a range for random and correct this. 
    set income income + 1
    set car-love car-love + 1
    set willing-to-wait willing-to-wait + 1
  ]
end 

to go
  ;; switch over yesterdays time travel
  set yesterdays-travel-time-added travel-time-added
  ;; ask all turtles to decide on going by car or not
  ask turtles [decide]
  ;; calculate number of cars and busses
  calc-vehicles
  ;; calculate the time delay created by number of cars
  calculate-delay-created
  ;; calculate median incomes for respectively drivers and non-drivers
  calculate-median-incomes
  ;; calculate how many turtles traveled by their preferred medians
  calculate-preference-met
  ;; calculate median income for those who traveled by preferred and those who did not.
  calculate-median-preference-met



  calc-pollution
end 

to calc-vehicles
  set cars count turtles with [will-drive-today? = true] / avg-passengers-per-car
  set busses count turtles with [will-drive-today? = false] / avg-passengers-per-bus
end 

to calculate-median-incomes
  if any? turtles with [will-drive-today? = true]
  [
    set median-income-drivers median [income] of turtles with [will-drive-today? = true]
  ]
  if any? turtles with [will-drive-today? = false]
  [
    set median-income-bussers median [income] of turtles with [will-drive-today? = false]
  ]
end 

to calculate-preference-met
  set turtles-preference-met (count turtles - count turtles with [wishes-to-drive? = true and will-drive-today? = false])
  set turtles-preference-not-met population - turtles-preference-met
end 

to calculate-median-preference-met
  ;; if clause to avoid null pointer exc
  
  if any? turtles with [(wishes-to-drive? = true and will-drive-today? = true) or wishes-to-drive? = false]
  [
     set median-income-preference-met median [income] of turtles with 
           [(wishes-to-drive? = true and will-drive-today? = true) or wishes-to-drive? = false]
  ]
  
  ;; if clause to avoid null pointer exc
  if any? turtles with [wishes-to-drive? = true and will-drive-today? = false]
  [
     set median-income-preference-not-met median [income] of turtles with [wishes-to-drive? = true and will-drive-today? = false]
  ]
end   

to color-turtle
  ;; coloring people per income
  ;; dark red for lowest quartile, pink for next, light blue for next, dark blue for highest quartile
  if income <= 25
  [
    set color 13
  ]
  if income > 25 and income <= 50
  [
    set color 16
  ]
  if income > 50 and income <= 75
  [
    set color 95
  ]
  if income > 75
  [
    set color 105
  ]
end 

to calc-pollution
  ;; calculates pollution by multiplying pollution per car with no of cars and ditto for busses
  set global-pollution-per-day cars * pollution-per-car + busses * pollution-per-bus
end 

to calculate-delay-created
  ;; calculates delay created by finding sum of vehicles. All vehicles cause same amount of delay which probably isn\\t true...
  set travel-time-added cars + busses
end 

to decide ;; turtle procedure. Decide on whether to drive that day or not.
    would-prefer-car
    can-afford-to-drive
    will-drive
end 

to would-prefer-car ;; this determines if the turtle would ideally drive
  ifelse (car-love - (yesterdays-travel-time-added / willing-to-wait)) > 0
  [
    set wishes-to-drive? true
  ]
  
  [
    set wishes-to-drive? false
  ]
end 

to can-afford-to-drive ;; this determines if the turtle can afford to drive. This needs to be tweaked to take into
                       ;; consideration feedback effect from congestion charge lowering price of public transp
  ifelse congestion-charge-cost / 2 > income
  [
    set can-afford-to-drive? false
  ]
  
  [
    set can-afford-to-drive? true
  ]
end 

to will-drive ;; this determines if the turle will actually drive
  ifelse wishes-to-drive? and can-afford-to-drive?
  [
    set will-drive-today? true
    set shape "car"
  ]
  [
    set will-drive-today? false
    set shape "bus"
  ]
end 

There is only one version of this model, created about 7 years ago by Arthur Hjorth.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.