Network Supply Chain HubNet Version

Network Supply Chain HubNet Version preview image

1 collaborator

Default-person Dajun Yue (Author)

Tags

(This model has yet to be categorized with any tags)
Part of project 'Supply Chain Models'
Model group MAM-2013 | Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.4 • Viewed 987 times • Downloaded 70 times • Run 0 times
Download the 'Network Supply Chain HubNet Version' 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?

In this model, we develp a simplified network supply chain. There are 1 supplier, 2 distributors, and 2 retailers. The supplier is assumed to always have sufficient supply. The distributors and retailers are played by clients. The players are to place order from upstream nodes and to ship to satisfy demands from downstream nodes. Their objective is to minimize the cost, which consists of the inventory holding cost and the penalty cost for back-orders. Questions to ask involve: How delays in the shipment can affect the entire supply chain? How the players at the same echelon will compete with the other? What is the best strategy to place orders?

HOW IT WORKS

There is a day clock in the model. Everyday a demand is imposed to the retailers. The job of the players is to place order to upstream nodes. In the network supply chain, a player can place orders to multiple upstream nodes. Thus in this model, we allow the players to allocate their orders. Once all players finished ordering, the program will start shipping and summarize the day.

The players will put the requested order quantity into the supply pipelines. If there is not sufficient inventory, the unsatisfied quantity is counted as back-orders, which is to be fulfilled once inventory is avaialbe. In the network supply chain, a player may face multiple downstrean nodes. Thus in this model, we assume the shipping quantity is proportional to the requested order from each downstrean nodes.

The shipment takes certain lead time to arrive. Once the shipment arrives, the player will receive it into the inventory.

HOW TO USE IT

For the main interface: First, press the "recruit" botton to recruit players. Once you have 4 players, you can unpress the "recruit" button. Additional players will be rejected.

Second, press "setup" button to establish the network supply chain and assign roles to players.

Last, press "go" button and start the game. You are allowed to press "setup" and reset the game without losing the current players.

The "days-of-simulation" is used to controal the rounds of simulation. The "lead-time" stands for the shipping delay of the supply pipeline. The daily demand is generated by random-poisson. The "mean-for-poisson" represents the mean of the poisson distribution.

The plots show the total cost and on-hand inventory of each player.

For the client's window: You can use the sliders "orders-to1" and "orders-to2" to adjust the order quantity you want to place to upstream node1 and node2. Press "finish" button once you decide to order.

After all players in the game have placed their orders. The day is concluded and a new day will begin.

THINGS TO NOTICE

Players may want to find out the best order strategy that would minimize their cost.

Since competitors exist, it may be interesting to see how they will adjust their order strategy to compete with each other.

Also, will the retailers have loyaltiy to certain distributor?

THINGS TO TRY

The observer can try to adjust "days-of-simulation" slider to see if the length of simulation would affect players order stategy.

The observer can also adjust "lead-time" slider to see if longer delays in supply will add difficulties to the players.

The observer can adjust "mean-for-poisson" to change to daily demand.

EXTENDING THE MODEL

An interesting extension may be add the pricing mechanism into the model. That is to let the distributors and the retailers set the selling price. Then the players' objective become maximizing their own profit.

The current model involves only 2 distributors and 2 retailers. A flexible supply chain that enables the observer to adjust the number of distributors and retailers may be interesting.

The current model involves only 3 echelons: supplier, distributor, and retailer. More echelons can be added.

The current model allows full connection, e.g., each retailer can connect to all distributors. It would be interesting to explore what will happen in the limited connection situation.

NETLOGO FEATURES

This is a HubNet version of the previously developed ABM network supply chain model by the author.

RELATED MODELS

Wilensky, U. and Stroup, W. (2003). NetLogo HubNet Root Beer Game model. http://ccl.northwestern.edu/netlogo/models/HubNetRootBeerGame. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

Comments and Questions

I need your helps

Hello I'm a student who just starts to learn Netlogo for my school project. I'm very interested in your model. I want to adjust your model to fit my project case. In order to do that, I need to add utility function to set the order of quantities automatically by the utility function. But since I'm beginner, I have no clue can you help me or give me some hint? it would be really helpful to me Thank you so much your help in advance Here is my email: y.yu.18@student.rug.nl

Posted almost 5 years ago

Click to Run Model

globals [
  clock                     ;; clock denotes the days of simulation
  demand-today              ;; today's demand at both retailers
  colors                    ;; list of colors for plot pens
  stop-signal?              ;; if stop-signal? is true, the program will be stopped
]

breed [players player]     


;; there are two types of directed-links in this model
;; one for supply pipeline, one for demand placement
directed-link-breed [supply-links supply-link]  
                                                
supply-links-own [
  orders-filled          ;; a list standing for the shipping pipeline
  pair-demand-link       ;; the corresponding demand link with the same end nodes
]

