Supply and Demand - price setting WIP

Supply and Demand - price setting WIP preview image

1 collaborator

Default-person Per Hung Yap (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.0 • Viewed 116 times • Downloaded 4 times • Run 0 times
Download the 'Supply and Demand - price setting WIP' 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

Globals [price last_price producer-surplus consumer-surplus total-surplus]
Breed [Buyers Buyer]
Breed [Sellers Seller]
Buyers-own [Maximum_asking_price willingtopay consumersurplus B_stock Demand able_buy B_price last_B_Price calorie]
Sellers-own [Minimum_selling_price willingtosell producersurplus S_stock Inventory_space able_sell S_price last_S_price revenue]
turtles-own [partner]

to setup
  clear-all
  create-Buyers NoBuyers[
    setxy random-xcor random-ycor
  ]
  create-Sellers NoSellers[
    setxy random-xcor random-ycor
  ]
  ask Buyers [
    set color yellow
    set Maximum_asking_price Maximum_ask - random var_ask
    set B_stock 0
    set last_B_price Maximum_asking_price
    set B_price last_B_price
    set calorie 100
  ]
  ask Sellers [
    set color blue
    set Minimum_selling_price Minimum_sell + random var_sell
    set S_stock 0
    set last_S_price Minimum_selling_price
    set S_price last_S_price
    set revenue 100
  ]
  reset-ticks
end 

to go
    update-plots
  produce_good_and_income
  set_price
  seek_seller
  ask Sellers with [color = red][
    set color blue]
  ask Sellers [
    if revenue <= 0 [die]]
  ask Buyers [
    if calorie <= 0 [die]
]
  tick
end 

to produce_good_and_income
  ask Sellers [
    set Inventory_space Invent_space
    if S_stock < Inventory_space [
    set S_stock S_stock + No_good_produced
      if S_stock >= Inventory_space [
        set S_stock Inventory_space
  ]]]
  ask Buyers [
    set Demand Demand + Daily_demand
  ]
end 

to set_price
  ask Sellers [
  ifelse able_sell = 0
  [
      set revenue revenue - revenue_reducer
      set S_price last_S_price - random-float adjustment
        if S_price < Minimum_selling_price[
          set S_price Minimum_selling_price]]
   [let prob random 6
      if prob = 1 [
        set S_price last_S_price + random adjustment]]
    set able_sell 0
  ]
  ask Buyers [
  ifelse able_buy = 0 ; variable, when able to buy, + 1, will be wiped away
  [
      set calorie calorie - calorie_reducer
      set B_price last_B_price + random-float adjustment
   if B_price > Maximum_asking_price [
       set B_price Maximum_asking_price
]]
    [let prob random 6
      if prob = 1 [
        set B_price last_B_price - random adjustment]]
  set able_buy 0
  ]
   ; reset the values
end 

to seek_seller
  ask buyers [
    let available_sellers Sellers with [color = blue]
    let whom one-of available_sellers
    if whom = nobody [stop]
    ask whom [set color red]
    let seller_price [S_price] of whom
    if (B_price - seller_price >= 0) [
      let common_price (B_price + [S_price] of whom) / 2
      set consumersurplus (Maximum_asking_price - common_price)
      set last_B_price common_price
      set calorie calorie + 1
      set able_buy able_buy + 1
      ask whom [
        set last_S_price common_price
        set able_sell able_sell + 1
        set revenue revenue + 1
        set producersurplus (common_price - Minimum_selling_price)
       ]
    ]
  ]
end 






There is only one version of this model, created over 2 years ago by Per Hung Yap .

Attached files

File Type Description Last updated
Supply and Demand - price setting WIP.png preview Preview for 'Supply and Demand - price setting WIP' over 2 years ago, by Per Hung Yap Download

This model does not have any ancestors.

This model does not have any descendants.