Final_Project_Addiction

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Parent of 1 model: Metric_update
Model group MAM-2016 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0-M5 • Viewed 406 times • Downloaded 52 times • Run 0 times
Download the 'Final_Project_Addiction' 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 model is attempting to understand and compare the effects of drug usage in a world where drugs are legalized and purchased in stores and a world where drugs are illegal and purchased on the street. This is a popular debate amongst policy officials, with people providing data that states drug usage increases when drugs are legalized and data that states drug usage decreases when drugs are legalized.

HOW IT WORKS

Both Worlds At each tick, a person will attempt to choose the activity that maximizes his/her utility choosing between: working, eating, doing a drug, and creating new friendships. Working increases money but decreases happiness, eating decreases money but increases happiness, making friends with people who like the same things you do increase happiness, and doing drugs increase happiness, but decrease money factoring the level of tolerance that the individual exhibits towards the drug.

Each person is assigned a random amount of money, a random amount of happiness, and a random risk level. At the beginning of the world, no one has done drugs yet. Preferential attachment was used to create a social network between the turtles with weights on the links to symbolize how strong the friendship is.

Legal World In the legal world, drugs are purchased from a store. In this model we are assuming that the world symbolizes a neighborhood with one drug store that is equally accessible to the entire population. Because they are so accessible, the metric that makes a person try a drug or not is based on whether or not he/she has friends who are willing (have a high enough risk tendency and can also afford it) to go into the store and purchase it with them. If they do have willing friends then they gain access to the store. As time goes on and the person attempts drugs multiple times, the need to have friends to participate in purchasing drugs decreases.

Illegal World In the illegal world, drugs are purchased from dealers on the street. In this world, initial access to the drugs are gotten through either a direct connection between a person and a dealer, or through a person who has a friend who knows a dealer. If the number of links between a person and a dealer exceeded 3, the person did not have access to drugs.

HOW TO USE IT

The model is pretty simple to use, you just use the sliders to set up initial parameters, press setup to initialize the world and then press go to see what happens. If you want to see the illegal world then make sure that switch is turned on!

The energy of job slider is how much energy a job takes from a person in the work function as well as how much money it will gain.

The cost of food is the cost of food.

The cost of drugs is the cost of drugs.

The drug-potency is how potent or addictive the drug you want to sell will be.

THINGS TO NOTICE

Watch how the number of dealers changes the outputs. Watch how the overall happiness levels change in both worlds. Watch how the social network changes as relationships become more colorful (less strong).

THINGS TO TRY

Suggested things to try is set up the parameters to be similar to your own hometown or a country you are interested in in order to see what the differences in drug use are

EXTENDING THE MODEL

Add a way to implement income class.

CREDITS AND REFERENCES

Thank you to EECS 372 for allowing me the ability to create this model

Comments and Questions

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

Click to Run Model

extensions [nw]

breed [people person]
breed [dealers dealer]

undirected-link-breed [ friendships friendship ]
undirected-link-breed [ customers customer ]

globals [answer drugs-done-total times-eaten-total work-done-total make-friends-total first-time]
people-own [money dopamine-level times-done times-eaten times-worked times-friend days-since-drug num-friends risk-behavior last-action]
links-own [weight]

;; called upon setup

to setup
  ca
  reset-ticks
  set drugs-done-total 0 ;; total amount of times the population decided to do drugs
  set times-eaten-total 0 ;; total amount of times the population decided to eat
  set work-done-total 0 ;; total amount of times the population decided to do work
  set make-friends-total 0 ;; total amount of times the population decided to make a new friend
  create-network ;; creates the social network
  set first-time true
end 

;;uses preferential attachment to create a social network amongst the turtles

to create-network
   nw:generate-preferential-attachment turtles friendships num-people [
     ifelse illegal-world? [
       ifelse random 100 > 5 [make-normal-person] [make-dealer]] ;; 5 dealers for every 100 people
     [make-normal-person] ;; no dealers in this world
     setxy random-xcor random-ycor
     set shape "person"
   ]
end 

;; function to create a dealer turtle

to make-dealer
  set breed dealers
  set color white
  let goahead true
  ask link-neighbors [
    if customer-neighbor? myself [set goahead false]]
  if goahead [ask my-links [ set color green set breed customers set thickness .3 ]]
end 

;; function to create a normal person

to make-normal-person
  set breed people
  set color sky
  set money random 100 ;; they all start with a random amount of money
  set dopamine-level random 100 ;; they all start with a random amount of happiness
  set times-done 0 ;; no one has tried drugs before
  set risk-behavior random 100 ;; the personality is all random, some people are more risk prone
  set days-since-drug 0
  set times-worked 0 ;; they all have never worked before
  set times-eaten 0 ;; they all have never eaten before
  set times-friend 0 ;; they all have never made a friend before
  set last-action nobody ;; they have never done any action before
  ask my-links [
    ifelse [breed] of other-end = dealers [set color green] ;; to differentiate between dealer links and friendship
      [set weight (random 5) + 1 ;; will be numbers 1 - 5, 1 being the lowest form of friendship, 5 being best friends
        set color 14.9 + weight ;; a visual representation of the friendships, the more red they are the less strong
      ]
    set thickness .3
  ]