directed-link-breed [demand-links demand-link]

demand-links-own [
  orders-placed          
  back-orders            ;; back-order for the end1 of the demand link
]



players-own [
  user-id
  role               ;; in this model, role can be "supplier", "distributor" or "retailer"
  number             ;; to distinguish players in the same echelon
  pen-color          ;; their pen-color on the plot
  
  on-hand            ;; on-hand inventory
  backlog            ;; total back-orders, equal to the sum or back-orders to each of its downstream nodes
  
  last-received
  finished?          ;; whether order placement is finished
  cost
  
  demand1            ;; demand from downstream node with number = 1 or 2
  demand2             
  
  last-shipped1      ;; amount shipped to downstream node with number = 1 or 2
  last-shipped2
  
  order1             ;; order to place to upstream node with number = 1 or 2
  order2
  
  ordered1           ;; order placed to upstream node with number = 1 or 2
  ordered2
]

;;
;; Startup procedure
;;

to startup
  hubnet-reset
  set-default-shape players "circle"
  set-default-shape links "arc"
end 

to recruit  
  
  ;; we will recruit 4 players during this procedure
  
  while [hubnet-message-waiting?]                 
  [
    hubnet-fetch-message
    if hubnet-enter-message? [create-player]
    if hubnet-exit-message? [remove-player] 
  ]
  every 0.1 [display]
end 

to go  
  listen-to-clients
  if stop-signal? [stop]         ;; if a stop signal is seen, we stop the program. 
                                 ;; this is usually because some players drop offline
  start-shipping
  every 0.1 [display]
end 

to listen-to-clients
  while [ hubnet-message-waiting? ]
  [
    hubnet-fetch-message
    ifelse hubnet-enter-message?[                ;; during the game, new commers will be rejected
      hubnet-kick-client hubnet-message-source
    ][  
    ifelse hubnet-exit-message?
    [
      remove-player                           ;; if a player drops offline, then there are not enough players
      set stop-signal? true                   ;; to continue the game. we remove this player and send stop signal  
      ]
    [execute-command hubnet-message-tag]      
    ]
  
  ]
end 

to execute-command [cmd]
  
  ;; players can control 3 things: 2 order sliders and 1 finish button
  
  ask players with [user-id = hubnet-message-source][
    if clock <= days-of-simulation [
      if hubnet-message-tag = "orders-to1" [set order1 hubnet-message]   
      if hubnet-message-tag = "orders-to2" [set order2 hubnet-message]
      if hubnet-message-tag = "finish" [
        place-order
      ]
    ]
  ]
end 

to place-order
  if not finished? [    ;; order can be place for only once in a day
    set finished? true
    set ordered1 order1 ;; in the network supply chain, we can control 
    set ordered2 order2 ;; the order quantity to each upstream nodes
    
    hubnet-send user-id "finished?" finished?
    
    hubnet-send user-id "ordered1" order1
    
    ;; distributors only place order to 1 supplier
    ;; so nothing is displayed in "ordered2" for distributors
    
    if role = "retailer"[
      hubnet-send user-id "ordered2" order2  
    ]
    
  ]
end 

to start-shipping
  ;; if all players have finished order placement
  ;; we conclude the day, and start shipping
  
  ifelse not any? players with [not finished?][
    place-order-to-up
    receive-order-from-up
    process-order-from-down
    summarize
    resize-shape
    set clock clock + 1               ;; proceed the day clock
    set demand-today daily-demand     ;; generate today's demand
    ask players with [role = "retailer" or role = "distributor"][
      set finished? false
      plot-cost
      plot-inventory              ;; plot cost and inventory
    ]
    update-to-clients
    update-order-info             ;; update parameters to the client windows
  ][
  update-order-info
  ]
end 

to update-to-clients
  ask players with [role = "distributor" or role = "retailer"][
    hubnet-send user-id "ordered1" ordered1
    
    if role = "retailer"[    ;; again, distributors don't have "ordered2"
      hubnet-send user-id "ordered2" ordered2
    ]
    
    hubnet-send user-id "last-received" last-received
    hubnet-send user-id "finished?" finished?
    hubnet-send user-id "day" clock
    hubnet-send user-id "on-hand-inventory" on-hand
    hubnet-send user-id "back-orders" backlog
    hubnet-send user-id "cost" cost
  ]
  
  ask players with [role  = "distributor"][    
    set last-shipped1 [last orders-filled] of one-of my-out-supply-links with [[number] of end2 = 1] 
    set last-shipped2 [last orders-filled] of one-of my-out-supply-links with [[number] of end2 = 2] 
    hubnet-send user-id "last-shipped1" last-shipped1
    hubnet-send user-id "last-shipped2" last-shipped2
  ]
end 

