Supply chain
stock eoqstock eoqstock safetystock safetystock newsvendorstock newsvendorstock crostonstock crostonstock demand_classstock abc_xyzstock abc_xyzstock simulatestock coveragestock coveragestock reconcilestock reconcile

stock eoq <annual_demand> <order_cost> <holding_cost>


Description

    Economic order quantity (Wilson): order quantity, orders per year, cycle in days, ordering and holding costs, total cost

Parameters

    annual_demand:   The annual demand - Number - required
    order_cost:   The cost of one order - Number - required
    holding_cost:   The holding cost of one unit for one year - Number - required
admin
stock eoq 1000 10 2.5
mentdb
{"order_quantity": 89.44271909999159, "orders_per_year": 11.180339887498947, "cycle_days": 22.360679774997898, "ordering_cost": 111.80339887498947, "holding_cost": 111.80339887498948, "total_cost": 223.60679774997897}

stock eoq <annual_demand> <order_cost> <holding_cost> <json_params>


Description

    EOQ with parameters: unit_cost (added to the total cost), working_days (250), lead_time_days (gives the reorder point), price_breaks [[minimum quantity, unit price], ...] (quantity discounts: the third argument is then the holding rate per year)

Parameters

    annual_demand:   The annual demand - Number - required
    order_cost:   The cost of one order - Number - required
    holding_cost:   The holding cost (or rate with price_breaks) - Number - required
    json_params:   The parameters - String - required
admin
stock eoq 5000 49 0.2 "{\"price_breaks\": [[0, 5], [1000, 4.8], [2000, 4.75]]}"
mentdb
{"unit_price": 4.8, "options": [{"min_quantity": 0, "unit_price": 5, "quantity": 700, "total_cost": 25700}, {"min_quantity": 1000, "unit_price": 4.8, "quantity": 1000, "total_cost": 24725}, {"min_quantity": 2000, "unit_price": 4.75, "quantity": 2000, "total_cost": 24822.5}], "order_quantity": 1000, "orders_per_year": 5, "cycle_days": 50, "ordering_cost": 245, "holding_cost": 480, "total_cost": 24725}
Reorder point
admin
stock eoq 1000 10 2.5 "{\"lead_time_days\": 5}"
mentdb
{"order_quantity": 89.44271909999159, "orders_per_year": 11.180339887498947, "cycle_days": 22.360679774997898, "ordering_cost": 111.80339887498947, "holding_cost": 111.80339887498948, "total_cost": 223.60679774997897, "reorder_point": 20}

stock safety <mean_demand> <sd_demand> <lead_time> <service_level>


Description

    Safety stock and reorder point for a cycle service level (probability of no stockout during the lead time): z, demand and sigma during the lead time, safety stock, reorder point

Parameters

    mean_demand:   The mean demand per period - Number - required
    sd_demand:   The sd of the demand per period - Number - required
    lead_time:   The lead time in periods - Number - required
    service_level:   The service level - Number - required
admin
stock safety 100 20 4 0.95
mentdb
{"target": "csl", "z": 1.6448536269514724, "demand_during_protection": 400, "sigma_during_protection": 40, "safety_stock": 65.7941450780589, "reorder_point": 465.79414507805893, "cycle_service_level": 0.9500000000000002}

stock safety <mean_demand> <sd_demand> <lead_time> <service_level> <json_params>


Description

    Safety stock with parameters: lead_time_sd (variable lead time), review_period (periodic review), order_quantity (gives the fill rate), target (csl or fill_rate: the share of the demand served from the stock)

Parameters

    mean_demand:   The mean demand - Number - required
    sd_demand:   The sd - Number - required
    lead_time:   The lead time - Number - required
    service_level:   The service level - Number - required
    json_params:   The parameters - String - required
admin
stock safety 100 20 4 0.98 "{\"target\": \"fill_rate\", \"order_quantity\": 500, \"lead_time_sd\": 1}"
mentdb
{"target": "fill_rate", "z": 0.9424893086079067, "demand_during_protection": 400, "sigma_during_protection": 107.70329614269008, "safety_stock": 101.5092051163166, "reorder_point": 501.5092051163166, "cycle_service_level": 0.8270289088319132, "expected_shortage_per_cycle": 10.000000000000014, "fill_rate": 0.98}
Used in use cases (1 recipe)

    Logistics & supply chain › Spare part with an intermittent demand: forecast, safety stock and policy check
Often used with

    math ceil  ·  stat stddev  ·  stock croston  ·  stock demand_class  ·  stock simulate

stock newsvendor <price> <cost> <salvage> <mean_demand> <sd_demand>


