API References
idinn.sourcing_model
- class idinn.sourcing_model.BaseSourcingModel(holding_cost: float, shortage_cost: float, init_inventory: float, demand_generator: UniformDemand | CustomDemand, batch_size: int, lead_time: int | None = None, regular_lead_time: int | None = None, expedited_lead_time: int | None = None, regular_order_cost: float | None = None, expedited_order_cost: float | None = None)
Bases:
object- get_current_inventory() Tensor
- get_holding_cost() float
- get_init_inventory() Tensor
- get_past_demands() Tensor
- get_past_inventories() Tensor
- get_shortage_cost() float
- reset(batch_size: int | None = None) None
- class idinn.sourcing_model.DualSourcingModel(regular_lead_time: int, expedited_lead_time: int, regular_order_cost: float, expedited_order_cost: float, holding_cost: float, shortage_cost: float, init_inventory: float, demand_generator: UniformDemand | CustomDemand, batch_size: int = 1)
Bases:
BaseSourcingModel- get_expedited_lead_time() int
- get_expedited_order_cost() float
- get_last_expedited_order() Tensor
- get_last_regular_order() Tensor
- get_past_expedited_orders() Tensor
- get_past_regular_orders() Tensor
- get_regular_lead_time() int
- get_regular_order_cost() float
- order(regular_q: Tensor, expedited_q: Tensor, seed: int | None = None) None
Orders items to the inventory and update the inventory with generated demands.
- Parameters:
regular_q (torch.Tensor) – The quantity of items to order from the regular supplier.
expedited_q (torch.Tensor) – The quantity of items to order from the expedited supplier.
seed (int, optional) – Random seed for reproducibility.
- class idinn.sourcing_model.SingleSourcingModel(lead_time: int, holding_cost: float, shortage_cost: float, init_inventory: float, demand_generator: UniformDemand | CustomDemand, batch_size: int = 1)
Bases:
BaseSourcingModel- get_lead_time() int
- get_past_orders() Tensor
- order(q: Tensor, seed: int | None = None) None
Orders items to the inventory and update the inventory with generated demands.
- Parameters:
q (torch.Tensor) – The quantity of items to order.
seed (int, optional) – Random seed for reproducibility.
idinn.single_controller
idinn.dual_controller
idinn.demand
- class idinn.demand.BaseDemand
Bases:
object- abstractmethod enumerate_support() dict
- abstractmethod get_max_demand() int
- abstractmethod get_min_demand() int
- abstractmethod sample(batch_size: int) Tensor
Generate demand for one period.
- Parameters:
batch_size (int) – Size of generated demands which should correspond to the batch size or the number of SKUs.
- class idinn.demand.CustomDemand(demand_prob: dict[int, float])
Bases:
BaseDemand- enumerate_support() dict
- get_max_demand() int
- get_min_demand() int
- sample(batch_size: int, batch_width: int = 1) Tensor
Generate demand for one period.
- Parameters:
batch_size (int) – Size of generated demands which should correspond to the batch size or the number of SKUs. If the size does not match the dimension of the elements from demand_history, demand will be upsampled or downsampled to match the size.
- class idinn.demand.UniformDemand(low: int, high: int)
Bases:
BaseDemand- enumerate_support() dict
- get_max_demand() int
- get_min_demand() int
- sample(batch_size: int, batch_width: int = 1) Tensor
Generate demand for one period.
- Parameters:
batch_size (int) – Size of generated demands which should correspond to the batch size or the number of SKUs.