BiddingmarketASS

BiddingmarketASS preview image

8 collaborators

Default-person csai Student (Author)
Default-person Qiuhua Wu (Editor)
Default-person Ada Bilici (Author)
Default-person Yasar Dipcin (Author)
Default-person Selim Can Mutlu (Author)
Default-person Musa Binzat (Author)
Default-person Yasar Dipcin (Author)
Default-person Qiuhua Wu (Author)

Tags

(This model has yet to be categorized with any tags)
Parent of 1 model: Bandwagon
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.4.0 • Viewed 51 times • Downloaded 3 times • Run 0 times
Download the 'BiddingmarketASS' 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 demonstrates a very simple bidding market, where buyers and sellers try to get the best price for goods in a competitive setting.

HOW IT WORKS

The agents in the inner ring of represent sellers, who bring some goods they want to sell to the market. The agents in the outer ring are the buyers, who bring money to the market to buy the goods.

Each round (tick), the buyers move to their right (counter-clockwise) and are paired with a seller. Then each buyer checks its paired seller's asking price. If it's lower than their asking-price, they'll buy 1 item. If it's higher, they'll buy nothing. Then each seller individually decides to either raise prices or lower prices based on their buyer's behavior. The buyers also individually lower or raise their expectations based on their seller's behavior.

The market will run through rounds until no buyer who wants to buy an item has money left to spend, or until all items are bought.

PURCHASE DISPLAY

If a purchase is made, the link from seller to buyer turns yellow and a little star animation will start. Otherwise, the link will be blue with no animation. If the transactions still take place too quickly to be noticed, the speed slider can slow the model down a bit.

As buyers get what they want, they get bigger and fill their maximum-buy-sized gray shadow. If they fully satisfy their demand, they'll turn dark grey.

Sellers start with a size based on how many items they brought to the market. As they sell items, they get smaller. If they sell all their items, they'll turn dark grey.

HOW TO USE IT

Press SETUP to generate a market, then the GO-ONCE button to run a single round, or the GO button to run the market until it completes.

  • Initial supply and demand can be High or Low, and distributed can be even among all buyers and sellers or concentrated among a few.
  • Behavior is set when SETUP is run and can be set to one of a few options (the description given is for buyers, but mirrored for sellers):
    • Normal - buyers will increase their willing to pay by a small amount if they are unable to make a purchase, otherwise they'll lower their willing-to-pay if they do manage to buy an item.
    • Desperate - increases the amount buyers will increase thier willing-to-pay when they fail to make a purchase.
    • Random - the behavior of each buyer will be random - some will be very desperate, others might decrease the amount they're willing-to-pay when they fail to make a purchase.
    • Mix of all - each buyer will be set to one of the three above behaviors randomly.
  • You can also toggle whether sellers will consider full buyers or not. A full buyer is one who has already satisfied their demand. This would simulate the sellers being able to tell who is walking past their market stall without even looking at the items' prices.

THINGS TO NOTICE

Try slowing the tick speed down and watching a single buyer on the outside ring as it moves. See how it gets bigger when it makes a purchase and its link turns yellow, and how big it is when it turns completely dark grey (if it does).

Run the model multiple times with the same settings to get an idea of what's happening to the asking and buying prices over time.

THINGS TO TRY

Play around with the different setup options to try the following:

  • Can you get to 100% of both items sold and demand satisfied? If not, how close can you get?
  • What's the longest you can get a market to run for (in number of ticks)?
  • What's the highest average price you can get at the end of a round?
  • Sometimes the market stops when there are buyers on the outside ring who still want to purchase things (% Demand Satisfied is not 100%) and there is still money available to spend (% Money Taken is not 100%). How this can be?

EXTENDING THE MODEL

It's fairly easy to add new behaviors to buyers and sellers, just adjust the chooser box with a new option, then add it in the appropriate create-ordered-sellers or create-ordered-buyers block in the setup procedure.

NETLOGO FEATURES

In order to try to keep the Asking Price and Buying Price plots displaying relevant information, we set the plot-y-range manually using an update command based on the most recent average price.