end 

to go
  ask people [
    let action utility ;; function that picks the option that provides the most utility
    show action
    if action = "work" [work set work-done-total work-done-total + 1]
    if action = "drugs" [do-drugs set drugs-done-total drugs-done-total + 1]
    if action = "eat" [eat set times-eaten-total times-eaten-total + 1]
    if action = "make friend" [make-new-friend set make-friends-total make-friends-total + 1]
    if action != "make friend" [set last-action action]
    if first-time = false [friendships-link-change]
  ]
  if first-time = true [set first-time false]
  show "end of tick"
  tick
end 

;; function that calculates which action will give the person the most utility and returns the answer

to-report utility
  let t_work work-change
  let t_drug drug-change
  let t_eat eat-change
  let t_friend make-new-friend-change
  if t_work > t_drug and t_work > t_eat and t_work > t_friend [ set answer "work" ] ;; work gives the most utility
  if t_drug > t_work and t_drug > t_eat and t_drug > t_friend [ set answer "drugs" ] ;; drugs gives the most utility
  if t_eat > t_drug and t_eat > t_work and t_eat > t_friend [ set answer "eat" ] ;; eating gives the most utility
  if t_friend > t_drug and t_friend > t_eat and t_friend > t_work [set answer "make friend" ] ;; making a new friend gives the most utility
  report answer
end 

;; function that calculates how much utility a person will get from working

to-report work-change
  let temp-dopamine dopamine-level - energy-of-job ;; your job takes away a certain amount of energy/happiness
  let temp-money money + energy-of-job ;; you get money depending on how much energy your job takes
  report temp-dopamine + temp-money ;; return the decreased dopamine and the increased money added together
end 

;; function to actually cause the person to work and gain/lose the benefits

to work
  set dopamine-level dopamine-level - energy-of-job
  set money money + energy-of-job
  set days-since-drug days-since-drug + 1
  set times-worked times-worked + 1
end 

;; function that calculates how much utility a person will get from eating

to-report eat-change
  let temp-dopamine dopamine-level + energy-from-food ;; eating gives you energy
  let temp-money money - cost-of-food ;; eating takes away money
  ;; if eating does not put you into debt, report the change, if it does return 0
  ifelse temp-money > 0 [report temp-dopamine + temp-money] [report 0]
end 

;; function to actually cause the person to eat and gain/lose the benefits

to eat
  set dopamine-level dopamine-level + energy-from-food
  set money money - cost-of-food
  set days-since-drug days-since-drug + 1
  set times-eaten times-eaten + 1
end 

;; function that calculates how much utility a person will get from doing drugs

to-report drug-change
  let ease ease-of-finding
  if ease = 0 [report 0] ;; if the person is not close enough to drugs, he/she will not do it
  let temp-times-done 0
  ;; rehab mechanism, if a person abstains enough then his/her tolerance will decrease
  ifelse days-since-drug > 20 [set temp-times-done 1][set temp-times-done times-done + 1]
  let temp-dopamine dopamine-level + drug-potency ;; the more potent the drug, the more it will increase happiness
  let tolerance 1
  let amount 100 - drug-potency
  ;; the more potent the drug the quicker your tolerance builds, the less potent the more time it takes to build
  if temp-times-done > amount [set tolerance tolerance + 1]
  if temp-times-done > amount * 2 [set tolerance tolerance + 2]
  if temp-times-done > amount * 4 [set tolerance tolerance + 3]
  let temp-money money - (cost-of-drug * tolerance) ;; the drug will get more expensive the more you do it because you build a tolerance
  let total temp-dopamine + temp-money + ease-of-finding
  ifelse random 100 < risk-behavior [ ;; uses probability to calculate whether a person will do the drug
    ifelse temp-money > 0 [report total] ; could afford to do the drug
    [ifelse temp-times-done > amount [report total] ;; the person can't afford it but will do it anyway
      [report 0 ]]] ;; can't afford it and aren't addicted enough to do it anyway
  [report 0]
end 

;; function to show how easy it is currently to find drugs
;; different for if it they are legal or illegal

to-report ease-of-finding
  let ease 0
  ifelse illegal-world? [
    ;; a turtle will calculate if they have a connection with a dealer either through
    ;; a direct connection or a friend
    if any? (nw:turtles-in-radius 1) with [breed = dealers and who != [who] of myself ] [set ease 30] ;; the person is connected to the dealer
    if any? (nw:turtles-in-radius 2) with [breed = dealers and who != [who] of myself] [set ease 20] ;; the person is two links away from the dealer
    if any? (nw:turtles-in-radius 3) with [breed = dealers and who != [who] of myself] [set ease 10] ;; the person is three links away from the dealer
  ]
  [
    ;; a turtle will calculate if it has any friends that it could do a drug with
    let amount 100 - drug-potency
    ifelse times-done <= amount [ ;; they are not addicted yet and still need friends to purchase the drug
      if my-links != nobody [
        ask my-links [
          let friend other-end
          ;; find friends and see if they will purchase a drug with you
          ask friend [
            if money > cost-of-drug [ ;; the friend can afford it
              if random 100 < risk-behavior [set ease 20]]]]]] ;; the friend is adventureous enough
    [ set ease 30 ]
  ]
  report ease
