Competing Technologies (iPhone vs Blackberry) v4

No preview image

1 collaborator

Default-person Felix Hu (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2013 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 258 times • Downloaded 21 times • Run 0 times
Download the 'Competing Technologies (iPhone vs Blackberry) v4' 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

breed [customers customer]
turtles-own [group-pref phantom-group-pref tech-pref influence-by-marketing friends contract-time]
globals [
  iphone-resources blackberry-resources 
  tech-iphone tech-blackberry 
  iphone-upgrade-cost blackberry-upgrade-cost 
  marketing-percentage-iphone patches-sum
  current-turtle-size current-friend-status growth-rate 
  cost-of-marketing
  iphone-marketing-spending iphone-tech-spending blackberry-marketing-spending blackberry-tech-spending 
  iphone-spent-on-marketing blackberry-spent-on-marketing iphone-spent-on-tech blackberry-spent-on-tech 
  iphone-tech-next-stage blackberry-tech-next-stage iphone-marketing-next-stage blackberry-marketing-next-stage
]

to setup
  clear-all
  initialize-variables
  
  set-default-shape customers "circle"
  create-customers initial-customers [
    ifelse random 100 < initial-iphone-percent [
      set color orange
    ][
      set color magenta
    ]
    create-helper
  ]
  ask turtles [
    create-links
  ]
  ask patches [
    set pcolor 5
  ]
  setup-marketing
  reset-ticks
end 

to go
  set-go-variables
  set-marketing-variable
  
  add-resources
  spend-resources
  
  change-turtle-size
  update-friends-status
  update-growth-rate
  add-customers
  update-contracts-and-remake-decision-if-expired
  
  tick
end 

to update-growth-rate ; this procedure updates the growth rate based on an inverse exponential function
  ifelse inverse-exp-growth? [
    ifelse e ^ (ticks / maximum-new-adoptors) > maximum-new-adoptors [
      set growth-rate maximum-new-adoptors
    ][
      set growth-rate int (e ^ (ticks / maximum-new-adoptors))
    ]
  ][
    set growth-rate 1
  ]
end 

to add-customers ; introduce customers to the world based on the function given by update-growth-rate
  if ticks mod growth-rate = 0 [
    create-customers 1 [
      create-helper
      create-links
      set-phone-choice
    ]
  ]
end 

to update-contracts-and-remake-decision-if-expired ; turtle proceture -- updates when their contract expires, and remakes their decision if expired
  ask customers [
    ifelse contract-time = 0 [
      set-phone-choice
      set contract-time 4 * 356
    ][
      set contract-time contract-time - 1
    ]
  ]
end 

to add-resources ; give each company an income based on the amount of customers they have
  set iphone-resources iphone-resources + count turtles with [color = orange]
  set blackberry-resources blackberry-resources + count turtles with [color = magenta]
end 

; this procedure also updates tech and marketing levels for both companies, after spending both company's income
; if the income is not enough to pay for a technology upgrade, the company still puts money towards it, but only
; gets the point after it has put enough money towards it
; this procedure also increases the technology cost as it updates

to spend-resources 
  ifelse random (iphone-tech-spending + iphone-marketing-spending) < iphone-marketing-spending [
    set iphone-spent-on-marketing iphone-spent-on-marketing + iphone-resources
    if iphone-spent-on-marketing > iphone-marketing-next-stage [
      if any? patches with [pcolor != 109] [
        ask one-of patches with [pcolor != 109] [
          set pcolor pcolor + 1
          set iphone-resources iphone-resources - cost-of-marketing
        ]
      ]
      set iphone-marketing-next-stage iphone-marketing-next-stage + cost-of-marketing
    ]
  ][
    set iphone-spent-on-tech iphone-spent-on-tech + iphone-resources
    if iphone-spent-on-tech > iphone-tech-next-stage [
      set tech-iphone tech-iphone + 1
      set iphone-tech-next-stage iphone-tech-next-stage + cost-of-marketing + tech-iphone * 300
    ]
  ]
  set iphone-resources 0
  
  ifelse random (blackberry-tech-spending + blackberry-marketing-spending) < blackberry-marketing-spending [
    set blackberry-spent-on-marketing blackberry-spent-on-marketing + blackberry-resources
    if blackberry-spent-on-marketing > blackberry-marketing-next-stage [
      if any? patches with [pcolor != 100] [
        ask one-of patches with [pcolor != 100] [
          set pcolor pcolor - 1
          set blackberry-resources blackberry-resources - cost-of-marketing
        ]
      ]
      set blackberry-marketing-next-stage blackberry-marketing-next-stage + cost-of-marketing
    ]
  ][
    set blackberry-spent-on-tech blackberry-spent-on-tech + blackberry-resources
    if blackberry-spent-on-tech > blackberry-tech-next-stage [
      set tech-blackberry tech-blackberry + 1
      set blackberry-tech-next-stage blackberry-tech-next-stage + cost-of-marketing + tech-blackberry * 300
    ]
  ]
  set blackberry-resources 0
end 

to setup-marketing ; this sets the initial random gradient marketing environment on setup
  ask one-of patches [
    set pcolor 104
    ask-neighbors
  ]
end 

to ask-neighbors ; this is a recursive procedure for patches
  let my-color pcolor
  ask neighbors [
    if pcolor = 5 [
      ifelse random 10 < 5 [
        ifelse my-color + 1 > 109 [
          set pcolor 109
        ][
          set pcolor my-color + 1
        ]
      ][
        ifelse my-color - 1 < 100 [
          set pcolor 100
        ][
          set pcolor my-color - 1
        ]
      ]
      ask-neighbors
    ]
  ]
end 

to set-phone-choice ; turtles use this procedure to decide which which preference they will consider when choosing a phone
  let sum-of-preference group-pref + tech-pref + influence-by-marketing
  let r random sum-of-preference
  ifelse r < group-pref [
    set-according-to-neighbors
  ][
    ifelse r < tech-pref + group-pref [
      set-according-to-tech
    ][
      set-according-to-marketing
    ]
  ]
end 

to set-according-to-neighbors ; this procedure is called if turtles prefer what their friends use over other preferences
  ifelse any? friends [
    let blackberry-neighbors 0
    let iphone-neighbors 0
    ask friends [
      ifelse color = orange [
        set iphone-neighbors iphone-neighbors + 1
      ][
        set blackberry-neighbors blackberry-neighbors + 1
      ]
    ]
    let r blackberry-neighbors + iphone-neighbors
    ifelse random r < iphone-neighbors [
      set color orange
    ][
      set color magenta
    ]
  ][
    ifelse random tech-pref + influence-by-marketing < tech-pref [
      set-according-to-tech
    ][
      set-according-to-marketing
    ]
  ]
end 

to set-according-to-tech ; this procedure is called if turtles prefer technology use over other preferences
  ifelse tech-blackberry < tech-iphone [
    set color orange
  ][
    set color magenta
  ]
end 

to set-according-to-marketing ; this procedure is called if turtles are more susceptible to marketing over other preferences
  ifelse random 10 <= pcolor - 100 [
    set color orange
  ][
    set color magenta
  ]
end 

to create-links ; this is a turtle procedure which sets a random amount of friends for each turtle
  if random 100 < 40 [
    set friends min-n-of random 15 turtles [distance myself]
  ]
end 

to initialize-variables ; initialize variables at setup
  set patches-sum count patches
  set iphone-resources 0
  set blackberry-resources 0
  set tech-blackberry 0
  set tech-iphone 0
  set current-turtle-size turtle-size
  set current-friend-status 999
  set cost-of-marketing 3000
  set iphone-spent-on-marketing 0
  set blackberry-spent-on-marketing 0
  set iphone-spent-on-tech 0
  set blackberry-spent-on-tech 0
  set iphone-tech-next-stage cost-of-marketing
  set blackberry-tech-next-stage cost-of-marketing
  set iphone-marketing-next-stage cost-of-marketing
  set blackberry-tech-next-stage cost-of-marketing
end 

to create-helper ; this sets up the variables required whenever a customer is introduced into the world--mostly personal preference variables
  setxy random-xcor random-ycor
  set size turtle-size
  set friends no-turtles
  set group-pref random-normal 10 3
  set phantom-group-pref group-pref
  set tech-pref random-normal 10 3
  set influence-by-marketing random-normal 10 3
  set contract-time 4 * 356
end 

to set-go-variables ; this procedure updates spending for companies, and is updated every tick
  set iphone-marketing-spending percentage-spent-on-marketing-iphone
  set iphone-tech-spending 100 - percentage-spent-on-marketing-iphone
  set blackberry-marketing-spending percentage-spent-on-marketing-blackberry
  set blackberry-tech-spending 100 - percentage-spent-on-marketing-blackberry
end 

to change-turtle-size ; this procedure updates the size of turtles, and is called at every tick
  if current-turtle-size != turtle-size [
    set-turtle-size
    set current-turtle-size  turtle-size
  ]
end 

to set-turtle-size ; ; this is a helper procedure used by change-turtle-size
  ask turtles [
    set size turtle-size
  ]
end 

to update-friends-status ; this procedure updates the status of friends, and is called at every tick
  if current-friend-status != friends? [
    ifelse friends? [
      set-back-group
    ][
      set-group-zero
    ]
    set current-friend-status friends?
  ]
end 

to set-group-zero ; this is a helper procedure used by update-friends-status
  ask turtles [
    set group-pref 0
  ]
end 

to set-back-group ; this is a helper procedure used by update-friends-status
  ask turtles [
    set group-pref phantom-group-pref
  ]
end 

to set-marketing-variable ; this procedure updates the the percentage of marketing influence iphone has in the world.
  let iphone-sum 0
  ask patches [
    set iphone-sum iphone-sum + pcolor - 100
  ]
  set marketing-percentage-iphone iphone-sum / (9 * patches-sum)
end 

There is only one version of this model, created almost 6 years ago by Felix Hu.

Attached files

File Type Description Last updated
EECS 372 Proposal.pdf pdf Original Project Proposal almost 6 years ago, by Felix Hu Download
FelixHu_June2.docx word June 2nd Progress Report almost 6 years ago, by Felix Hu Download
FelixHu_May20.docx word May 20th Progress Report almost 6 years ago, by Felix Hu Download
FelixHu_May27.docx word May 27th Progress Report almost 6 years ago, by Felix Hu Download
Final Report.docx word Final Report almost 6 years ago, by Felix Hu Download
Hu_Felix_Slam.pptx powerpoint Slam Powerpoint Presentation almost 6 years ago, by Felix Hu Download
poster.ppt pdf Poster almost 6 years ago, by Felix Hu Download

Parent: Competing Technologies (iPhone vs Blackberry) v3

This model does not have any descendants.

Graph of models related to 'Competing Technologies (iPhone vs Blackberry) v4'