sim_min_Q_dynamic: sim_min_Q_dynamic

sim_min_Q_dynamicR Documentation

sim_min_Q_dynamic

Description

Simulating a Min,Q policy or also called S,Q policy, the min is dynamically calculated based on a forecast vector. . The Function takes a demand vector, mean of demand ,sd,lead time and requested service level to simulate an inventory system, orders are lost if inventory level is less than requested demand, also ordering is made at day t+1, metrics like item fill rate and cycle service level are calculated. the min is calculated based on a normal distribution or a poisson distribution, also min can be set manually. Q (fixed quantity) is ordered whenever inventory position reaches min

Usage

sim_min_Q_dynamic(
  demand,
  forecast,
  leadtime,
  service_level,
  initial_inventory_level = FALSE,
  Quantity,
  one_step_forecast = TRUE,
  shortage_cost = FALSE,
  inventory_cost = FALSE,
  ordering_cost = FALSE,
  distribution = "normal",
  error_metric = "mse",
  smoothing_error = 0.2,
  metric_windows = FALSE,
  plot = FALSE,
  Backlogs = FALSE
)

Arguments

demand

A vector of demand in N time periods.

forecast

the forecast vector of equal n periods to demand.

leadtime

lead time from order to arrival (order to delivery time)

service_level

cycle service level requested

initial_inventory_level

integer,Default is False and simulation starts with min as inventory level

Quantity

integer,Fixed ordering quantity.

one_step_forecast

logical, Default is true where demand lead time is calcluated as(forecast at period t * leadtime) while if False, demand leadtime is calculated as (forecast of period t to forecast of period t+leadtime-1)

shortage_cost

numeric,Default is FALSE shortage cost per unit of sales lost

inventory_cost

numeric,Default is FALSE inventory cost per unit.

ordering_cost

numeric,Default is FALSE ordering cost for every time an order is made.

distribution

distribution to calculate safety stock based on demand distribution, current choices are 'normal' 'poisson','gamma' and negative binomial 'nbinom'

error_metric

metric is currently 'rmse' and 'mae', this calculates the error from period 1 to period t unless metric_windows is set. this contributes to the calculation of saftey stock. default is 'rmse'

smoothing_error

number between 0 and 1 to smooth the error as alpha x error[t] + (1-alpha) x error t-1, if metric_windows is used, smoothing error has to be FALSE

metric_windows

integer, for exammple if it is set to 4 rmse for t is calculated from t-1 to t-4,default is FALSE

plot

Logical, Default is False, if true a plot is generated.

Backlogs

Logical, Default is False, if true inventory level accounts for previous lost orders.

Value

a list of two date frames, the simulation and the metrics. the metrics are (1) shortage cost, (2) inventory cost which is the cost of one unit of inventory in one period,(3) which is the average inventory level per period, (4) total orders made in the simulation, (5) ordering cost if any, (6) total lost sales if any,(7) average ordering quantity across all orders,(8) ordering interval which is the average time between each order,(9) item fill rate,(10) cycle service level, (11) average saftey stock in each period,(12) the average sales in every order,(13) overall root mean square error, (14) overall mean absolute error, (14) overall mean error,(15) overall mean absolute percentage error,(16) the average flowttime which is the average time a unit spends on inventory and (17) the demand classification.

Author(s)

"haytham omar email: <haytham@rescaleanalytics.com>"

Examples

sim_min_Q_dynamic(demand = rpois(90,8),forecast = rpois(90,8),leadtime = 5,
service_level = 0.95,Quantity = 80,initial_inventory_level = 80,
 one_step_forecast=TRUE,shortage_cost = FALSE, 
                 inventory_cost = FALSE, ordering_cost = FALSE,distribution= 'normal', 
                 error_metric= 'rmse',metric_windows= FALSE,plot=TRUE)

inventorize documentation built on June 1, 2022, 1:07 a.m.