end 

;; function to actually cause the person to do drugs and gain/lose the benefits

to do-drugs
  ifelse days-since-drug > 20 [ set times-done 1 ] [ set times-done times-done + 1 ]
  let tolerance 1
  let amount 100 - drug-potency
  if times-done > amount [set tolerance tolerance + 1]
  if times-done > amount * 2 [set tolerance tolerance + 2]
  if times-done > amount * 3 [set tolerance tolerance + 3]
  set money money - (cost-of-drug * tolerance)
  set dopamine-level dopamine-level + drug-potency
  set days-since-drug 0
  set times-done times-done + 1
end 

;; function that calculates how much utility a person will get from making a new friend

to-report make-new-friend-change
  ;; current turtle has no friends, making a new friend will increase it's dopamine
  ;; by a lot and they are not picky about the new friends they make
  ifelse any? friendship-neighbors = false [
    if any? people in-radius 5 with [who != [who] of myself] != false [report dopamine-level + 100]
  ]
  [
    if any? people in-radius 5 with [who != [who] of myself] != false [
      let possible-friends people in-radius 5 with [who != [who] of myself]
      let temp-d 0
      let linkthere? false
      ask possible-friends [ ;; grab one of the turtles near the asking turtle
        ask my-links [
          ;; if there is already a link from this possible friend to the original turtle
          if [who] of other-end = [who] of myself [set linkthere? true]]
        ;; found a turtle that is not already connected to original turtle
        if linkthere? = false [
          ;; this turtle did the same last-action as the original turtle
          if last-action = [last-action] of myself [set temp-d dopamine-level + 50 stop]] ;; found a turtle that has the same last action
      ]
      report temp-d
    ]
  ]
  report 0
end 

;; function to actually cause the person to make a new friend and gain/lose the benefits

to make-new-friend
  ifelse any? friendship-neighbors = false [
    if any? people in-radius 5 with [who != [who] of myself] != false [
      ask one-of people in-radius 5 with [who != [who] of myself] [
        create-friendship-with person [who] of myself [set weight 1 set color 15.9 set thickness .3]]
    ]
    set dopamine-level dopamine-level + 100
  ]
  [
    if any? people in-radius 5 with [who != [who] of myself] != false [
      let possible-friends people in-radius 5 with [who != [who] of myself]
      let linkthere? false
      ask possible-friends [
        ask my-links [
          if [who] of other-end = [who] of myself [set linkthere? true]]
        if linkthere? = false [
          if last-action = [last-action] of myself [
            create-friendship-with person [who] of myself [set weight 1 set color 15.9 set thickness .3 stop ]
          ]
        ]
      ]
      set dopamine-level dopamine-level + 50
    ]
  ]
  set days-since-drug days-since-drug + 1
  set times-friend times-friend + 1
end 

;; function to update the social network depending on what the last actions of the turtles are

to friendships-link-change
  ;; grab friend group of turtle
  let friends (nw:turtles-in-radius 1) with [breed = people and who != [who] of myself]
  if friends != nobody [
    ask friends [ ifelse last-action = [last-action] of myself [
      ;; if the current friend did the same last activity as you, increase your friendship
      ask friendship-with turtle ([who] of myself) [ if weight + 1 <= 5 [set weight weight + 1 set color color + 1 ] ] ]
    [ask friendship-with turtle ([who] of myself) [ if weight - 1 >= 0 [set weight weight - 1  set color color - 1] ] ]
    friendship-loss
    ]
  ]
end 

to friendship-loss
  let relation friendship-with turtle [who] of myself ;; grab the link between the current turtle and the current friend
  if [weight] of relation = 0 [
    ;; if the friendship has a weight of less than 0, the friendship is not strong and will end
    ask relation [die]
  ]
end 



There are 3 versions of this model.

Uploaded by When Description Download
Isabella Valdescruz over 9 years ago Final Project implementation Download this version
Isabella Valdescruz over 9 years ago This implemented the two different worlds as well as a more complex buying drug implementation Download this version
Isabella Valdescruz over 9 years ago Initial upload Download this version

Attached files

File Type Description Last updated
372FinalReport.docx word Final Project Report over 9 years ago, by Isabella Valdescruz Download
IsabellaValdescruz_May16.docx word IsabellaValdescruz_May16th over 9 years ago, by Isabella Valdescruz Download
IsabellaValdescruz_May23.docx word IsabellaValdescruz_May23 over 9 years ago, by Isabella Valdescruz Download
IsabellaValdescruz_May9th.docx word IsabellaValdescruz_May9th over 9 years ago, by Isabella Valdescruz Download

This model does not have any ancestors.

Children:

Graph of models related to 'Final_Project_Addiction'