Tian_Peilin_fp_model1

No preview image

1 collaborator

Default-person Peilin Tian (Author)

Tags

(This model has yet to be categorized with any tags)
Model group EECS 372-Spring 2011 | Visible to everyone | Changeable by group members (EECS 372-Spring 2011)
Model was written in NetLogo 4.1.2 • Viewed 143 times • Downloaded 18 times • Run 2 times
Download the 'Tian_Peilin_fp_model1' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

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

Click to Run Model

breed [customer customers]
breed [designer designers]
breed [manufacturer manufacturers]
undirected-link-breed [m-links m-link]
undirected-link-breed [c-links c-link]

to setup
  clear-all
  setup-customer  ;create customer
  setup-designer  ;create desginer
  setup-manufacturer  ;create manufacturer
  setup-network   ;creat network
  update-plot     ;visualize measurement
end 

to setup-customer
  set-default-shape customer "person"
  create-customer number-of-customers
  [
    set xcor random-xcor 
    set ycor (random 15 + 1)
    ifelse random 100 < initial-market-share
      [set color red]                        ;red customer purchase product 1
      [set color green]                      ;green customer purchase product 2
      
   ]
end 

to setup-designer
  set-default-shape designer "circle"
  create-designer 1
  [
      setxy 10 -10
      set color red                     ;product 1
      set size 3
      set label initial-market-share
   ]
  
    create-designer 1
  [
      setxy -10 -10
      set color green                      ;product 2
     set size 3
     set label 100 - initial-market-share
   ]
end 

to setup-manufacturer 
  set-default-shape manufacturer "triangle"
  create-manufacturer number-of-manufacturer
  [
    set xcor random-xcor 
    set ycor (random -15 - 1)

   ]
end 

to setup-network
  
  repeat 300 [
    ask one-of customer
    [ create-c-link-with one-of other customer]  ;; if link already exists, nothing happens
  while [count c-links > number-of-links]
    [ ask one-of c-links [ die ] ]
  ]
  
  ask manufacturer
  [ifelse random 100 > (count customer with [color = green]) / number-of-customers * 100 [create-m-links-with designer with [color = red]  ]
      [create-m-links-with designer with [color = green]
      ]]
end 

to update-plot
  
  set-current-plot "market share"
  set-current-plot-pen "green"
  plot (count customer with [color = green]) / number-of-customers * 100
  set-current-plot-pen "red"
  plot (count customer with [color = red]) / number-of-customers * 100
end 

to go
  
  update-customers
  update-designer
  update-manufacturer
  tick
  update-plot
end 

to update-customers
  
  ask customer
    [ if color = red and random 100 < willing-to-change-purchase and count my-links != 0 [
      if (count link-neighbors with [color = red]) / count my-links < similarity [set color green]
      ]
    ;if percentage of similar neighbors drops down the similarity, customer will feel uncomfortable
    ;and may change their purchase behavior
      if color = green and random 100 < willing-to-change-purchase and count my-links != 0 [
      if (count link-neighbors with [color = green]) / count my-links < similarity [set color red]
      ]
     ] 
end 

to update-designer
  ask designer with [color = green]
  [set label (count customer with [color = green]) / number-of-customers * 100]
  ask designer with [color = red]
  [set label (count customer with [color = red]) / number-of-customers * 100]
end 

to update-manufacturer
  ask m-links [die]
  ask manufacturer
  [ 
    ifelse random 100 > (count customer with [color = green]) / number-of-customers * 100 [create-m-links-with designer with [color = red] ]
      [create-m-links-with designer with [color = green]
      ]]
end 

There is only one version of this model, created about 14 years ago by Peilin Tian.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.