to update-order-info  
  ask players with [role = "distributor"][
    set demand1 [orders-placed] of one-of my-in-demand-links with [[number] of end1 = 1]  
    set demand2 [orders-placed] of one-of my-in-demand-links with [[number] of end1 = 2]
    hubnet-send user-id "demand1" demand1   
    hubnet-send user-id "demand2" demand2
  ]
  ask players with [role = "retailer"][
    set demand1 demand-today
    hubnet-send user-id "demand1" demand1
    hubnet-send user-id "demand2" ""       ;;retailers don't have "demand2"
  ]
end 


;;
;; Inventory operations
;;

to place-order-to-up
  ask players with [role = "retailer"][
    let amount-order-to1 ordered1
    let amount-order-to2 ordered2
    foreach sort my-out-demand-links[   ;; set the order quantity to the correpsonding demand link
      ask ?[
        if [number] of end2 = 1 [set orders-placed amount-order-to1]
        if [number] of end2 = 2 [set orders-placed amount-order-to2]
      ]
    ]
  ]
  
  ask players with [role = "distributor"][
    let amount-order-to-supplier ordered1        ;; distributors are only order from the supplier
    ask one-of my-out-demand-links [set orders-placed amount-order-to-supplier]
  ]
end 

to receive-order-from-up
  ask players [
    if role = "distributor" or role = "retailer"[    
      set last-received sum [first orders-filled] of my-in-supply-links  ;; pick out the first item in the pipeline
      ask my-in-supply-links [set orders-filled but-first orders-filled] ;; and remove it from the pipeline
      set on-hand on-hand + last-received                                ;; and add it to the inventory 
    ]
    if role = "supplier" [set on-hand 10000]                             ;; we assume that the supplier always has sufficient supply
  ]
end 

to process-order-from-down
  ask players [
    
    let new-orders 0
    if role = "distributor" or role = "supplier"[                 ;; demand for suppliers and distributors are equal to
      set new-orders sum [orders-placed] of my-in-demand-links    ;; the sum of orders from downstream nodes
    ]
    if role = "retailer" [
      set new-orders demand-today             ;; demand for retailers is simply today's demand
      
    ]
    let orders-requested new-orders + backlog    ;; we need to satisfy both new orders and the back-orders
    let orders-to-ship min list orders-requested on-hand  ;; if not enough inventory, ship as many as we have
    
    set backlog max list 0 (backlog - on-hand + new-orders)  ;; unsatisfied quantity is considered back-order
    
    let rest-amount orders-to-ship
    
    foreach sort my-out-supply-links [      ;; since we are shipping to multiple downstream nodes
      ask ? [                               ;; if not enough inventory, we need to allocate the available stock
                                            ;; the quota of each downstream node is proportional to their requested quantity
                                            ;; considering both back-orders and new orders
        let quota sum [back-orders] of pair-demand-link + sum [orders-placed] of pair-demand-link 
        let ship-to-this-link 0
        if orders-requested > 0 [           
          set ship-to-this-link min list ceiling (quota * orders-to-ship / orders-requested) rest-amount
        ]
        set rest-amount rest-amount - ship-to-this-link
        set orders-filled lput ship-to-this-link orders-filled
        ask pair-demand-link [set back-orders max list 0 (quota - ship-to-this-link)]
      ]
    ]
    
    set on-hand on-hand - orders-to-ship    ;; reduce the on-hand inventory by the amount shipped
  ]
end 

to summarize
  ask players with [role = "distributor" or role = "retailer"][
    let holding-cost on-hand * 0.5
    let back-order-cost backlog * 2
    set cost cost + holding-cost + back-order-cost    ;; summarize the day and calculate the cost
  ] 
end 

to resize-shape
  ask players with [role = "distributor" or role = "retailer"][
    set size 0.2 * (sqrt on-hand)          ;; visualize the on-hand stock via size of the turtle
  ]
end 

to create-player
  ifelse count players with [role != "supplier"] < 4 [   ;; if the number of players is less than 4
    create-players 1 [                                   ;; we can keep recruiting players
      set user-id hubnet-message-source         
      set label user-id                                  ;; label the players with their user-id first
      setxy (- max-pxcor + random max-pxcor) (- max-pycor + random max-pycor) ;; randomly place them in the world
    ]
  ][
  hubnet-kick-client hubnet-message-source    ;; if there are enough players, new commers are rejected
  ]
end 

to remove-player
  ask players with [user-id = hubnet-message-source][die]
end 

to setup
  set stop-signal? false      ;; reset the stop signal so that the program can go on
  layout
  label-players
  initialize
  resize-shape
  reset-plots
end 