Behaviors for buyers and sellers are set during setup, and we use anonymous procedures stored in turtles-own variables. This allows us to very easily execute different behavior while the market is running by just using the run keyword with those behavior variables.

RELATED MODELS

See the Simple Economy model or Sugarscape models to explore other economic concepts.

HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

COPYRIGHT AND LICENSE

Copyright 2017 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

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

Click to Run Model

globals [
  ; Setup variables
  min-price
  population
  sales-per-tick
  starting-asking-price
  starting-willing-to-pay
  amount-high
  amount-low

  ; Tracking variables
  avg-per-buyer
  avg-per-seller
  total-sales
  remaining-supply
  starting-money-actual
]

breed [ shadows shadow ]
breed [ sellers seller ]
breed [ buyers buyer ]
breed [ pops pop ]

turtles-own [
  money
  next-xcor
  next-ycor
  percent
  my-shadow
]

sellers-own [
  items-for-sale
  asking-price
  starting-supply
  behavior-after-sale
  behavior-no-sale
  sold
]

buyers-own [
  want-to-buy
  willing-to-pay
  starting-demand
  behavior-after-purchase
  behavior-no-purchase
  bought
  anchor-price       ; Added for anchoring bias
]

to setup
  clear-all

  ; Set global variables
  set min-price 0.01
  set population 50
  set total-sales 0
  set starting-asking-price 100
  set starting-willing-to-pay 10
  set amount-high 50
  set amount-low 25

  ; Create sellers
  create-ordered-sellers population [
    forward 8
    set my-shadow nobody
    set money 0
    set items-for-sale get-random-amount supply-distribution supply-amount
    set starting-supply items-for-sale
    set asking-price get-starting-value starting-asking-price

    let mix-behavior ifelse-value seller-behavior = "mix of all" [random 3] [-1]
    ifelse seller-behavior = "normal" or mix-behavior = 0 [
      set behavior-after-sale [         -> change-price 2.5 ]
      set behavior-no-sale    [ hide? -> if (not hide?) [ change-price -2.0 ] ]
    ] [
      ifelse seller-behavior = "desperate" or mix-behavior = 1 [
        set behavior-after-sale [         -> change-price 0.7 ]
        set behavior-no-sale    [ hide? -> if (not hide?) [ change-price -5.0 ] ]
      ] [
        ; "random" or mix-behavior = 2
        set behavior-after-sale [     -> change-price (random 11 - 5)]
        set behavior-no-sale    [     -> change-price (random 11 - 5)]
      ]
    ]
  ]

  ; Create buyers
  create-ordered-buyers population [
    forward 13
    facexy 0 0
    set my-shadow nobody
    set want-to-buy get-random-amount demand-distribution demand-amount
    set starting-demand want-to-buy
    set money get-starting-value starting-money
    set willing-to-pay get-starting-value starting-willing-to-pay
    set anchor-price 0  ; Initialize anchor-price for anchoring bias

    let mix-behavior ifelse-value buyer-behavior = "mix of all" [random 3] [-1]

    ifelse buyer-behavior = "anchoring bias" [
      set behavior-after-purchase [-> ]  ; No change after purchase
      set behavior-no-purchase    [-> ]  ; No change after no purchase
    ] [
      ifelse buyer-behavior = "normal" or mix-behavior = 0 [
        set behavior-after-purchase [-> change-payment -2.0 ]
        set behavior-no-purchase    [-> change-payment  2.5 ]
      ] [
        ifelse buyer-behavior = "desperate" or mix-behavior = 1 [
          set behavior-after-purchase [-> change-payment -0.5 ]
          set behavior-no-purchase    [-> change-payment  7.5 ]
        ] [
          ; "random" or mix-behavior = 2
          set behavior-after-purchase [-> change-payment (random 11 - 5)]
          set behavior-no-purchase    [-> change-payment (random 11 - 5)]
        ]
      ]
    ]
  ]

  ; Create shadows for turtles
  create-ordered-shadows population [
    set color 2
    ask one-of sellers with [my-shadow = nobody] [ set my-shadow myself ]
  ]
  create-ordered-shadows population [
    set color 2
    ask one-of buyers with [my-shadow = nobody] [ set my-shadow myself ]
  ]

  ; Update tracking variables
  set avg-per-buyer (sum [starting-demand] of buyers) / (count buyers)
  set avg-per-seller (sum [starting-supply] of sellers) / (count sellers)

  ask sellers [
    update-seller-display
    let shadow-size 1 + (items-for-sale / avg-per-seller)
    ask my-shadow [
      move-to myself
      set heading [heading] of myself
      set size shadow-size
    ]
  ]

  ask buyers [
    update-buyer-display
  ]

  set starting-money-actual sum [money] of buyers

  reset-ticks
