Simple Economy Updated
Model was written in NetLogo 6.0.4
•
Viewed 353 times
•
Downloaded 16 times
•
Run 0 times
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
;; Modified and detailed commented by 深度碎片 ;; originally written by Uri Wilensky ;; Background of this model, quotes from Wilensky's book at https://github.com/EmbraceLife/shendusuipian/issues/51 ;; concept for analyzing this model at https://github.com/EmbraceLife/shendusuipian/issues/53 ;; updated model at https://github.com/EmbraceLife/NetLogo-Modeling/tree/master/finished%20models ;; What are the basic rules created such exponential inequality? ;; rules ;; 1. total wealth stays the same; ;; rules ;; 2. the population stays the same; ;; rules ;; 3. each agent has the same initial wealth; ;; rules ;; 4. each iteration, for any one of the agents gives away 1 dollar, and one other agent receives one dollar ;; insights ;; a great example of making assumptions to build a simple model ;; globals, properties, classes globals [ top-20pct ;; top 20% agents in wealth bottom-20pct ;; bottom 20% agents in wealth ] turtles-own [ wealth ;; wealth as new property to agent ] to setup ;; build the world clear-all ;; wipe out everything create-turtles 500 [ ;; create 500 agents, ask each to do the following set wealth 100 ;; has wealth of 100 set color green ;; color itself green set shape "circle" ;; make itself circle-like set size 2 ;; make itself twice big setxy wealth random-ycor ;; put itself horizontally based on wealth and vertically with random ] reset-ticks ;; set clock to 0 end to go ;; running the world ask turtles with [ wealth > 0 ] [ ;; ask all agents with positive wealth to do transact ;; transact money to each other ] ask turtles [ ;; ask all agents ifelse wealth <= max-pxcor ;; if wealth is not over the board (set board long enough ) [ set xcor wealth ] ;; stay horizontally where its wealth is [ set xcor max-pxcor set size 1.5 ] ;; otherwise, stay horizontal at the border edge and make self twice big ] plot-wealth-gap ;; plot the wealth gap between the top 20% vs the bottom 80% plot-wealth-distribution ;; plot wealth distribution of the population if track? [ ;; click on track to execute once set top-20pct max-n-of (count turtles * 0.2) turtles [wealth] ;; get the top 20% agents at this moment ask top-20pct [ set color red set size 3 ;; ask them to be red and triple in size ] set bottom-20pct min-n-of ( count turtles * 0.2 ) turtles [wealth] ;; get the bottom 20% agent at this same moment ask bottom-20pct [ set color blue set size 3 ;; ask them to be red and triple in size ] set track? false ;; make sure track only happen once ] if top-20pct != 0 and any? top-20pct [ ;; if top-20pct agents do exist ( not 0 not empty ) let top-20-now max-n-of (count turtles * 0.2) turtles [wealth] ;; get current top-20pct agents in wealth let min-top-20 min [wealth] of top-20-now ;; get the minimum wealth value of the current top-20pct agents let num-reach-top-20 count top-20pct with [wealth > min-top-20] ;; count the number of agents of top-20pct who belong to current top-20pct let pct-reach-top-20 num-reach-top-20 / count top-20pct * 100 ;; calc its ratio of original top-20pct let top-40-now max-n-of (count turtles * 0.4) turtles [wealth] let min-top-40 min [wealth] of top-40-now let num-reach-top-40 count top-20pct with [wealth > min-top-40] let pct-reach-top-40 num-reach-top-40 / count top-20pct * 100 ;; calc the ratio of original top-20pct which belong to current top-40pct let top-50-now max-n-of (count turtles * 0.5) turtles [wealth] let min-top-50 min [wealth] of top-50-now let num-reach-top-50 count top-20pct with [wealth > min-top-50] let pct-reach-top-50 num-reach-top-50 / count top-20pct * 100 ;; calc the ratio of original top-20pct which belong to current top-50pct plot-top20pct-stability pct-reach-top-20 pct-reach-top-40 pct-reach-top-50 ;; plot the three ratios above ] if bottom-20pct != 0 and any? bottom-20pct [ ;; if bottom-20pct agents do exist (not 0 not empty) let bottom-20-now min-n-of (count turtles * 0.2) turtles [wealth] ;; get current bottom 20pct agents in wealth let max-bottom-20 max [wealth] of bottom-20-now ;; get the maximum wealth value of the current bottom 20pct agent let num-above-bottom-20 count bottom-20pct with [wealth > max-bottom-20] ;; count the number of agents in original bottom 20pct go above current bottom 20pct let pct-above-bottom-20 num-above-bottom-20 / count bottom-20pct * 100 ;; calc the ratio of original bottom-20pct let bottom-40-now min-n-of (count turtles * 0.4) turtles [wealth] let max-bottom-40 max [wealth] of bottom-40-now let num-above-bottom-40 count bottom-20pct with [wealth > max-bottom-40] let pct-above-bottom-40 num-above-bottom-40 / count bottom-20pct * 100 ;; calc the ratio of original bottom-20pct which stay above to current bottom-40pct let bottom-50-now min-n-of (count turtles * 0.5) turtles [wealth] let max-bottom-50 max [wealth] of bottom-50-now let num-above-bottom-50 count bottom-20pct with [wealth > max-bottom-50] let pct-above-bottom-50 num-above-bottom-50 / count bottom-20pct * 100 ;; calc the ratio of original bottom-20pct which stay above to current bottom-50pct plot-bottom20pct-stability pct-above-bottom-20 pct-above-bottom-40 pct-above-bottom-50 ;; plot the three ratios above ] tick end to transact ;; transact wealth set wealth wealth - 1 ;; give away 1 unit of wealth ask one-of other turtles [ set wealth wealth + 1 ] ;; another agent receive 1 unit of wealth end to-report top-20-pct-wealth ;; report wealth sum of top 20pct agent to `top-20-pct-wealth` report sum [ wealth ] of max-n-of (count turtles * 0.2) turtles [ wealth ] end to-report bottom-80-pct-wealth ;; report wealth sum of bottom 80pct agent to `bottom-80-pct-wealth` report sum [ wealth ] of min-n-of (count turtles * 0.8) turtles [ wealth ] end to plot-wealth-gap set-current-plot "wealth gap" set-current-plot-pen "top 20%" plot top-20-pct-wealth set-current-plot-pen "bottom 80%" plot bottom-80-pct-wealth end to plot-wealth-distribution set-current-plot "wealth distribution" set-plot-y-range 0 40 set-current-plot-pen "dist" histogram [ wealth ] of turtles end to plot-top20pct-stability [ top20 top40 top50 ] set-current-plot "top-20pct-stability" set-current-plot-pen "stay top 20" plot top20 set-current-plot-pen "stay top 40" plot top40 set-current-plot-pen "stay top 50" plot top50 end to plot-bottom20pct-stability [ bottom20 bottom40 bottom50 ] set-current-plot "bottom-20pct-stability" set-current-plot-pen "above bottom 20" plot bottom20 set-current-plot-pen "above bottom 40" plot bottom40 set-current-plot-pen "above bottom 50" plot bottom50 end
There is only one version of this model, created over 5 years ago by 深度碎片 Kenny.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Simple Economy Updated.png | preview | Preview for 'Simple Economy Updated' | over 5 years ago, by 深度碎片 Kenny | Download |
This model does not have any ancestors.
This model does not have any descendants.