Sequential supply chain
Model was written in NetLogo 5.0.4
•
Viewed 1564 times
•
Downloaded 76 times
•
Run 0 times
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 [demand-today] breed [players player] directed-link-breed [supply-links supply-link] supply-links-own [orders-filled] directed-link-breed [demand-links demand-link] demand-links-own [orders-placed] players-own [ role base-stock on-hand backlog inventory-position last-received ] to setup ca layout initialize resize-shape reset-ticks end to go if ticks >= 1000 [stop] set demand-today daily-demand update-policy place-order-to-up receive-order-from-up process-order-from-down summarize resize-shape tick end to update-policy ask players with [role = "distributor"] [set base-stock base-stock-distributor] ask players with [role = "retailer"] [set base-stock base-stock-retailer] end ;; Inventory operations ;; ************************** to place-order-to-up ask players with [role = "retailer" or role = "distributor"][ let amount-to-order max list (base-stock - inventory-position) 0 ask my-out-demand-links [set orders-placed amount-to-order] ] end to receive-order-from-up ask players [ ask out-supply-link-neighbors [ set last-received sum [first orders-filled] of my-in-supply-links ask my-in-supply-links [set orders-filled but-first orders-filled] set on-hand on-hand + last-received ] ] ask players with [role = "supplier"] [ set on-hand 10000 ] end to process-order-from-down ask players [ let new-orders 0 if role = "distributor" or role = "supplier" [set new-orders sum [orders-placed] of my-in-demand-links] if role = "retailer" [set new-orders demand-today] let orders-requested new-orders + backlog let orders-to-ship min list orders-requested on-hand set backlog max list 0 (backlog - on-hand + new-orders) ask my-out-supply-links [ set orders-filled lput orders-to-ship orders-filled ] set on-hand on-hand - orders-to-ship ] end to summarize ask players [ let pipeline sum [sum orders-filled] of my-in-supply-links set inventory-position on-hand + pipeline - backlog ] end ;; **************************** to layout set-default-shape players "circle" create-players 1 [ setxy 7 0 set color red set role "retailer" ] create-players 1 [ setxy 0 0 set color blue set role "distributor" ] create-players 1 [ set size 5 setxy -7 0 set color green set role "supplier" ] 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"] ] end to initialize ask players [ if role = "distributor" [ set base-stock base-stock-distributor set on-hand base-stock-distributor ask my-out-demand-links [set orders-placed 0] ask my-in-supply-links [set orders-filled n-values lead-time-supplier-distributor [0]] ] if role = "retailer" [ set base-stock base-stock-retailer set on-hand base-stock-retailer ask my-out-demand-links [set orders-placed 0] ask my-in-supply-links [set orders-filled n-values lead-time-distributor-retailer [0]] ] if role = "supplier"[ set on-hand 10000 ] set backlog 0 set inventory-position on-hand - backlog ] end to resize-shape ask players with [role = "distributor" or role = "retailer"][ set size 0.5 * (sqrt on-hand) ;; visualize the on-hand stock via size of the turtle ] end ;; Demand distribution generation ;; ************************************** to-report daily-demand if distribution = "deterministic" [report deterministic-demand] if distribution = "poisson" [report random-poisson mean-for-poisson] if distribution = "normal" [report truncated-normal mean-for-normal std-for-normal lower-bound-for-normal upper-bound-for-normal] 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 ;; ***************************************************************
There are 2 versions of this model.
This model does not have any ancestors.
This model does not have any descendants.