end 

to-report get-random-amount [ dist amount ]
  report ifelse-value dist = "even" [
    1 + random (get-amount amount)
  ] [ ; "concentrated"
    1 + floor random-exponential ((get-amount amount) / 2)
  ]
end 

to-report get-amount [ amount ]
  report ifelse-value amount = "high" [
    amount-high
  ] [ ; else "low"
    amount-low
  ]
end 

to-report get-starting-value [ starting-value ]
  report precision ((starting-value / 2) + random (starting-value / 2)) 2
end 

to go
  if (sum [items-for-sale] of sellers = 0 or (0 = count buyers with [money > 0 and want-to-buy > 0])) [ stop ]

  clear-drawing
  set sales-per-tick 0

  ; Move buyers to next position
  ask buyers [
    let next ifelse-value who = (1 * population) [(2 * population) - 1] [who - 1]
    set next-xcor [xcor] of buyer next
    set next-ycor [ycor] of buyer next
  ]
  ask buyers [
    set xcor next-xcor
    set ycor next-ycor
    facexy 0 0
  ]

  set remaining-supply (sum [items-for-sale] of sellers)

  let offset 1 + ticks mod population
  foreach (range 0 population) [ i ->
    let the-seller seller (population * 0 + i)
    let the-buyer buyer (population * 1 + ((i + offset) mod population))
    ask the-buyer [ do-commerce-with the-seller ]
  ]

  ask buyers [update-buyer-display]
  ask sellers [update-seller-display]
  set total-sales (total-sales + sales-per-tick)

  ask pops [
    ifelse (size < 0.1 or not stars?)
    [ die ]
    [
      set heading (atan (random-float 0.5 - 0.25) 1)
      jump 0.5
      set size size - 0.025
      set color color - 0.25
    ]
  ]

  ; **Enforce willing-to-pay ≤ money for all buyers**
  ask buyers [
    if willing-to-pay > money [ set willing-to-pay money ]
  ]

  ; Sanity check
  if (any? buyers with [want-to-buy > 0 and willing-to-pay > money]) [
    error "Cannot have turtles that want to pay more than their cash!"
  ]

  tick
end 

to update-buyer-display
  if want-to-buy = 0 [
    set color 2
  ]
  set size 1 + (bought / avg-per-buyer)
  let shadow-size 1 + (want-to-buy / avg-per-buyer)
  ask my-shadow [
    move-to myself
    set heading [heading] of myself
    set size shadow-size
  ]
end 

to update-seller-display
  if items-for-sale = 0 [ set color 2 ]
  set size 1 + (items-for-sale / avg-per-seller)
end 

to do-commerce-with [ the-seller ]
  ; Anchoring bias logic
  if buyer-behavior = "anchoring bias" [
    if anchor-price = 0 [
      set anchor-price [asking-price] of the-seller
    ]
    ; Adjust willingness to pay based on the anchor price
    let adjustment (anchor-price - willing-to-pay) * 0.1  ; Fixed anchoring effect of 0.1
    set willing-to-pay willing-to-pay + adjustment
    ; Ensure willing-to-pay does not exceed money or go below min-price
    if willing-to-pay > money [ set willing-to-pay money ]
    if willing-to-pay < min-price [ set willing-to-pay min-price ]
  ]

  ; Proceed with existing transaction logic
  let asking [asking-price] of the-seller
  ifelse ([items-for-sale] of the-seller > 0 and want-to-buy > 0 and asking <= money and asking <= willing-to-pay) [
    create-link the-seller self yellow

    set sales-per-tick (sales-per-tick + 1)
    set want-to-buy (want-to-buy - 1)
    let price asking
    set money precision (money - price) 2
    set money ifelse-value money < min-price [0] [money]
    set bought (bought + 1)
    ask the-seller [
      set items-for-sale (items-for-sale - 1)
      set money precision (money + price) 2
      set sold (sold + 1)
      run behavior-after-sale
    ]
    run behavior-after-purchase
    create-star

    ; **Adjust willing-to-pay after purchase**
    if willing-to-pay > money [ set willing-to-pay money ]
  ] [
    ; No purchase made
    create-link the-seller self blue
    let hide? (sellers-ignore-full-buyers? and (want-to-buy = 0))
    ask the-seller [ (run behavior-no-sale hide?) ]
    run behavior-no-purchase
  ]

  ; Anchoring effect decay (if applicable)
  ; Since anchoring decay is not implemented in this version, this section is omitted
