Competitive Market

Competitive Market preview image

1 collaborator

Default-person Tom Dowd (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.2 • Viewed 112 times • Downloaded 2 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.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

globals [
  average-consumer-income-index
  demand-points
  consumers
  consumers-consumption
  average-consumer-income
  consumers-income
  total-consumers-income
]

turtles-own [
    income
]

to setup
  clear-all
  create-turtles initial-consumer [ turtle-setup]
    update-demand-points-and-average-consumer-income             ;; ensures that with each tick the demand points and plots with update according to the interface and other numbers
  reset-ticks
end 



;; visualize the consumers from left to right in ascending order of income

to turtle-setup
    set shape "circle"
    set color red
    set size 3
    set xcor income
  set income random 200
  setxy income random-ycor

  set income income + 10
ifelse show-income?               ;; shows the starting amount of consumer income for each consumer competiting in the market
[ set label income ]
[ set label "" ]
end 

to go
  ;; transact and then update your location
  ask turtles with [ income > 50 ] [ transact ]
  ;; prevent consumers with higher incomes from moving too far to the right -- that is, outside the view
  ask turtles [ if consumers <= max-pxcor [ set xcor income ] ]
  update-demand-points-and-average-consumer-income
  tick
end 

to transact
  ;; give income (or purchasing power) to another turtle
  ;; when a consumer is leaving the market because the they do not have an income greater than 50
  set income income - 1
  ask one-of other turtles [ set income income + 1 ]
end 

;; report the total income of the top 10% of consumers

to-report top-10-pct-income
  report sum [ income ] of max-n-of (count turtles * 0.10) turtles [ income ]
end 


;; report the total income of the bottom half of consumers

to-report bottom-50-pct-income
  report sum [ income ] of min-n-of (count turtles * 0.50) turtles [ income ]
end 

to update-demand-points-and-average-consumer-income
  let num-income count turtles
  let sorted-income sort [ income ] of turtles
  let total-income sum sorted-income
  let income-sum-so-far 0
  let index 0
  set average-consumer-income 1
  set demand-points []
  repeat num-income [
    set income-sum-so-far (income-sum-so-far + item index sorted-income)
    set demand-points lput ((income-sum-so-far / average-consumer-income) * 100)  demand-points                  ;demand-points
      set index (index + 1)
      set average-consumer-income-index
      average-consumer-income-index +
      (index / num-income) -
      (income-sum-so-far / average-consumer-income)
    ]
end 

There is only one version of this model, created 8 months ago by Tom Dowd.

Attached files

File Type Description Last updated
Competitive Market.png preview Preview for 'Competitive Market' 8 months ago, by Tom Dowd Download

This model does not have any ancestors.

This model does not have any descendants.