Description

    Newsvendor (one order for a season or a perishable product): critical ratio, optimal quantity, expected sales, leftover, lost sales and profit (normal demand)

Parameters

    price:   The selling price - Number - required
    cost:   The unit cost - Number - required
    salvage:   The salvage value of a leftover - Number - required
    mean_demand:   The mean demand - Number - required
    sd_demand:   The sd of the demand - Number - required
admin
stock newsvendor 10 6 2 100 30
mentdb
{"distribution": "normal", "critical_ratio": 0.5, "order_quantity": 100, "expected_sales": 88.03173158795701, "expected_leftover": 11.968268412042988, "expected_lost_sales": 11.968268412042981, "fill_rate": 0.8803173158795701, "expected_profit": 304.2538527036561}

stock newsvendor <price> <cost> <salvage> <mean_demand> <sd_demand> <json_params>


Description

    Newsvendor with parameters: distribution (normal or poisson for small demands), shortage_cost (goodwill cost of a lost sale)

Parameters

    price:   The price - Number - required
    cost:   The cost - Number - required
    salvage:   The salvage value - Number - required
    mean_demand:   The mean demand - Number - required
    sd_demand:   The sd (ignored for poisson) - Number - required
    json_params:   The parameters - String - required
admin
stock newsvendor 10 6 2 4 0 "{\"distribution\": \"poisson\"}"
mentdb
{"distribution": "poisson", "critical_ratio": 0.5, "order_quantity": 4, "expected_sales": 3.2185327407473414, "expected_leftover": 0.7814672592526586, "expected_lost_sales": 0.7814672592526586, "fill_rate": 0.8046331851868354, "expected_profit": 9.748261925978731}

stock croston <json_demand>


Description

    Forecast of an intermittent demand (many zero periods) by the Syntetos-Boylan approximation (SBA, the bias-corrected Croston): forecast per period, smoothed size and interval, errors, fitted values

Parameters

    json_demand:   The demand series - String - required
admin
stock croston "[0, 0, 5, 0, 0, 0, 3, 0, 4, 0, 0, 6, 0, 0, 0, 2]"
mentdb
{"method": "sba", "forecast_per_period": 1.4020634561273004, "forecast": [1.4020634561273004], "size": 4.5632, "interval": 3.0919, "mae": 1.7496900873274142, "rmse": 1.9643638575304323, "fitted": [1.5833333333333333, 1.5833333333333333, 1.5833333333333333, 1.5833333333333333, 1.5833333333333333, 1.5833333333333333, 1.5833333333333333, 1.4709677419354836, 1.4709677419354836, 1.4996655518394648, 1.4996655518394648, 1.4996655518394648, 1.5398194583751252, 1.5398194583751252, 1.5398194583751252, 1.5398194583751252]}
Complete: demand history -> forecast -> safety stock -> check of the policy on the history
admin
-> "[d]" "[0, 3, 0, 0, 5, 0, 2, 0, 0, 4, 0, 0, 6, 0, 1, 0, 0, 3, 0, 2]"; json load "tuto_f" (stock croston [d]); json load "tuto_s" (stock safety (json select "tuto_f" "/forecast_per_period") (stat stddev [d]) 2 0.95); -> "[s]" (math ceil (json select "tuto_s" "/reorder_point")); json load "tuto_p" (stock simulate [d] (concat "{\"policy\": \"sQ\", \"s\": " [s] ", \"Q\": 5, \"lead_time\": 2}")); -> "[res]" (concat "forecast " (math round (json select "tuto_f" "/forecast_per_period") 2) " per period, reorder point " [s] ", simulated fill rate " (math round (json select "tuto_p" "/fill_rate") 3)); json unload "tuto_f"; json unload "tuto_s"; json unload "tuto_p"; [res]
mentdb
forecast 1.28 per period, reorder point 8, simulated fill rate 1

stock croston <json_demand> <json_params>


Description

    Intermittent demand with parameters: method (croston, sba, tsb: Teunter-Syntetos-Babai, for obsolescence), alpha (0.1, size), beta (0.1, probability for tsb), horizon

Parameters

    json_demand:   The demand series - String - required
    json_params:   The parameters - String - required
admin
stock croston "[0, 0, 5, 0, 0, 0, 3, 0, 4, 0, 0, 6, 0, 0, 0, 2]" "{\"method\": \"tsb\", \"horizon\": 3}"
mentdb
{"method": "tsb", "forecast_per_period": 1.5309868113570617, "forecast": [1.5309868113570617, 1.5309868113570617, 1.5309868113570617], "size": 4.5632, "probability": 0.3355072780849101, "mae": 1.8210029447644382, "rmse": 2.033813306208026, "fitted": [1.5625, 1.40625, 1.265625, 1.6390625, 1.4751562500000002, 1.327640625, 1.1948765625, 1.51237335, 1.361136015, 1.676605373275, 1.5089448359475, 1.3580503523527498, 1.740190952835915, 1.5661718575523236, 1.4095546717970913, 1.2685992046173824]}
Used in use cases (1 recipe)

    Logistics & supply chain › Spare part with an intermittent demand: forecast, safety stock and policy check
