Competitive Market

No preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Default-person Steven Kimbrough (Author)

Tags

bounded rationality9 

Tagged by Steven Kimbrough almost 8 years ago

competition 

Tagged by Steven Kimbrough almost 8 years ago

markets 

Tagged by Steven Kimbrough almost 8 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.5 • Viewed 642 times • Downloaded 65 times • Run 0 times
Download the 'Competitive Market' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

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

Click to Run Model

globals [PriceEquilibrium QuantityEquilibrium QuantityIntercept
  Prices
  RandomMeanQuantity RandomMeanPrice]

to Setup
  ;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  __clear-all-and-reset-ticks
  set QuantityIntercept  DemandPriceIntercept / abs DemandSlope
  PlotSupplyAndDemandCurves
  
  set QuantityEquilibrium  DemandPriceIntercept / (SupplySlope - DemandSlope)
  set PriceEquilibrium SupplySlope * QuantityEquilibrium
  
  PlotSupplyAndDemandResolutions
  
  set Prices []
end 

to PlotSupplyAndDemandCurves
  set-current-plot "Supply and Demand Curves"
  set-current-plot-pen "Demand"   
  ;print (word "QuantityIntercept = " QuantityIntercept)
  plot-pen-up
  plotxy 0 DemandPriceIntercept
  plot-pen-down
  plotxy QuantityIntercept 0
  set-current-plot-pen "Supply"
  plot-pen-up
  plotxy 0 0
  plot-pen-down
  plotxy QuantityIntercept SupplySlope * QuantityIntercept 
end 

to PlotSupplyAndDemandResolutions
  set-current-plot "Supply and Demand Resolutions"
  set-current-plot-pen "Demand"
  print (word "QuantityIntercept = " QuantityIntercept)
  plot-pen-up
  plotxy 0 DemandPriceIntercept
  plot-pen-down
  plotxy QuantityIntercept 0
  set-current-plot-pen "Supply"
  plot-pen-up
  plotxy 0 0
  plot-pen-down
  plotxy QuantityIntercept SupplySlope * QuantityIntercept 
  set-current-plot-pen "Average"
  plot-pen-up
  plotxy 0 DemandPriceIntercept / 2.0
  plot-pen-down
  plotxy QuantityIntercept ((DemandPriceIntercept + (DemandSlope + SupplySlope) * QuantityIntercept)) / 2.0
  set-current-plot-pen "Random Mean"
  plot-pen-up
  set RandomMeanQuantity (QuantityEquilibrium / 2)
  plotxy  RandomMeanQuantity 0
  let RandomMeanSupply SupplySlope * RandomMeanQuantity
  let RandomMeanDemand DemandPriceIntercept + DemandSlope * RandomMeanQuantity
  set RandomMeanPrice (RandomMeanSupply + RandomMeanDemand) / 2.0
  plot-pen-down
  plotxy (QuantityEquilibrium / 2) DemandPriceIntercept
end 

to Go
  tick
  let SupplyGuy random-float QuantityTradeMax ; QuantityEquilibrium
  let SupplyReservation SupplyGuy * SupplySlope
  let DemandGuy random-float QuantityTradeMax ; QuantityEquilibrium
  let DemandReservation DemandPriceIntercept + DemandSlope * DemandGuy
  set-current-plot "Prices"
  set-plot-x-range 0 round ( DemandPriceIntercept  - PriceEquilibrium + 5)
  set-plot-y-range 0 100 ;( DemandPriceIntercept  - PriceEquilibrium)
  set-histogram-num-bars 100
  if (SupplyReservation <= DemandReservation)
    [let DaPrice (SupplyReservation + DemandReservation) / 2
     set Prices lput DaPrice Prices        
        set-current-plot-pen "Price"
        set-plot-pen-mode 1
        plot-pen-down
        histogram Prices
      ]
;    [print (word "This should not happen! Quitting.")
;     let bob 0
;     let carol 3 / bob
;    ]
end 

There is only one version of this model, created almost 8 years ago by Steven Kimbrough.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.