to layout        ;; layout the network supply chain
  ask players with [role != "supplier"] [set role "unassigned"]  ;; reset the roles but not removing the players
  ask links [die]        ;; eliminate all the links
  
  ask n-of 2 players with [role = "unassigned"][
    set role "distributor"        ;; assign 2 distributors
    set color blue 
  ]
  
  ask n-of 2 players with [role = "unassigned"][
    set role "retailer"           ;; assign 2 retailers
    set color green
  ]
  
  ask patch -10 0 [
    if not any? players-here[
      sprout-players 1 [          ;; only 1 supply with sufficient supply in the world
        set role "supplier"
        set color red
        set size 5
      ]
    ]
  ]
  
  ;; create links according to their roles
  ask players with [role = "retailer"] [
    create-demand-links-to players with [role = "distributor"]
    create-supply-links-from players with [role = "distributor"]
  ]
  ask players with [role = "distributor"] [
    create-demand-links-to players with [role = "supplier"]
    create-supply-links-from players with [role = "supplier"] 
  ]
  
  
  
  ask supply-links [   ;; define pair demand link, which has the same two ends
    set pair-demand-link demand-links with [end1 = [end2] of myself and end2 = [end1] of myself]
  ]
  
  ask players with [role = "distributor" or role = "retailer"][
    hubnet-send user-id "role" role   ;; inform players of their roles in the game
  ]
end 

to label-players
  
  let distributors players with [role = "distributor"]
  let num-dist count distributors
  foreach sort distributors [
    ask ? [
      set number num-dist
      set num-dist num-dist - 1       ;; distinguish distributors by giving them different "number"
    ] 
  ]
  
  let retailers players with [role = "retailer"]
  let num-ret count retailers
  foreach sort retailers [
    ask ? [ 
      set number num-ret
      set num-ret num-ret - 1        ;; distinguish retailers by giving them different "number"
    ]
  ]
  
  ask players [
    set label word user-id "-SKU"    ;; relabel the players with their "user-id" and "number"
    set label word label number
  ] 
  
  ask players with [role = "distributor"][
    setxy 0 (-7 + (number - 1) * 14) 
  ] 
                                             ;; set distributors in the middle, retailers on the right
  ask players with [role = "retailer"][
    setxy 10 (-7 + (number - 1) * 14) 
  ]
  
  
  set colors [red blue green yellow]
  let index 0
  foreach sort players with [role = "distributor" or role = "retailer"][
    ask ? [
      set pen-color item index colors      ;; assign differnt pen-colors to players
      set index index + 1
    ]
  ]
end 

to initialize
  set clock 0    ;; reset day clock
  set demand-today daily-demand      ;; generate today's demand
  ask players [
    
    set on-hand 100
    set backlog 0
    
    set last-received 0
    
    set finished? false
    if role = "supplier" [set finished? true] 
    
    set cost 0
    
    
    set last-shipped1 0
    set last-shipped2 0
    
    set order1 10
    set order2 10
    
    set ordered1 0
    set ordered2 0
    
    if role = "distributor"[   ;; distributors order from only 1 supplier
      set order2 ""            ;; thus no "ordered2"
      set ordered2 ""
      hubnet-send user-id "ordered2" ordered2
    ]
    
    if role = "retailer" [                   ;; retailers face only 1 external demand
      hubnet-send user-id "demand2" ""       ;; thus no "demand2"
      hubnet-send user-id "last-shipped2" ""
    ]
    
    
  ]
  ask supply-links [
    set orders-filled n-values lead-time [0]   ;; supply pipeline as list with "lead-time" elements
  ] 
  ask demand-links [
    set orders-placed 0
    set back-orders 0
  ]
  

  update-to-clients
  update-order-info
end 

to-report daily-demand
  report random-poisson mean-for-poisson    ;; we use poisson distribution for the demand
end 


;;
;; plot procedure
;;

to create-plot-pen [my-plot]
  set-current-plot my-plot
  create-temporary-plot-pen user-id   ;; name plot pens according to their user-id
  set-plot-pen-color pen-color        ;; set pen-color
end 

to plot-cost
  set-current-plot "Total-cost"
  set-current-plot-pen user-id
  plot cost
end 

to plot-inventory
  set-current-plot "On-hand-stock"
  set-current-plot-pen user-id
  plot on-hand
end 

to reset-plots
  clear-all-plots
  ask players with [role = "distributor" or role = "retailer"][
    create-plot-pen "Total-cost"
    create-plot-pen "On-hand-stock"
  ]
end 

There are 4 versions of this model.

Uploaded by When Description Download
Dajun Yue almost 11 years ago info and descriptions added Download this version
Dajun Yue almost 11 years ago add plots Download this version
Dajun Yue almost 11 years ago fix the bugs Download this version
Dajun Yue almost 11 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Network Supply Chain HubNet Version.png preview Preview for 'Network Supply Chain HubNet Version' almost 11 years ago, by Dajun Yue Download

This model does not have any ancestors.

This model does not have any descendants.