Often used with

    math ceil  ·  stat stddev  ·  stock demand_class  ·  stock safety  ·  stock simulate

stock demand_class <json_demand>


Description

    Class of a demand (Syntetos-Boylan): ADI (mean interval between demands) and CV2 of the sizes give smooth, intermittent, erratic or lumpy, with the recommended forecasting method

Parameters

    json_demand:   The demand series - String - required
admin
stock demand_class "[0, 0, 5, 0, 0, 0, 3, 0, 4, 0, 0, 6, 0, 0, 0, 2]"
mentdb
{"periods": 16, "demand_periods": 5, "adi": 3.2, "cv2": 0.15624999999999994, "class": "intermittent", "recommended": "Croston SBA (stock croston)"}
Used in use cases (1 recipe)

    Logistics & supply chain › Spare part with an intermittent demand: forecast, safety stock and policy check
Often used with

    math ceil  ·  stat stddev  ·  stock croston  ·  stock safety  ·  stock simulate

stock abc_xyz <json_items>


Description

    ABC/XYZ classification of items: ABC on the consumption value (80 %, 95 %), XYZ on the variability of the demand (coefficient of variation 0.5, 1), and the 3 x 3 matrix

Parameters

    json_items:   {"item": [demand of each period], ...} - String - required
admin
stock abc_xyz "{\"A\": [100, 110, 95, 105], \"B\": [20, 0, 60, 5], \"C\": [5, 6, 5, 4], \"D\": [40, 42, 38, 41]}"
mentdb
{"items": [{"item": "A", "value": 410, "share": 0.606508875739645, "cumulative_share": 0.606508875739645, "cv": 0.06297533896272223, "abc": "A", "xyz": "X", "class": "AX"}, {"item": "D", "value": 161, "share": 0.23816568047337278, "cumulative_share": 0.8446745562130178, "cv": 0.04243043795428405, "abc": "A", "xyz": "X", "class": "AX"}, {"item": "B", "value": 85, "share": 0.1257396449704142, "cumulative_share": 0.970414201183432, "cv": 1.279777950751429, "abc": "B", "xyz": "Z", "class": "BZ"}, {"item": "C", "value": 20, "share": 0.029585798816568046, "cumulative_share": 1, "cv": 0.16329931618554522, "abc": "C", "xyz": "X", "class": "CX"}], "matrix": {"AX": 2, "AY": 0, "AZ": 0, "BX": 0, "BY": 0, "BZ": 1, "CX": 1, "CY": 0, "CZ": 0}}

stock abc_xyz <json_items> <json_params>


Description

    ABC/XYZ with parameters: values (unit value of each item), abc ([0.8, 0.95]), xyz ([0.5, 1])

Parameters

    json_items:   The items - String - required
    json_params:   The parameters - String - required
admin
stock abc_xyz "{\"A\": [100, 110, 95, 105], \"B\": [20, 0, 60, 5], \"C\": [5, 6, 5, 4]}" "{\"values\": {\"A\": 1.5, \"B\": 40, \"C\": 2}}"
mentdb
{"items": [{"item": "B", "value": 3400, "share": 0.8384710234278668, "cumulative_share": 0.8384710234278668, "cv": 1.279777950751429, "abc": "A", "xyz": "Z", "class": "AZ"}, {"item": "A", "value": 615, "share": 0.15166461159062886, "cumulative_share": 0.9901356350184957, "cv": 0.06297533896272223, "abc": "B", "xyz": "X", "class": "BX"}, {"item": "C", "value": 40, "share": 0.009864364981504316, "cumulative_share": 1, "cv": 0.16329931618554522, "abc": "C", "xyz": "X", "class": "CX"}], "matrix": {"AX": 0, "AY": 0, "AZ": 1, "BX": 1, "BY": 0, "BZ": 0, "CX": 1, "CY": 0, "CZ": 0}}

stock simulate <json_demand> <json_params>


Description

    Simulation of a stock policy on a demand series: sQ (order Q when the position falls to s), sS (order up to S), RS (every R periods, order up to S); lead_time, backorders or lost sales, initial; fill rate, cycle service level, stockouts, orders, average stock, costs (holding_cost, order_cost, shortage_cost)

Parameters

    json_demand:   The demand series - String - required
    json_params:   The policy - String - required
