# Print Marketplace

Model was written in NetLogo 5.0.3
•
Viewed 536 times
•
Downloaded 41 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

;; "Print Marketplace: an Agent-Based Model" ;; by Michael Gavin, University of South Carolina, 2014. globals [ year ;; statistics are calculated annually (every 100 ticks) books-sold ;; calculates cumulative book total smoothed-books-of-readers ;; creates smoothed line of book-sold for easier reading smoothed-num-of-printers ;; creates smooth line of the count of printers for easier reading monopoly-radius ;; distance that printers look for rivals monopolize-trade ;; true/false variable that selects and kills excess printers last-years-sales ;; global calculation of books taken from printers ] ;; The following breed types are based very closely on Jeremy Throne's original model. turtles-own [ surveillance-radius ] ;; distance of vision for all turtles breed [ authors author ] ;; creates a type of turtle named "author" authors-own [ manuscripts ;; provides all "authors" with the ability to store manuscripts encouragement ] ;; provides all "authors" with the ability to receive encouragement breed [ publishers publisher ] ;; creates a type of turtle named "publisher" publishers-own [ submissions ] ;; provides all "publishers" with the ability to store submissions breed [ printers printer ] ;; creates a type of turtle named "printer" printers-own [ jobs ] ;; provides all "printers" with the ability to store jobs breed [ shippers shipper ] ;; creates a type of turtle named "shipper" shippers-own [ cargo ] ;; provides all "shippers" with the ability to store cargo breed [ sellers seller ] ;; creates a type of turtle named "seller" sellers-own [ inventory ] ;; provides all "sellers" with the ability to store inventory breed [ readers reader ] ;; creates a type of turtle named "reader" readers-own [ books ] ;; provides all "readers" with the ability to store books breed [ censors censor ] ;; creates a type of turtle (not included in Throne) named "censor" to setup clear-all set year 1 set smoothed-books-of-readers 0 set monopoly-radius max-monopoly-radius reset-ticks create-authors 2 [ ;; creates authors and sets their initial properties setxy random-xcor random-ycor set shape "person" set color red ;; red signifies where the books are set manuscripts 1 ;; start the author with a single manuscript ] create-publishers 2 [ ;; creates authors and sets their initial properties setxy random-xcor random-ycor set shape "house" set color white ;; white signifies there are no books ] create-printers 2 [ ;; creates printers and sets their initial properties setxy random-xcor random-ycor set shape "x" set color white ;; white signifies there are no books ] create-shippers 2 [ ;; creates shippers and sets their initial properties setxy random-xcor random-ycor set shape "wheel" set color white ;; white signifies there are no books ] create-censors 10 [ ;; creates shippers and sets their initial properties setxy random-xcor random-ycor set surveillance-radius random 10 set shape "wolf" set color white ;; white signifies there are no books ] create-sellers 2 [ ;; creates sellers and sets their initial properties setxy random-xcor random-ycor set shape "triangle" set color white ;; white signifies there are no books ] create-readers 10 [ ;; creates readers and sets their initial properties setxy random-xcor random-ycor set shape "person" set color white ;; white signifies where the books are ] end ;; At go, the turtles are activated. Every 100 ticks a system-level review is performed. STOP after 225 years (22,500 ticks) to go ask authors [ move solicit-publisher ] ask publishers [ move hire-printer resist-oppression ] ask shippers [ move load-cargo deliver-cargo ] ask censors [ move ] ask readers [ move buy-book meet-author ] if ticks = 100 [ perform-review ] if year = 225 [stop] tick end ;; Every 100 ticks (a metric "year"), this procedure is called. to perform-review ;; the following commands control the plot set year year + 1 set-current-plot "Books Published Annually" set-current-plot-pen "Books" set smoothed-books-of-readers 0.7 * smoothed-books-of-readers + ( 0.3 * sum [books] of readers ) ; line smooth rule borrowed from Uri Wilensky, "code examples" plot smoothed-books-of-readers set-current-plot-pen "Population" plot (count readers + count authors) / 5 set-current-plot-pen "Printers" set smoothed-num-of-printers 0.6 * smoothed-books-of-readers + ( 0.4 * count printers ) plot smoothed-num-of-printers set books-sold books-sold + (sum [books] of readers) ;; total books sold is tabulated ask one-of censors [ update-radius warn-stationers ] ;; censors review the state of the system and adjust ask one-of printers [ restrict-printing ] ;; printers enforce their monopoly ask readers [set books 0] ;; books levels are reset expand ;; population growth reset-ticks end ;; censors' procedure, called annually by "perform-review," in which they update their surveillance to update-radius let readers-policed readers in-radius surveillance-radius ifelse count readers-policed > 0 [ let readers-policed-percentage count readers-policed with [books > 0] / count readers-policed ifelse readers-policed-percentage > suppression-threshold [ set surveillance-radius surveillance-radius + 1 ] [ set surveillance-radius surveillance-radius - 1 ] ] [ set surveillance-radius surveillance-radius + 1 ] if surveillance-radius < 0 [ set surveillance-radius 0 ] end ;; censors' procedure, called annually by "perform-review," in which they alert stationers to warn-stationers if any? sellers in-radius surveillance-radius [ ask sellers in-radius surveillance-radius [ set surveillance-radius [surveillance-radius] of myself ] ] if any? shippers in-radius surveillance-radius [ ask shippers in-radius surveillance-radius [ set surveillance-radius [surveillance-radius] of myself ] ] if any? printers in-radius surveillance-radius [ ask printers in-radius surveillance-radius [ set surveillance-radius [surveillance-radius] of myself ] ] if any? publishers in-radius surveillance-radius [ ask publishers in-radius surveillance-radius [ set surveillance-radius [surveillance-radius] of myself set submissions 0 ] ] ;; one publisher's manuscripts are confiscated end ;; Expansion is controlled on a simple line. Most turtles have a 50-50 chance of adding a single ;; turtle; readers are adding on an exponential line. to expand ask one-of authors [ hatch one-of [ 1 0 ] [ setxy random-xcor random-ycor set shape "person" set color red set manuscripts 1 ] ] ask one-of sellers [ hatch one-of [1 0] [ setxy random-xcor random-ycor set shape "triangle" set color white ] ] ask one-of publishers [ hatch one-of [0 1] [ setxy random-xcor random-ycor set shape "house" set color white ] ] ask one-of shippers [ hatch one-of [1 0] [ setxy random-xcor random-ycor set shape "wheel" set color white ] ] ask one-of printers [ hatch one-of [1 0] [ setxy random-xcor random-ycor set shape "x" set color white ] ] ;; Reading population set to grow more quickly on a simple but ever-increasing rate. ask one-of readers [ hatch round (year / 50 ) [ ;; creates readers and sets their initial properties setxy random-xcor random-ycor set shape "person" set color white ] ] ;; but sometimes there's a catastrophe check-for-catastrophe end to check-for-catastrophe let catastrophe-throw random 100 if catastrophe-throw > 95 and catastrophe-throw <= 98 [ let num-readers-to-die round ( count readers / 5 ) repeat num-readers-to-die [ ask one-of readers [ die ] ] ] if catastrophe-throw >= 99 [ let big-num-readers-to-die round ( count readers / 4 ) repeat big-num-readers-to-die [ ask one-of readers [ die ] ] ] if catastrophe-throw <= 1 [ let big-num-readers-to-hatch round ( count readers / 4 ) ask one-of readers [ hatch big-num-readers-to-hatch [ setxy random-xcor random-ycor set shape "person" set color white ] ] ] end ;; Set printer restrictions rule. to restrict-printing ifelse mean [ jobs ] of printers < supply-trigger [ set monopoly-radius monopoly-radius + .5 ] [ set monopoly-radius monopoly-radius - .5 ] if monopoly-radius > max-monopoly-radius [ set monopoly-radius max-monopoly-radius ] if monopoly-radius < min-monopoly-radius [ set monopoly-radius min-monopoly-radius ] repeat one-of [ 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 ] [ ask one-of printers [ set jobs 0 enforce-monopoly ] ] end ;; This command moves the turtles. to move ifelse count censors in-radius surveillance-radius = 0 [ rt random 50 ;; turns a turtle some portion of 50 degrees to the right lt random 50 ;; turns a turtle some portion of 50 degrees to the left fd .1 ;; advances forward 1 patch ] [ rt random 50 lt random 50 fd 1 ] end ;; AUTHOR FUNCTIONS ;; The following procedure is borrowed closely from Throne's original. If authors bump into ;; publishers while carrying a manuscript, the manuscripts are converted to "submissions." to solicit-publisher if any? publishers-here [ if manuscripts > 0 ;; and the author has a book [ set manuscripts manuscripts - 1 ;; remove manuscript from author set color white ask one-of publishers-here [ set submissions submissions + 1 ;; increase submissions to publisher set color red ] ] ] end ;; PUBLISHER FUNCTIONS ;; to hire-printer if submissions > 0 and any? printers-here and count censors in-radius surveillance-radius = 0 [ set submissions submissions - 1 ;; take a submission from the publisher ask one-of printers-here [ set jobs jobs + 1 ] ] end ;; when their backlog becomes too high, publishers lash out against the censors, but receive punishment in turn. to resist-oppression if submissions > backlog-threshold [ ; if inventory of submissions has accumulated if any? censors in-radius surveillance-radius [ ; publishers look for censors in radius ask censors in-radius surveillance-radius [ set surveillance-radius 0 ; they then basically shut the censor down set color red ] ] ; and change its color to red. However, they receive backlash (their submissions are lost) repeat round ( count publishers / ( random count publishers + 1 ) ) [ ask one-of publishers [ set submissions 0] ] ;; and any number of publishers feel the pain. ask one-of printers [ hatch 1 [ ; but the moment of social breakdown opens a space for an entrepreneurial printer to open shop setxy random-xcor random-ycor set shape "x" set color white ] ] ] end ;; SHIPPER PROCEDURES ;; When out of state control shippers face a printer before reorienting. Otherwise, they move normally. to ship ifelse count censors in-radius surveillance-radius = 0 and cargo = 0 and any? printers with [ jobs > 0 ] [ face one-of printers with [ jobs > 0 ] rt random 50 lt random 50 fd 1 ] [ rt random 50 lt random 50 fd .2 ] end ;; The "load-cargo" procedure is based closely on Throne's original model. ;; If printers bump into a printer, and if the printer has a job, the shipper takes it. to load-cargo if any? printers-here with [ jobs > 0 ] and count censors in-radius surveillance-radius = 0 ;; if the shipper meets a printer with jobs waiting [ ask one-of printers-here with [ jobs > 0 ] [ set jobs jobs - 1 ] ask one-of shippers-here [ set cargo cargo + 1 ] ;; increase cargo of shipper by one unit ] end ;; The "deliver-cargo" procedure is based closely on Throne's original model. ;; If printers bump into a printer, and if the printer has a job, the shipper takes it. to deliver-cargo if any? sellers-here and count censors in-radius surveillance-radius = 0 [ let delivery cargo ;; turn the cargo into a delivery set cargo 0 ask one-of sellers-here [ set inventory inventory + delivery ] ;; increase the inventory of a seller by the amount of the delivary ] end ;; READER PROCEDURES ;; The "buy book" procedure is based closely on Throne's original. ;; When readers bump into sellers, they buy books. One minor but ;; significant change is that readers can only buy one book per year. to buy-book if any? sellers-here with [ inventory > 0 ] and books < 1 ;; if the reader meets a seller with books to sell and reader has no book. [ ask one-of sellers-here with [ inventory > 0 ] [ set inventory inventory - 1 ] set books books + 1 set color blue ] end ;; The "meet-author" procedure is based closely on Throne's original. ;; When readers bump into authors, they encourage authors to write. One minor ;; but significant change is that authors' "writing-threshold" is changed ;; from the original into a slider variable. to meet-author if any? authors-here [ ask one-of authors-here [ set encouragement encouragement + 1 if encouragement > writing-threshold ;; if authors have enough encouragement [ set manuscripts manuscripts + 1 ;; they write manuscripts set encouragement encouragement - writing-threshold ] ;; and their "encouragement" score is decreased ] ] ] end ;; PRINTER CONTROLS ;; Called above, one printer each year enforces the monopoly by finding ;; and killing one fellow printer within its personal "monopoly-radius." Thus, ;; the smaller the radius the less stringent the monopoly. to enforce-monopoly let printers-to-exclude printers in-radius monopoly-radius with [ who != [who] of myself ] ;; can't enforce against itself! if any? printers-to-exclude [ ask printers-to-exclude [die] ;; kills off competitors ] end

There are 3 versions of this model.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Print Marketplace.png | preview | Preview for 'Print Marketplace' | over 5 years ago, by Michael Gavin | Download |

This model does not have any ancestors.

This model does not have any descendants.