Cost Functions
deepbullwhip.cost.base.CostFunction
Bases: ABC
Abstract per-period cost function.
Source code in deepbullwhip/cost/base.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
compute(inventory)
abstractmethod
Compute cost for a single period given ending inventory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory
|
float
|
On-hand inventory (negative means backorders). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Non-negative cost for this period. |
Source code in deepbullwhip/cost/base.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
deepbullwhip.cost.newsvendor.NewsvendorCost
Bases: CostFunction
Newsvendor-style cost: h * inventory^+ + b * inventory^-.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
holding_cost
|
float
|
Per-unit per-period holding cost (applied when inventory >= 0). |
required |
backorder_cost
|
float
|
Per-unit per-period backorder cost (applied when inventory < 0). |
required |
Source code in deepbullwhip/cost/newsvendor.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |