Products into the Market

Products into the Market preview image

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

1 collaborator

Fabio_monteneri Fabio Monteneri (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.2.0 • Viewed 743 times • Downloaded 47 times • Run 0 times
Download the 'Products into the 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.)


Products into the Market 1.1

ACKNOWLEDGMENT

This model is a project for the exam of Distributed Calculus and Coordination with the help of our Supervisor Professor Emanuela Merelli and coordinator Matteo Rucco.

WHAT IS IT?

This model is an example of how two products are spread in a network of people in contact or not with each other. A person can acquire the product also without any connection with other people. Its purpose is to allow you to explore the relationship between different centrality measures, and different network types, and see if the interactions between them make for faster or slower spread of the product.

HOW IT WORKS

When the model is set up, a certain number of person are created and connected in a network of the type selected (preferential attachment or a random network). A number of people are seeded with the two products at time 0. At each tick, each person has a small chance of adopting the product on their own (1%), and a larger chance of adopting the product if any of their friends have adopted the product (0.5 * the ratio of neighbors who have adopted to the number of all neighbors). Both products will also have a popularity factor, more a brand is popular, more is easy that a person will buy its product.

The user can decide if the model stops when the whole market is saturated. The model always stops when a company fails

HOW TO USE IT

Start by selecting a type of network. Then choose how many people are in the world, how many of them are initially seeded for the two products, how much brands are popular and by what centrality measure these people are selected. You can also decide if the model will continue forever.

When you click SETUP, the network will be generated at the center of the graphic, pressing in Layout nodes will expands, and when you click GO, nodes will start infecting their neighbors.

THINGS TO TRY

Try to set up different kinds of networks, and select the initially seeded person by different centrality measures. Are there particular measures that might result in a faster spread in particular types of networks, but not in others? Why do you think that is? Try to give a lot of sponsors to a product and few to the other and to set popularity too, the market will change aspect For example you can set a brand as Popular and give more sponsor to the other, the market will draw in some case. If you put a lot of sponsor and popularity to a brand, probably the other brand will fail.

EXTENDING THE MODEL

The model was inspired by the Local Viral Marketing Problem (Stonedahl, Rand & Wilensky 2010) of an adoption network. Currently the model simply measures how fast a virus spreads on a network, but does not take into account how fast it is spread to each individual node which is one way to calculate the net present value (NPV) of a strategy. If the model were to fully implement the NPV of a model, the value of each infected node would depend on at what time it was infected.

Further, the model currently allows for only two different network types and four centrality measures. These could be extended as well.

Finally, the model only allows users to choose one centrality measure by which to initially infect turtles. Ideally it would be possible to set a number of infected turtles, and choose proportions of centrality measures to infect these turtles.

CREDITS AND REFERENCES

This model is a simplified model based on another model by Arthur Hjorth (arthur.hjorth@u.northwestern.edu).

COPYRIGHT AND LICENSE

Copyright 2015 Fabio Monteneri.

Comments and Questions

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

Click to Run Model

extensions [nw]         ;;Extends and replaces the old Network Extension bundled in Netlogo

breed [people person]   ;;Define a new breed 

people-own [
  buyapple?             ;; whether or not the person has bought the product Apple
  buysamsung?           ;; whether or not the person has bought the product Samsung
  
  randomapplen?         ;; other boolean variables to print and check
  randomsamsungn?
  friendapplen?
  friendsamsungn?
  friendsamsungbutapplen?
  friendapplebutsamsungn?
  drawsamsungn?
  drawapplen?
  drawsamsungbutapplen?
  drawapplebutsamsungn?
]

to setup
  ;  clear-all          ;; if you want that every time you setup you start a new project, uncomment this line
  create-network        ;; go to create-network method
  seed                  ;; go to seed method
  reset-ticks
end 

to allfalse             ;; just reset every person
ask people [
  set buyapple?  false
  set buysamsung?  false
  set randomapplen? false
  set randomsamsungn? false
  set friendapplen? false
  set friendsamsungn? false
  set friendsamsungbutapplen? false
  set friendapplebutsamsungn? false
  set drawsamsungn? false
  set drawapplen? false
  set drawsamsungbutapplen? false
  set drawapplebutsamsungn? false
  update-color
    ]
  seed
end 

;; seed the population with users who have already been given the product
;; you can either seed randomly or use betweenness centrality
;; if you choose Betweenness you have to add one more samsung sponsor.

to seed
    if seeding-method = "random" [           ;; seeds are putted randomly among people
    ask n-of sponsorapple people [
      set buyapple? true                     ;; give at n people an apple product
      set buysamsung? false
      update-color                           ;; go to update-color method
    ]
    ask n-of sponsorsamsung people [
      set buysamsung? true                   ;; give at n people a samsung product
      set buyapple? false
      update-color                           ;; go to update-color method
    ]
  ]

  if seeding-method = "betweenness" [        ;; Betweenness method is used, n-product are given following the centrality
      ask max-n-of sponsorsamsung people [ nw:betweenness-centrality ] [
      set buysamsung? true                   ;; give at n people a samsung product
      set buyapple? false
      update-color                           ;; go to update-color method
    ]
      ask max-n-of sponsorapple people [ nw:betweenness-centrality ] [
      set buyapple? true                     ;; give at n people an apple product
      set buysamsung? false
      update-color                           ;; go to update-color method
      ]
  ]
end 



;; create the social network

to create-network
  if network-type = "random" [ create-random-network ]
  if network-type = "preferential-attachment" [ create-preferential-attachment ]
end 

;; generate an Erdos-Renyi random graph

to create-random-network
  nw:generate-random people links number-of-people 0.004 [
    set shape "person"
    set color yellow
    set size 1.5
    set buyapple? false
    set buysamsung? false
  ]
end 

;; the Barabasi-Albert method of creating a PA graph

to create-preferential-attachment
  nw:generate-preferential-attachment people links number-of-people [
    set size 1.5
    set shape "person"
    set color yellow
    set buyapple? false
    set buysamsung? false
  ]
end 



;; simple loop just check to see if a person hasn't bought then decide if they should adopt

to go
ifelse forever? [][     ;; if forever button is false the operation will stop when everyone has bought a product
  if all? people [buyapple? or buysamsung?] [stop]
]
  if all? people [buyapple?] [stop]      ;; Machine stops if apple own the markes
  if all? people [buysamsung?] [stop]    ;; Machine stops if samsung own the market

  ifelse output?[
  ask people [ decide-to-adopt ]           ;; Ask to adopt to everyone
]
[
  ask people [decide-to-adoptnooutput]]

  ask people [ update-color ]              ;; Ask to everyone to update color
  tick
end 




;; the decision rule to adopt which is based on the Bass model of diffusion

to decide-to-adopt
  
  ;; Create strings to print 
  let casualeapple "Buys Apple on his own \n"
  let casualesamsung "Buys Samsung on his own \n"
  let amiciapple "Buys Apple because of neighbors \n"
  let amicisamsung "Buys Samsung because of neighbors \n"
  let amicisamsungbutapple "Buys Samsung even if has more neighbors with Apple \n"
  let amiciapplebutsamsung "Buys Apple even if has more neighbors with Samsung \n"
  let drawsamsung "Buys Samsung even if has same neighbors with Apple and Samsung \n"
  let drawapple "Buys Apple even if has same neighbors with Apple and Samsung \n"
  let drawsamsungbutapple "Buys Samsung even if has same neighbors with Apple and Samsung, after tried to buy Apple \n"
  let drawapplebutsamsung "Buys Apple even if has same neighbors with Apple and Samsung, after tried to buy Samsung \n"
    
     ;;Starts a new if sequence for buying algorithm
  output-print (word "----------START ALGORITHM-----------")
    
    let firstrandom random-float  1.0
    ifelse firstrandom < 0.02[;random
      output-print (word "First random number: " firstrandom ". It's minor than 2%. -> Random WAY")

      let secondrandom random-float  2.0
      ifelse secondrandom < 1 [
              output-print (word "Second random number: " secondrandom ". It's minor than 1. -> Apple")
    output-type casualeapple 
    set randomapplen? true
    set buyapple? true
    set buysamsung? false
                              output-print "----------END OF THE ALGORITHM----------\n\n"
    ] [
          
        ;;inizio IFELSE RANDOM SAMSUNG
        output-print (word "Second random number: " secondrandom ". It's greater than 1. -> Samsung")
        output-type casualesamsung 
        set randomsamsungn? true
        set buysamsung? true
        set buyapple? false
                                  output-print "----------END OF THE ALGORITHM----------\n\n"
      
      ]]
    
    [  
      output-print (word "First random number: " firstrandom ". It's greater than 2%. -> Neighbors Way")
             
        ;;inizio NEIGHBORS 
        ifelse any? link-neighbors [
          output-print "This person has neighbors."
          ifelse any? link-neighbors with [ buyapple? = true or buysamsung? = true][
        output-print "This person has neighbors with some product."
        let valoreapple 5  - popularityapple
        let valoresamsung 5 - popularitysamsung
        let apple count link-neighbors with [ buyapple? = true ] / count link-neighbors
        let samsung count link-neighbors with [ buysamsung? = true ] / count link-neighbors
        
           ifelse apple > samsung [
           output-print (word "More Apple neighbors than Samsung (" apple " vs " samsung ")")
           let probabilitaa apple * 0.5
           let randomnuma random-float valoreapple
               ifelse randomnuma < probabilitaa [
               output-print (word "The random number is minor than the Probability. -> Apple. ("randomnuma  " < " probabilitaa")")
                 output-type amiciapple
                 set friendapplen? true
               set buyapple? true
               set buysamsung? false
                                         output-print "----------END OF THE ALGORITHM----------\n\n"
               ]
               [
                 output-print (word "The random number is greater than the Probability. -> Try with Samsung. ("randomnuma  " > " probabilitaa")")
                 let probabilitas samsung * 0.5
                 let randomnums random-float valoresamsung
                 ifelse randomnums < probabilitas[
                 output-print (word "The random number is minor than the Probability. -> Samsung. ("randomnums  " < " probabilitas")")
                 output-type amicisamsungbutapple
                 set friendsamsungbutapplen? true
                 set buysamsung? true
                 set buyapple? false
                                           output-print "----------END OF THE ALGORITHM----------\n\n"
                 ]
                 [
                 output-print (word "The random number is greater than the Probability. -> Doesn't buy. ("randomnums  " > " probabilitas")")
                   ]
                 
                 ]
               
                                                              output-print "----------END OF THE ALGORITHM----------\n\n"
               ]
               
               [ ifelse samsung > apple [
           output-print (word "More Samsung neighbors than Apple (" apple " vs " samsung ")")
                   let probabilitas samsung * 0.5
                   let randomnums random-float valoresamsung
                   ifelse randomnums < probabilitas[
                 output-print (word "The random number is minor than the Probability. -> Samsung. ("randomnums  " < " probabilitas")")
                   output-type amicisamsung
                   set friendsamsungn? true
                   set buysamsung? true
                   set buyapple? false
                                             output-print "----------END OF THE ALGORITHM----------\n\n"
                   ]                   
                   [
                     
                 output-print (word "The random number is greater than the Probability. -> Try with Apple. ("randomnums  " > " probabilitas")")
                     let probabilitaa apple * 0.5
                     let randomnuma random-float valoreapple
                     ifelse randomnuma < probabilitaa[
                 output-print (word "The random number is minor than the Probability. -> Apple. ("randomnuma  " < " probabilitaa")")

                     output-type amiciapplebutsamsung
                     set friendapplebutsamsungn? true
                     set buyapple? true
                     set buysamsung? false
                                               output-print "----------END OF THE ALGORITHM----------\n\n"
                     ]
                     
                     [
                 output-print (word "The random number is greater than the Probability. -> Doesn't buy anything. ("randomnuma  " > " probabilitaa")")
                       ]
                     ]
                                                                                 output-print "----------END OF THE ALGORITHM----------\n\n"
                   ][;;in teoria va quando è uguale
                   if samsung = apple[
                     
           output-print (word "This node has neighbors with the same number of Apple and Samsung (" samsung " contro " apple ")")
                     let randomdraw random-float 1.0
                     ifelse randomdraw < 0.5 [;;randomdraw < 0.5
                       output-print (word "Random number generated: " randomdraw ". It's minor than 0.5, so priority to Samsung.")
                       let probabilitas samsung * 0.5
                       let randomnums random-float valoresamsung
                       ifelse randomnums < probabilitas[;;ifelse random samsung < probabilita samsung
                 output-print (word "The random number is minor than the Probability. -> Samsung. ("randomnums  " < " probabilitas")")
                         output-type drawsamsung 
                         set drawsamsungn? true
                         set buysamsung? true
                         set buyapple? false
                                                   output-print "----------END OF THE ALGORITHM----------\n\n"
                         ][;;ifelse false random samsung < probabilita samsung, tentativo apple
                 output-print (word "The random number is greater than the Probability. -> Try with Apple. ("randomnums  " > " probabilitas")")
                         let probabilitaa apple * 0.5
                         let randomnuma random-float valoreapple
                         ifelse randomnuma < probabilitaa[
                 output-print (word "The random number is minor than the Probability. -> Apple. ("randomnuma  " < " probabilitaa")")
                          output-type drawapplebutsamsung
                          set drawapplebutsamsungn? true
                          set buyapple? true
                          set buysamsung? false
                                                    output-print "----------END OF THE ALGORITHM----------\n\n"
                         ]
                         [
                 output-print (word "The random number is Greater than the Probability. -> Doesn't buy anything. ("randomnuma  " > " probabilitaa")")
                           ]
                         ]
                       ]
                     [;; randomdraw > 0.5
                                              output-print (word "The random number generated: " randomdraw ". It's minor than 0.5, so priority to Apple")
                       let probabilitaa apple * 0.5
                       let randomnuma random-float valoreapple
                       ifelse randomnuma < probabilitaa[;;ifelse random samsung < probabilita samsung
                 output-print (word "The random number is minor than the Probability. -> Apple. ("randomnuma  " < " probabilitaa")")

                         output-type drawapple 
                         set drawapplen? true
                         set buyapple? true
                         set buysamsung? false
                                                   output-print "----------END OF THE ALGORITHM----------\n\n"
                         ][
                 output-print (word "The random number is greater than the Probability. -> Try with Samsung. ("randomnuma  " > " probabilitaa")")
                         let probabilitas samsung * 0.5
                         let randomnums random-float valoresamsung
                         ifelse randomnums < probabilitas[
                 output-print (word "The random number is minor than the Probability. -> Samsung. ("randomnums  " < " probabilitas")")
                          output-type drawsamsungbutapple
                          set drawsamsungbutapplen? true
                          set buysamsung? true
                          set buyapple? false
                          output-print "----------END OF THE ALGORITHM----------\n\n"
                         ]
                         [
                 output-print (word "The random number is greater than the Probability. -> Doesn't buy anithing. ("randomnums  " > " probabilitas")")
                           ]
                         ]
                       
                       ]
                     
                   ]
                   ]
             
        ]
          ][output-print "This person hasn't neighbor with a product"
                                    output-print "----------END OF THE ALGORITHM----------\n\n"]
  
        ]
        [                           output-print "This person hasn't neighbor\n\n"       
                            output-print "----------END OF THE ALGORITHM----------\n\n"]
    
      ]  
end 


;; the decision rule to adopt which is based on the Bass model of diffusion, no output

to decide-to-adoptnooutput
  
  ;; Create strings to print 
  let casualeapple "Buys Apple on his own \n"
  let casualesamsung "Buys Samsung on his own \n"
  let amiciapple "Buys Apple because of neighbors \n"
  let amicisamsung "Buys Samsung because of neighbors \n"
  let amicisamsungbutapple "Buys Samsung even if has more neighbors with Apple \n"
  let amiciapplebutsamsung "Buys Apple even if has more neighbors with Samsung \n"
  let drawsamsung "Buys Samsung even if has same neighbors with Apple and Samsung \n"
  let drawapple "Buys Apple even if has same neighbors with Apple and Samsung \n"
  let drawsamsungbutapple "Buys Samsung even if has same neighbors with Apple and Samsung, after tried to buy Apple \n"
  let drawapplebutsamsung "Buys Apple even if has same neighbors with Apple and Samsung, after tried to buy Samsung \n"
  
  
  
     ;;Starts a new if sequence for buying algorithm
  
  
    ;; inizio IFELSE RANDOM APPLE
    
    let firstrandom random-float  1.0
    ifelse firstrandom < 0.02[;random

      let secondrandom random-float  2.0
      ifelse secondrandom < 1 [ 
    set randomapplen? true
    set buyapple? true
    set buysamsung? false
    ] [          
        ;;inizio IFELSE RANDOM SAMSUNG
        set randomsamsungn? true
        set buysamsung? true
        set buyapple? false      
      ]]
    
    [               
        ;;inizio NEIGHBORS 
        ifelse any? link-neighbors [
          ifelse any? link-neighbors with [ buyapple? = true or buysamsung? = true][
        let valoreapple 5  - popularityapple
        let valoresamsung 5 - popularitysamsung
        let apple count link-neighbors with [ buyapple? = true ] / count link-neighbors
        let samsung count link-neighbors with [ buysamsung? = true ] / count link-neighbors
        
           ifelse apple > samsung [
           let probabilitaa apple * 0.5
           let randomnuma random-float valoreapple
               ifelse randomnuma < probabilitaa [
                 set friendapplen? true
               set buyapple? true
               set buysamsung? false
               ]
               [
                 let probabilitas samsung * 0.5
                 let randomnums random-float valoresamsung
                 if randomnums < probabilitas[
                 set friendsamsungbutapplen? true
                 set buysamsung? true
                 set buyapple? false
                 ]
                 
                 ]
               ]
               
               [ ifelse samsung > apple [
                   let probabilitas samsung * 0.5
                   let randomnums random-float valoresamsung
                   ifelse randomnums < probabilitas[
                   set friendsamsungn? true
                   set buysamsung? true
                   set buyapple? false
                   ]
                   [
                     let probabilitaa apple * 0.5
                     let randomnuma random-float valoreapple
                     if randomnuma < probabilitaa[
                     set friendapplebutsamsungn? true
                     set buyapple? true
                     set buysamsung? false
                     ]
                     ]
                   ][;;quando è uguale
                   if samsung = apple[
                     let randomdraw random-float 1.0
                     ifelse randomdraw < 0.5 [;;randomdraw < 0.5
                       let probabilitas samsung * 0.5
                       let randomnums random-float valoresamsung
                       ifelse randomnums < probabilitas[;;ifelse random samsung < probabilita samsung
                         set drawsamsungn? true
                         set buysamsung? true
                         set buyapple? false
                         ][
                         let probabilitaa apple * 0.5
                         let randomnuma random-float valoreapple
                         if randomnuma < probabilitaa[
                          set drawapplebutsamsungn? true
                          set buyapple? true
                          set buysamsung? false
                         ]
                         ]
                       ]
                     [;; randomdraw > 0.5
                       let probabilitaa apple * 0.5
                       let randomnuma random-float valoreapple
                       ifelse randomnuma < probabilitaa[;;ifelse random samsung < probabilita samsung
                         set drawapplen? true
                         set buyapple? true
                         set buysamsung? false
                         ][
                         let probabilitas samsung * 0.5
                         let randomnums random-float valoresamsung
                         if randomnums < probabilitas[
                          set drawsamsungbutapplen? true
                          set buysamsung? true
                          set buyapple? false
                         ]
                         ]
                       
                       ]
                     
                   ]
                   ]
             
        ]
          ][
           ]
  
        ]
        [ 
              ]
    
      ]  
end 

;;
;; utility procedures
;;

to update-color
  if buyapple? [ set color white ]
  if buysamsung? [ set color blue ]
  if not buyapple? and not buysamsung? [set color yellow]
end 

to layout
  layout-spring people links 0.1 0.1 1
  display
end 

to highlight
  ifelse mouse-inside?
    [ do-highlight ]
    [ undo-highlight ]
  display
end 

;; remove any previous highlights

to undo-highlight
  clear-output
  ask people [ update-color ]
  ask links [ set color white - 3 ]
end 

to do-highlight
  let highlight-color red
  let min-d min [distancexy mouse-xcor mouse-ycor] of people
  ;; get the node closest to the mouse
  let the-node one-of people with 
  [any? link-neighbors and distancexy mouse-xcor mouse-ycor = min-d]
  ;; get the node that was previously the highlight-color
  let highlighted-node one-of people with [color = highlight-color]
  if the-node != nobody and the-node != highlighted-node 
  [ ;; highlight the chosen node
    ask the-node 
    [ undo-highlight
      set color highlight-color
      ask my-links [ set color cyan - 1 ]
      ask link-neighbors [ set color red + 1 ]
    ]
  ]
end 



; Copyright 2015 Fabio Monteneri
; See Info tab for full copyright and license.

There is only one version of this model, created about 10 years ago by Fabio Monteneri.

Attached files

File Type Description Last updated
Products into the Market.png preview Preview for 'Products into the Market' about 10 years ago, by Fabio Monteneri Download

This model does not have any ancestors.

This model does not have any descendants.