powered by NetLogo
view/download model file: C2C_online_shopping.nlogo
Agent based model for C2C online shopping platform (i.e. ebay) is a multi-agent based simulation model, where new purchases are made through simulation of buyers� and sellers� behavior. On the online shopping sites like ebay.com, individuals sell products to individuals. This market is free and easy to enter. On the other hand, building a successful business in such circumstances is harsh because the competition is fierce.
Two separate models are established, one in NetLogo (called version 1), where there are many existing sellers and new sellers enter the market at the beginning of each sale day; the other in HubNet (called version 2), where no sellers exist in the market at the beginning and students participate in the market as new sellers.
In this model, we assume that buyer makes rational decision in purchasing products. In the C2C online shopping case, the utility function of the buyer i choosing seller j can be calculated as follows:
U_ij = A_i * price_j + B_i * feedback_rating_j + C_i * shipping_j
The coefficients in the utility function, A, B, C are not common parameters over all buyers. Instead, they vary across buyers, because some buyers care more about price, while some buyers care more about the seller�s feedback ratings. We assume that A, B and C follow normal distribution within predefined mean and variance.
In terms of the sellers, each of them can set their selling price differently. Assume that all the sellers have the same cost. In version 1, profit can be determined by seller and adjusted at the beginning of each day. From time to time, newcomers enter the market to start their business. The competition is fierce since there are many existing sellers in the market. Newcomers can lower their price to attract more buyers. After 100 days, if they do not make progress, they�ll close their business and leave the market. After a few months (maybe few years) the market will reach equilibrium. The composition of sellers (big sellers, medium sellers, and small sellers according to their feedback ratings) can be plotted. In version 2, no seller exists at the beginning of the simulation. Students participate into the HubNet activities as new sellers in the market. They can adjust their selling price any time they want during the simulation. Besides, they can move to different locations at a certain moving-cost to attract more buyers by lowering the shipping cost in the utility function.
AGENTS
�Buyers� are customers in the market. They stay at home, surf online and shop products. Randomly each buyer finds couple sellers in the market and compares their products. Based on utility maximization rule, buyer makes a purchase.
Buyers are represented as computer monitors shaped turtles. They have properties like �rating� (feedback rating from the sellers), �c-price� (price coefficient in utility function), �c-seller-rating� (seller-rating coefficient in utility function), �c-shipping� (shipping coefficient in utility function).
�Sellers� sell products through online shopping platform. They stay online and wait for buyers come and contact them. Each seller has its own feedback rating which corresponds to their sales volume. Sellers can adjust their price according to their previous sales. At the beginning of each simulation, a group of existing sellers are created in the market. At the beginning of everyday, new seller comes into the market. They compete with each other by changing their selling price.
Sellers are computer station shaped turtles in the world. They have properties like �inventory� (inventory level of the seller), �cost� (product cost), �profit-rate� (profit-rate of the product), �price� (selling price), �sales-volume� (sales volume so far), �sales-volume-t� (sales volume today), �sales-volume-t-1� (sales volume yesterday), �sales-volume-t-2� (sales volume the day before yesterday). �revenue� (revenue so far), �revenue-t� (revenue today), �age� (number of days the seller has been in the market), �profit� (profit so far), �profit-t� (profit today), �rating� (feedback rating from buyers, +1 for positive, 0 for neutral, and -1 for negative), �star-level� (level of the seller, proportional to the log of the feedback rating), �utility� (value of utility function), �alive?� (an indicator of whether the seller is still active in the market.)
RULES
If I am a buyer, there is a chance that I want to buy a product today. If I want to buy a product, I surf online and visit websites of four different sellers. Then, I�ll calculate the utility of each of the seller and pick the one that maximize the utility function. After I made the choice, I�ll give a feedback rating (98% chance positive, 1% neutral, and 1% negative) to the seller I purchased from.
If I am a seller, I�ll adjust my price at the beginning of each day. As shown in Equation 2, if my average sales volume over the last three weeks is greater than the sales upper bound, I�ll increase my profit rate by 0.1. If my average sales volume over the last three weeks is less than the sales lower bound, I�ll lower my profit rate by 0.1 to help my sales. If after 10 days, I did not achieve 200 dollars revenue, I�ll turn yellow and die (become inactive).
HubNet Version 2
Instead of sellers in version 1, �students� turtles participate into the shopping platform as new sellers. The only difference between �students� turtles in version 1 and �sellers� turtles in version 2 is that the students can move their location at some moving cost to help their sales. Students are red person shaped turtles in the world. They have the exact same properties as the sellers. At the end of each day, the student with largest profit is called �profit winner�, and the student with the largest rating is called �rating winner�. Their user-id and the corresponding maximum profit and maximum rating will be monitored.
The world lies in the middle of the figure. Computer monitors represents the buyers, while the blue, red, yellow computer stations represent existing sellers, new sellers, and inactive sellers, respectively.
NetLogo Version 1
The NetLogo version 1 is on the left hand side. The procedure section has �setup� button, �go forever� button, and �go once� button. The sellers section has �existing-sellers� slider, �new-sellers� slider, �sales-lowerb� slider, and �sales-upperb� slider to set up the number of existing sellers, number of new sellers, sales lower bound and upper bound, respectively. The buyers section has �number-of-buyers� slider, �demand� slider, �choice-set-size� slider, and �show-price� switch to set up the initial number of the buyers, number of the demand every day, size of the choice set, and turn on/off showing price label, respectively. The results section contains two histogram plots, one for the sellers� rating distribution and on for the sellers� price distribution.
Click the SETUP button, a group of existing sellers in color blue and all buyers are created in the world. Click the GO/ GO ONCE button, simulation of one day sale starts. The sellers adjust their price according to the sales volume in the past three days. Demand is generated, so that buyers surf online, make a choice and give feedback ratings.
HubNet Version 2
The HubNet version 2 is on the right hand side. The procedure section has the �startup� button, �go forever� button, and �clear-all� button. The sellers section has the �moving-cost� slider to set up the cost of moving one step. The buyers section has the �price-coefficient-mean� slider, �rating-coefficient-mean� slider, and �shipping-coefficient-mean� slider to set up the mean of corresponding normally distributed parameters in utility function shown below. The results section has two monitors of the profit winner (student with largest profit), user-id and profit, and two monitors of the rating winner (student with largest rating), user-id and rating. In the Winner�s Selling Price plot, selling prices of both profit winner and rating winner are shown.
On the upper right corner of the HubNet client interface , important variables including sales today, sales so far, revenue today, revenue so far, profit today, profit so far, and feedback rating of this student are monitored. The �price� slider is used to adjust the selling price. Note that the cost is 20.0, so when selling price is less than 20, profit will become negative. Below the price slider is the moving panel, where students can move up, move left, move right, and move down by pressing the corresponding buttons or short keys. Moving one step will cost $10 at this moment. At the lower right corner, profit winner and rating winner are shown with the maximum profit and maximum rating, so that each student can have an idea where he/she is at.
NetLogo Version 1
How does rating histogram change in response to increasing number of new sellers?
How does price histogram change in response to increasing number of new sellers?
HubNet Version 2
What is the winning strategy?
NetLogo Version 1
You can move the demand slider and observe how that influences rating and price histogram.
You can also change the sales upper bound and sales lower bound and see how the price histogram changes.
HubNet Version 2
You can change the price-coefficient-mean, rating-coefficient-mean, and shipping-coefficient-mean slider and observe how that influences the winning strategy.
At the current stage, only one product exists in the market. In the future, multiple products can be introduced to the market, so that the shopping platform is more diverse.
NetLogo Version 1
The pricing strategy of sellers is pretty simple in this model. To better capture the price adjustment in reality, an optimization loop where seller optimizes his/her price at the beginning of each day can be realized.
HubNet Version 2
There is a lot of space for expanding the HubNet activities. For example, many buyers are very sensitive to negative feedback rating. So a penalty for having negative feedback rating can be added to the utility function. To reduce the risk of receiving negative feedback, sellers can choose whether to enroll in a insurance plan at a certain cost. If he/she is enrolled, they do not need to worry about the negative feedback. In exchange, they will lose some money.
HubNet activity is implemented in this model, which allows human participation.
;************************************************** ;****************** INITIALIZE ****************** ;************************************************** globals [ temp-c-price temp-c-seller-rating temp-c-shipping total-sellers count-A count-B count-C count-D count-E count-F count-G count-H count-I count-J min-r max-r winner1 ; student with maximum profit winner1-id ; student's user-id winner1-profit ; student's profit winner2 ; student with maximum rating winner2-id ; student's user-id winner2-rating ; student's rating ] breed [ sellers seller ] ; sellers in version 1 breed [ buyers buyer ] ; buyers in version 1 & 2 breed [ students student ] ; students in version 2 turtles-own [ sellers? ; indicates whethers it is a seller utility ; value of utility function alive? ; alive in version 1 ] sellers-own [ inventory ; inventory level cost ; product cost profit-rate ; profit rate of the product price ; price of the product sales-volume ; cout of sold products so far sales-volume-t ; cout of sold products this week sales-volume-t-1 ; cout of sold products last week sales-volume-t-2 ; cout of sold products 2 weeks ago revenue ; revenue so far revenue-t ; revenue this week age ; how many days the seller has been active in the market profit ; profit so far profit-t ; profit this week rating ; feedback ratings from buyers, +1 = positive, -1 = negative, 0 = neutral star-level ; proportional to the feedback rating ] buyers-own [ rating ; feedback rating from sellers, +1 = positive, -1 = negative, 0 = neutral c-price ; price coefficient in utility function c-seller-rating ; seller-rating coefficient utility function c-shipping ; shipping coefficient utility function ] students-own [ user-id ; students' user id inventory ; inventory level cost ; product cost profit-rate ; profit rate of the product price ; price of the product sales-volume ; sales volume so far sales-volume-t ; sales volume today sales-volume-t-1 ; sales volume yesterday sales-volume-t-2 ; sales volume the day before yesterday revenue ; revenue so far revenue-t ; revenue today age ; how many days the seller has been active in the market profit ; profit so far profit-t ; profit today rating ; feedback ratings from buyers, +1 = positive, -1 = negative, 0 = neutral star-level ; proportional to the feedback rating ] ;************************************************** ;****************** VERSION 1 ******************* ;************************************************** to setup1 clear-all ;; create existing sellers set-default-shape sellers "computer server" create-sellers existing-sellers [ setxy random-xcor random-ycor set color blue set age random 1000 set rating random 1000 ;set size 1 + rating * 0.01 ;; initialize set sales-volume 0 set sales-volume-t 0 set sales-volume-t-1 0 set sales-volume-t-2 0 set revenue 0 set revenue-t 0 set profit 0 set profit-t 0 set inventory random 100 set cost 20 set profit-rate random 20 set alive? true set sellers? true ] ;; create existing buyers set-default-shape buyers "computer workstation" create-buyers number-of-buyers [ setxy random-xcor random-ycor set c-price random 100 / (100 * 20) set c-seller-rating random 100 / (100 * 1000) set c-shipping random 100 / (100 * 25) set sellers? false ] end to go1 ;; sellers adjust their price ask sellers [ adjust-price set sales-volume-t-2 sales-volume-t-1 set sales-volume-t-1 sales-volume-t set sales-volume-t 0 set revenue-t 0 ] ;; new sellers enter the market create-sellers new-sellers [ set size 1 setxy random-xcor random-ycor set color red set age 0 set rating 0 set sales-volume 0 set sales-volume-t 0 set sales-volume-t-1 0 set sales-volume-t-2 0 set revenue 0 set revenue-t 0 set profit 0 set profit-t 0 set inventory random 100 set cost 20 set profit-rate random 20 set price precision ( cost * (profit-rate / 100 + 1) ) 1 set alive? true set sellers? true ] ask n-of demand buyers [ ask sellers [ set utility -10000 ] surf-online make-a-choice ] update-variables1 tick do-plot1 end ;************************************************** ;****************** VERSION 2 ******************* ;************************************************** to startup ;; commented out for applet version ; setup2 ; hubnet-set-client-interface "COMPUTER" [] ; hubnet-reset end to setup2 clear-patches clear-drawing clear-output ;; create buyers set-default-shape buyers "computer workstation" create-buyers number-of-buyers [ setxy random-xcor random-ycor set color yellow set c-price 0 - ( random-normal price-coefficient-mean (price-coefficient-mean / 3) ) / 20 set c-seller-rating ( random-normal rating-coefficient-mean (rating-coefficient-mean / 3) ) / (ln 500) set c-shipping 0 - ( random-normal shipping-coefficient-mean (price-coefficient-mean / 3) ) / 15 set sellers? false set alive? true set utility -1000000 ] set-default-shape students "person" ask students [ initialize-seller hubnet-send user-id "price" price ;hubnet-send user-id "Inventory" inventory ] end to initialize-seller set size 1 setxy random-xcor random-ycor set color red set age 0 set rating 0 set sales-volume 0 set sales-volume-t 0 set sales-volume-t-1 0 set sales-volume-t-2 0 set revenue 0 set revenue-t 0 set profit 0 set profit-t 0 set inventory random 100 set cost 20 set price precision ( cost * (1 + random 20 / 100) ) 2 set alive? true set sellers? true end ;;**************** RUN **************** to go2 listen-clients ;; sellers adjust their price every 2 [ ask n-of demand buyers [ ask turtles with [sellers? = true] [ set utility -10000 ] surf-online make-a-choice ] notify-clients ask students [ set sales-volume-t 0 set revenue-t 0 set profit-t 0 ] update-variables2 tick if ticks mod 5 = 0 ; every fifth time step... [ do-plot2 ] ; ...redraw the histogram ] end ;************************************************** ;*********** HubNet Procedures starts *********** ;************************************************** to listen-clients ;; as long as there are more messages from the clients ;; keep processing them. while [ hubnet-message-waiting? ] [ ;; get the first message in the queue hubnet-fetch-message ifelse hubnet-enter-message? ;; when clients enter we get a special message [ create-new-student ] [ ifelse hubnet-exit-message? ;; when clients exit we get a special message [ remove-student ] [ ask students with [user-id = hubnet-message-source] [ execute-command hubnet-message-tag ] ;; otherwise the message means that the user has ] ;; done something in the interface hubnet-message-tag ;; is the name of the widget that was changed ] ] end to create-new-student create-students 1 [ set user-id hubnet-message-source set label user-id initialize-seller hubnet-send user-id "price" price ;hubnet-send user-id "Inventory" inventory ] end to remove-student ask students with [user-id = hubnet-message-source] [ die ] end to execute-command [command] ; change the price if command = "price" [ set price hubnet-message stop ] ; move up one step if command = "move-up" [ set heading 0 fd 1 set profit profit - moving-cost stop ] ; move right one step if command = "move-right" [ set heading 90 fd 1 set profit profit - moving-cost stop ] ; move down one step if command = "move-down" [ set heading 180 fd 1 set profit profit - moving-cost stop ] ; move left one step if command = "move-left" [ set heading 270 fd 1 set profit profit - moving-cost stop ] end to notify-clients ; update variables in clients' monitors ask students [ hubnet-send user-id "Feedback Rating" rating hubnet-send user-id "Sales Today" precision sales-volume-t 1 hubnet-send user-id "Sales So Far" precision sales-volume 1 hubnet-send user-id "Revenue Today" precision revenue-t 1 hubnet-send user-id "Revenue So Far" precision revenue 1 hubnet-send user-id "Profit Today" precision profit-t 1 hubnet-send user-id "Profit So Far" precision profit 1 hubnet-send user-id "Profit Winner" winner1-id hubnet-send user-id "Max Profit" precision winner1-profit 1 hubnet-send user-id "Rating Winner" winner2-id hubnet-send user-id "Max Rating" precision winner2-rating 0 ;hubnet-send user-id "Inventory" inventory ] end ;************************************************** ;*********** HubNet Procedures ends ************* ;************************************************** to adjust-price if profit-rate > 0 [ ifelse (sales-volume-t + sales-volume-t-1 + sales-volume-t-2) > sales-upperb [ set profit-rate profit-rate + 0.1 ] [if (sales-volume-t + sales-volume-t-1 + sales-volume-t-2) < sales-lowerb [ set profit-rate profit-rate - 0.1 ] ] ] set price precision ( cost * (profit-rate / 100 + 1) ) 2 if show-price? [ set label round (price) ] end ;; buyers surf online and randomly pick 4 sellers to surf-online set temp-c-price c-price set temp-c-seller-rating c-seller-rating set temp-c-shipping c-shipping ; show count sellers ask n-of choice-set-size turtles with [ breed = students or breed = sellers ] [ set utility ( temp-c-price * price + temp-c-seller-rating * ln (rating + 100) + temp-c-shipping * (distance myself) + random-normal 0 1) ;show utility ] end to make-a-choice ask max-one-of (turtles with [ breed = students or breed = sellers ]) [utility] [ set sales-volume (sales-volume + 1) set sales-volume-t (sales-volume-t + 1) set revenue (revenue + price) set revenue-t (revenue-t + price) set profit (profit + price - cost) set profit-t (profit-t + price - cost) ;show sales-volume ; #debug set inventory (inventory - 1) ;set size size + 0.01 ;show inventory ; #debug ;; give seller feedback rating ifelse random 100 < 98 [ set rating (rating + 1) ; buyer satisfied with seller ] [ if random 50 < 100 [ set rating (rating - 1) ; buyer not stisfied with seller ] ] ] end to update-variables1 ;; define star-level of rating ; ask sellers ; [ ; ifelse ln ( rating + 1.1 ) <= 10 ; [ ; set star-level "A" ; ] ; [ ; ifelse ln rating <= 20 ; [ ; set star-level "B" ; ] ; [ ; ifelse ln rating <= 30 ; [ ; set star-level "C" ; ] ; [ ; ifelse ln rating <= 40 ; [ ; set star-level "D" ; ] ; [ ; ifelse ln rating <= 50 ; [ ; set star-level "E" ; ] ; [ ; ifelse ln rating <= 60 ; [ ; set star-level "F" ; ] ; [ ; ifelse ln rating <= 70 ; [ ; set star-level "G" ; ] ; [ ; ifelse ln rating < 80 ; [ ; set star-level "H" ; ] ; [ ; ifelse ln rating < 90 ; [ ; set star-level "I" ; ] ; [ ; set star-level "J" ; ] ; ] ; ] ; ] ; ] ; ] ; ] ; ] ; ] ; ] if (ticks > 5) [ ask sellers with [age > 10] [ if revenue < 200 [ set alive? false set color yellow ] ] ] set total-sellers count sellers with [alive?] ;show total-sellers set count-A count sellers with [star-level = "A" and alive?] set count-B count sellers with [star-level = "B" and alive?] set count-C count sellers with [star-level = "C" and alive?] set count-D count sellers with [star-level = "D" and alive?] set count-E count sellers with [star-level = "E" and alive?] set count-F count sellers with [star-level = "F" and alive?] set count-G count sellers with [star-level = "G" and alive?] set count-H count sellers with [star-level = "H" and alive?] set count-I count sellers with [star-level = "I" and alive?] set count-J count sellers with [star-level = "J" and alive?] end to update-variables2 set winner1 max-one-of students [profit] set winner1-id [user-id] of winner1 set winner1-profit [profit] of winner1 set winner2 max-one-of students [rating] set winner2-id [user-id] of winner2 set winner2-rating [rating] of winner2 end to do-plot1 set min-r min [ rating ] of sellers with [alive? = true] set max-r max [ rating ] of sellers with [alive? = true] set-current-plot "rating histogram" set-histogram-num-bars 8 set-plot-x-range (min-r - 1) (max-r + 1) histogram [ rating ] of sellers with [alive? = true] set-current-plot "price histogram" set-histogram-num-bars 8 set-plot-x-range min [price] of turtles with [sellers? = true] max [price] of turtles with [sellers? = true] histogram [price] of sellers with [alive? = true] ; set-current-plot "sellers rating" ; set-current-plot-pen "1" ; plot count-A ; ;show A-sales-volume ; set-current-plot-pen "2" ; plot count-B ; ;show B-sales-volume ; set-current-plot-pen "3" ; plot count-C ; set-current-plot-pen "4" ; plot count-D ; set-current-plot-pen "5" ; plot count-E ; set-current-plot-pen "6" ; plot count-F ; set-current-plot-pen "7" ; plot count-G ; set-current-plot-pen "8" ; plot count-H ; set-current-plot-pen "9" ; plot count-I ; set-current-plot-pen "10" ; plot count-J end to do-plot2 set-current-plot "Winner's Selling Price" set-current-plot-pen "profit-winner" plot [price] of winner1 set-current-plot-pen "rating-winner" plot [price] of winner2 end