admin
stock simulate "[10, 12, 8, 15, 9, 11, 30, 10, 7, 12, 14, 9]" "{\"policy\": \"sQ\", \"s\": 25, \"Q\": 40, \"lead_time\": 2}"
mentdb
{"policy": "sQ", "periods": 12, "fill_rate": 1, "cycle_service_level": 1, "stockout_periods": 0, "orders": 3, "average_on_hand": 26.083333333333332, "lost_sales": 0, "on_hand": [55, 43, 35, 20, 11, 40, 10, 0, 33, 21, 7, 38]}
Periodic review
admin
stock simulate "[10, 12, 8, 15, 9, 11, 30, 10, 7, 12, 14, 9]" "{\"policy\": \"RS\", \"R\": 3, \"S\": 60, \"lead_time\": 1, \"backorders\": true, \"holding_cost\": 0.1, \"order_cost\": 20}"
mentdb
{"policy": "RS", "periods": 12, "fill_rate": 1, "cycle_service_level": 1, "stockout_periods": 0, "orders": 4, "average_on_hand": 39.25, "max_backorder": 0, "total_cost": 127.1, "on_hand": [50, 48, 40, 25, 51, 40, 10, 50, 43, 31, 46, 37]}
Used in use cases (1 recipe)

    Logistics & supply chain › Spare part with an intermittent demand: forecast, safety stock and policy check
Often used with

    math ceil  ·  stat stddev  ·  stock croston  ·  stock demand_class  ·  stock safety

stock coverage <on_hand> <json_forecast>


Description

    Coverage of a stock: projected stock per period and number of periods covered by the forecast

Parameters

    on_hand:   The stock on hand - Number - required
    json_forecast:   The forecast per period - String - required
admin
stock coverage 100 "[20, 25, 30, 30, 40]"
mentdb
{"on_hand": 100, "projected": [80, 55, 25, -5, -45], "coverage_periods": 3.8333333333333335, "first_period_below_safety": 3, "first_stockout_period": 3}

stock coverage <on_hand> <json_forecast> <json_params>


Description

    Coverage with parameters: safety_stock (first period below it), receipts (planned receipts per period)

Parameters

    on_hand:   The stock on hand - Number - required
    json_forecast:   The forecast - String - required
    json_params:   The parameters - String - required
admin
stock coverage 100 "[20, 25, 30, 30, 40]" "{\"safety_stock\": 20, \"receipts\": [0, 0, 50, 0, 0]}"
mentdb
{"on_hand": 100, "projected": [80, 55, 75, 45, 5], "coverage_periods": "more than the horizon (5)", "first_period_below_safety": 4, "first_stockout_period": -1}

stock reconcile <json_forecasts> <json_hierarchy>


Description

    Reconciliation of hierarchical forecasts (the children must sum to their parent): WLS with structural weights by default

Parameters

    json_forecasts:   {"node": [values], ...} - String - required
    json_hierarchy:   {"parent": ["child", ...], ...} - String - required
admin
stock reconcile "{\"total\": [100, 110], \"A\": [60, 62], \"B\": [30, 35], \"A1\": [35, 36], \"A2\": [20, 22], \"B1\": [30, 35]}" "{\"total\": [\"A\", \"B\"], \"A\": [\"A1\", \"A2\"], \"B\": [\"B1\"]}"
mentdb
{"method": "wls_struct", "nodes": 6, "bottom_nodes": 3, "reconciled": {"total": [91.66666666666669, 100], "A": [60.277777777777786, 63.333333333333336], "A1": [37.63888888888889, 38.66666666666667], "A2": [22.63888888888889, 24.666666666666664], "B": [31.388888888888893, 36.66666666666667], "B1": [31.388888888888893, 36.66666666666667]}}

stock reconcile <json_forecasts> <json_hierarchy> <json_params>


Description

    Reconciliation with parameters: method (bottom_up, top_down: split of the top by the bottom forecasts, ols, wls_struct)

Parameters

    json_forecasts:   The forecasts - String - required
    json_hierarchy:   The hierarchy - String - required
    json_params:   The parameters - String - required
admin
stock reconcile "{\"total\": [100], \"A1\": [35], \"A2\": [20], \"B1\": [30]}" "{\"total\": [\"A\", \"B\"], \"A\": [\"A1\", \"A2\"], \"B\": [\"B1\"]}" "{\"method\": \"top_down\"}"
mentdb
{"method": "top_down", "nodes": 6, "bottom_nodes": 3, "reconciled": {"total": [100.00000000000001], "A": [64.70588235294119], "A1": [41.1764705882353], "A2": [23.529411764705884], "B": [35.294117647058826], "B1": [35.294117647058826]}}