Valentina Varagona Valentina Gallimbeni

Simulation models for economics

Project work on

"San Francisco park."


The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.

Here you can find an introduction to the San Francisco park application.

powered by NetLogo

view/download model file: san-francisco_park.nlogo


The model tries to explain the behavior of agents while searching for available parking spaces, and the automatic adjustment of prices of those parking spaces.
We have built this model in order to simulate a new project which is actually taking place in the city of San Francisco. The principal aim is to use new technologies to improve the parking in the city, reduce traffic and help drivers find available parking spaces more quickly.


At the beginning of the simulation, houses are created at the corners of our hypothetical city, central parking spaces are created exactly in the middle of the city, and peripheral parking spaces are spread randomly around the city. Agents are created initially in their houses.
As the simulation starts, the agents immediately go to the central parking spaces (since we are assuming they are the most desirable ones), and only if they don’t find an available parking lot there , they start looking for the peripheral parking spaces, which are less desirable, but also less costly.


In order to start the simulation, click on the button setup: the initial world is created. To run the simulation click on go: the cars start looking for parking spaces.
In the interface there are also different monitors and plot.
You can modify, through the special slider, the number of cars, the number of parking lots, the parking time of cars, the amount of increase or decrease in the automatic adjustment mechanism, and the prices of the peripheral parking spaces and of the central ones.
Also you can keep trace of the time passed, of the number of parking spaces available, and of the prices while running the simulation.


The most interesting things to notice while running the program are surely the plot of prices and the one of parking available, since the entire model is based on the automatic adjustment of them.
As the program is running, you can keep trace of all the adjustment of prices, noting that the black line represent the prices of the central parking spaces, while the red line represent the prices of all the parking spaces.
Also another interesting thing to notice is the monitor called “months-passed”, since we have assumed that 1 month is equal to 100 ticks, and that the automatic adjustment of prices are every month.


Thanks to the use of sliders, the user can modify our program in many different ways.
First of all, you can decide how many agents to create, moving the slider called “population”.
Then you can modify the number of parking spaces available through the slider “NumberOfParkingLots”.
Moreover you can choose and modify all the things related to prices: the peripheral parking price, the central parking price, and also the amount of increase and decrease in prices you want in the automatic adjustment mechanism.
Valid experiments to try are, for example, to create a model with a high number of agents and a low number of parking spaces and see what happens to the prices, or modify the prices of the peripheral parking spaces and of the central ones, and see how prices change through time.


If you want to extend the model even further there are some things that you can change. For example you could add a slider for the duration of the months. We assumed a fixed value for them (100 ticks) but you can see how prices vary if the months are shorter, more frequent adjustments and more flexibility of prices, or longer. Another modification that can be added is on the reservation price of the car drivers. We assume it to be constant but it could adjust over time following the growing center parking prices. This gradual adjustment would reflect the willingness of drivers to find a satisfactory parking location over their aversion to spend more money.


The most interesting feature is how the passing of time is shown and used. We have created two variables, one to make the price adjust in a given period (since we needed a longer adjustment time then just one tick) and the other to make it more user friendly, by showing the amount of periods while they go by. Another interesting feature is that instead of asking NetLogo to create the turtles, which generates them in the center, we have asked the corner patches to sprout them.
Least but not last is the procedure “to driving”. This is the fulcrum of the turtle’s movements and it is what helped us recreate a life like driving behavior.


There are many related models. For city simulations you can find a good replica of a urban environment in the Models Library (Traffic Grid). Many others though were developed, such as:


We have got the idea for this simulation thanks to a real life experiment that has been taking place in some parts of the city of San Francisco. This experiment is based on Donald Shoup’s theories about the price of parking. You can find more in his book “The high cost of free parking” (the link to the first chapter is To follow how the experiment is going you can visit the site which explains in detail how it is being carried out.


patches-own [ parking-space        ;; amount of parking space on this patch 
              home-number          ;; number (1) to identify home patches
turtles-own [ reservation-price
              turtle-home ]
globals [time-counter

to setup
   set-default-shape turtles "car"
   ask patches [ setup-home
                 setup-central-parking ]

to cars
   ask patch max-pxcor max-pycor 
    [ sprout (population / 4)]
   ask patch max-pxcor min-pycor 
    [ sprout (population / 4)]
   ask patch min-pxcor max-pycor 
    [ sprout (population / 4)]
   ask patch min-pxcor min-pycor 
    [ sprout (population / 4)]
   ask turtles [set size 2        
                set color red
                set turtle-home patch-here]

to setup-home
   if (distancexy max-pxcor max-pycor) < 5
    [ set home-number 1 ] 
   if (distancexy max-pxcor min-pycor) < 5
    [ set home-number 1]
   if (distancexy min-pxcor max-pycor) < 5
    [ set home-number 1 ]
   if (distancexy min-pxcor min-pycor) < 5
    [ set home-number 1 ]  
   if home-number = 1
    [ set pcolor green ]

to setup-central-parking 
   if (distancexy 0 0) < 2
    [set pcolor  violet]
   if pcolor = violet
    [set parking-space 1]

to AddParking
   while [(count (patches with [pcolor = violet])) < (NumberOfParkingLots)] 
         [ask (patch random-pxcor random-pycor) 
         [if (pcolor != violet and home-number != 1)
           [set pcolor violet
            set parking-space 1]]]

to setup-prices
   ask patches [if pcolor = violet and (distancexy 0 0) < 2 [set price random central-parking-price]
                if pcolor = violet and (distancexy 0 0) > 2 [set price random periferical-parking-price]]
   ask turtles [set reservation-price random 5]

to go

to driving
   ask turtles [ifelse parked? = true

to LeaveParking? 
   if (time-at-arrival + parking-time) < ticks
    [set parked? false

to move
   ifelse (pcolor = violet and reservation-price > price and ( patch-here != any? turtles )) 
    [set parked? true
     set time-at-arrival ticks ]
    [ifelse  tries < 5 
      [move-to one-of patches with [(distancexy 0 0) < 2] 
       set tries (tries + 1)]
      [ifelse (pcolor = violet and reservation-price > price and ( patch-here != any? turtles ) and (distancexy 0 0) > 2 )  
        [set parked? true
         set time-at-arrival ticks]
        [set heading (random 360)
         fd random 5]]]         

to go-home
   move-to turtle-home 
   set tries  0

to CheckParking
   ask patches with [pcolor = violet]
    [ifelse any? turtles-here [set full? true
                               set parking-space 0]
                              [set full? false
                               set parking-space 1]]

to adjust-prices
   ask patches with [pcolor = violet]
    [if full? = false
      [set empty (empty + 1)]
     if full? = true
      [set crowded (crowded + 1)]
     if ((time-counter = 0) and (empty - crowded) > 10)
      [set price (price - decrease-price-by) 
       set crowded 0
       set empty 0]
     if ((time-counter = 0) and (crowded - empty) > 10)
      [set price (price + increase-price-by)
       set empty 0
       set crowded 0 ]
     if price < 0
      [set price 0]]

to time
  set time-counter (time-counter + 1 )
  if time-counter = 100
   [set time-counter 0
    set months-passed (months-passed + 1)]
;;; quanti sono i parcheggi che non hanno mai avuto una macchina
;; fissare i prezzi per la distanza dal centro
;;Slider che permetta di discriminare più o meno i prezzi fra centro e periferia

;;;prendere l'intervallo dato azzeriamo pieno e vuoto e 
;;;guardiamo se fra pieno e vuoto che differenza c'è se ce n'è molta aumentiamo o diminuiamo il prezzo