API References

idinn.sourcing_model

class idinn.sourcing_model.BaseSourcingModel(holding_cost, shortage_cost, init_inventory, batch_size, lead_time=None, regular_lead_time=None, expedited_lead_time=None, regular_order_cost=None, expedited_order_cost=None, demand_generator=<idinn.demand.UniformDemand object>)

Bases: object

get_current_inventory()
get_init_inventory()
get_past_inventories()
reset(batch_size=None)
class idinn.sourcing_model.DualSourcingModel(regular_lead_time, expedited_lead_time, regular_order_cost, expedited_order_cost, holding_cost, shortage_cost, init_inventory, batch_size=1, demand_generator=<idinn.demand.UniformDemand object>)

Bases: BaseSourcingModel

get_cost(regular_q, expedited_q)
get_expedited_lead_time()
get_past_expedited_orders()
get_past_regular_orders()
get_regular_lead_time()
order(regular_q, expedited_q, seed=None)

Orders items to the inventory and update the inventory with generated demands.

Parameters:
  • regular_q (int, or torch.Tensor) – The quantity of items to order from the regular supplier.

  • expedited_q (int, or 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, holding_cost, shortage_cost, init_inventory, batch_size=1, demand_generator=<idinn.demand.UniformDemand object>)

Bases: BaseSourcingModel

get_cost()
get_lead_time()
get_past_orders()
order(q, seed=None)

Orders items to the inventory and update the inventory with generated demands.

Parameters:
  • q (int, or 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 reset()

Reset the state of the demand generator.

abstractmethod sample(batch_size) 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_history)

Bases: BaseDemand

reset()

Reset the state of the demand generator.

sample(batch_size) 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, high)

Bases: BaseDemand

reset()

Reset the state of the demand generator.

sample(batch_size) 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.