end 

to create-star
  if stars? [
    hatch-pops 1 [
      set color yellow
      set shape "star"
      set size 0.5
      set label ""
    ]
  ]
end 

to create-link [ some-seller some-buyer some-color ]
  ask some-seller [
    let oc color
    let x xcor
    let y ycor
    set color some-color
    set pen-size 3
    pen-down
    move-to some-buyer
    pen-up
    setxy x y
    set color oc
  ]
end 

to change-price [ change ]
  let before asking-price
  set percent 1 + (change / 100)
  set asking-price check-for-min-price (precision (percent * asking-price) 2)
  if before = asking-price [
    if change < 0 and before != min-price [
      set asking-price precision (asking-price - min-price) 2
    ]
    if change > 0 [
      set asking-price precision (asking-price + min-price) 2
    ]
  ]
end 

to change-payment [ change ]
  let before willing-to-pay
  set percent 1 + (change / 100)
  set willing-to-pay check-for-min-price (precision (percent * willing-to-pay) 2)
  if before = willing-to-pay [
    if change < 0 and before != min-price [
      set willing-to-pay precision (willing-to-pay - min-price) 2
    ]
    if change > 0 [
      set willing-to-pay precision (willing-to-pay + min-price) 2
    ]
  ]
  ; Ensure willing-to-pay does not exceed money
  if willing-to-pay > money [ set willing-to-pay money ]
end 

to-report seller-cash
  report sum [money] of sellers
end 

to-report average-price
  report (ifelse-value total-sales = 0 [ 0.00 ] [ precision (seller-cash / total-sales) 2 ])
end 

to-report percent-money-taken
  report 100 * sum [money] of sellers / starting-money-actual
end 

to-report percent-items-sold
  report 100 * sum [sold] of sellers / sum [items-for-sale + sold] of sellers
end 

to-report percent-demand-satisfied
  report 100 * sum [bought] of buyers / sum [want-to-buy + bought] of buyers
end 

to-report check-for-min-price [ value ]
  report precision ifelse-value value < min-price [min-price] [value] 2
end 

; Copyright 2017 Uri Wilensky.
; See Info tab for full copyright and license.

There are 8 versions of this model.

Uploaded by When Description Download
Selim Can Mutlu 15 days ago bias added to drop-down menu Download this version
Qiuhua Wu 16 days ago Reverted to older version Download this version
Yasar Dipcin 16 days ago test 2 because cant open Download this version
Qiuhua Wu 22 days ago um Download this version
Yasar Dipcin 23 days ago Added code to separate the biases in groups, added sunk cost fallacy. To do: add sliders and check errors Download this version
Selim Can Mutlu 24 days ago slider regarding anchoring bias decrease over time added, todo: implement a second slider for "initial anchoring effect" asap. Download this version
Yasar Dipcin 29 days ago test (the file is exactly the same) Download this version
csai Student 29 days ago Initial upload Download this version

Attached files

File Type Description Last updated
Bidding Market2.nlogo extension Bandwagon 22 days ago, by Qiuhua Wu Download
BiddingmarketASS.png preview Preview for 'BiddingmarketASS' 29 days ago, by csai Student Download

This model does not have any ancestors.

Children:

Graph of models related to 'BiddingmarketASS'