Single Stage (r,Q) Inventory Policy

Single Stage (r,Q) Inventory Policy preview image

1 collaborator

Default-person Dajun Yue (Author)

Tags

inventory 

Tagged by Dajun Yue over 11 years ago

suppl chain 

Tagged by Dajun Yue over 11 years ago

Part of project 'Supply Chain Models'
Model group MAM-2013 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 793 times • Downloaded 93 times • Run 0 times
Download the 'Single Stage (r,Q) Inventory Policy' 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

What does the model do?

I don't now anything about inventory policies so I was wondering what does this model do.

Posted over 6 years ago

Click to Run Model

;; Single stage model, EOQ model

globals [
  setup-price
  unit-price
  unit-holding-cost
  unit-backorder-penalty               ;; These are the given cost parameters
  demand-today
  ]



turtles-own [
  r 
  q 
  on-hand-stock 
  back-order
  inventory-position                   ;; The storage unit follows the (r,Q) policy
  alpha-service-level
  beta-service-level
  pipeline
  
  fixed-order-cost
  variable-order-cost
  inventory-holding-cost
  back-order-penalty
  total-cost
  
  num-filled
  num-missed
  quantity-filled
  quantity-missed
]

to setup
  ca
  
  set setup-price 100
  set unit-price 1
  set unit-holding-cost 0.05
  set unit-backorder-penalty 2
  
  
  set-default-shape turtles "circle"
  crt 1 [
    set color red 
  ]
  ask turtles [
    set on-hand-stock 100
    set back-order 0
    set inventory-position (on-hand-stock - back-order)
    set total-cost 0
    set r re-order-point
    set q order-quantity
    set pipeline n-values lead-time [0]
    set fixed-order-cost 0
    set variable-order-cost 0 
    
    resize-shape
  ]
  reset-ticks
end 

to go
  if ticks >= 1000 [stop]
  update-policy
  set demand-today daily-demand            ;; demand for every day is different
  ask turtles [
    receive
    sell
    replenish
    calculate-service-level
    resize-shape
  ]
  update-plot
  tick
end 

to update-policy
  ask turtles [
    set r re-order-point                 ;; inventory policy can be adjusted on the fly
    set q order-quantity 
  ]  
end 

to-report should-order?
  report inventory-position <= r                     ;; If the inventory position is below reorder point r, we should place an order
end                                                   

to receive
  let amount-received first pipeline                         ;; amount-received equals to the first item in "pipeline" list 
  ifelse back-order > 0                                      
  [
    ifelse back-order >= amount-received                     ;; after receiving the order, update on-hand stock and back-orders
    [
      set back-order (back-order - amount-received)
    ]
    [
      set back-order 0
      set on-hand-stock (amount-received - back-order)
    ]
    
  ]
  [
    set on-hand-stock (on-hand-stock + amount-received)
  ]
end 

to sell
  ifelse on-hand-stock >= demand-today
  [
    set on-hand-stock (on-hand-stock - demand-today)
    set num-filled num-filled + 1
    set quantity-filled (quantity-filled + demand-today)               ;; according to today's demand, update the on-hand stock and back-orders
  ]
  [
    set num-missed num-missed + 1                                      ;; if a demand is not fully met, num-missed + 1
    ifelse on-hand-stock > 0                                           ;; filled demand goes to quantity-filled, unfilled demand goes to quantity-missed
    [
      set quantity-filled (quantity-filled + on-hand-stock)
      set quantity-missed (quantity-missed + demand-today - on-hand-stock)
      
      set on-hand-stock 0
      set back-order (demand-today - on-hand-stock)
    ]
    [
      set quantity-missed (quantity-missed + demand-today)
      
      set back-order (back-order + demand-today)
    ]
  ]
end 

to replenish
  ifelse should-order? [
    set pipeline lput q pipeline                                       
    set fixed-order-cost fixed-order-cost + setup-price
    set variable-order-cost variable-order-cost + unit-price * q
  ]
  [
    set pipeline lput 0 pipeline                                      ;; if place an order, put the order quantity q into pipeline list
  ]
  set pipeline but-first pipeline
  set inventory-position sum pipeline + on-hand-stock - back-order                 ;; note that inventory position = on-hand stock - back-orders + inventory in-transit
  
  set inventory-holding-cost inventory-holding-cost + on-hand-stock * unit-holding-cost
  set back-order-penalty back-order-penalty + back-order * unit-backorder-penalty
  set total-cost (fixed-order-cost + variable-order-cost + inventory-holding-cost + back-order-penalty)
end 

to update-plot
  set-current-plot-pen "on-hand"
  plot sum [on-hand-stock] of turtles              ;; draw inventory profile on the plot
  
  set-current-plot-pen "back-ordered"
  plot sum [back-order] of turtles
end 

to calculate-service-level
  set alpha-service-level num-filled / (num-filled + num-missed)                   ;; alpha-service level is based on times filled
  set beta-service-level quantity-filled / (quantity-filled + quantity-missed)     ;; beta-service level is based on quantity filled
end 

to resize-shape
  set size 0.5 * (sqrt on-hand-stock)          ;; visualize the on-hand stock via size of the turtle
end 

to-report truncated-normal [mean-value std-value min-value max-value]
  let random-num random-normal mean-value std-value
  ifelse random-num > max-value or random-num < min-value
  [report min-value + random-float (max-value - min-value)]
  [report random-num]
end 

to-report daily-demand
;;  report 10
;;  report random-poisson mean-for-poisson             ;; Here we assume that the daily demand follows the Poisson distribution
                                                     ;; with mean specified by the user
                                                     
  report truncated-normal mean-for-normal std-for-normal lower-bound-for-normal upper-bound-for-normal
end  

There are 3 versions of this model.

Uploaded by When Description Download
Dajun Yue over 11 years ago truncated normal distribution added Download this version
Dajun Yue over 11 years ago fixed a bug Download this version
Dajun Yue over 11 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Single Stage (r,Q) Inventory Policy.png preview Preview for 'Single Stage (r,Q) Inventory Policy' over 11 years ago, by Dajun Yue Download

This model does not have any ancestors.

This model does not have any descendants.