Base inventory env
BaseInventoryEnv
BaseInventoryEnv (mdp_info:ddopai.utils.MDPInfo, postprocessors:list[object]|None=None, mode:str='train', return_truncation:str=True, dataloader:ddopai.dataloaders.base.BaseDataLoader=None, horizon_train:int=100, underage_cost:Union[numpy.ndarra y,ddopai.utils.Parameter,int,float]=1, overage_cost:Uni on[numpy.ndarray,ddopai.utils.Parameter,int,float]=0)
Base class for inventory management environments. This class inherits from BaseEnvironment.
Type | Default | Details | |
---|---|---|---|
mdp_info | MDPInfo | ||
postprocessors | list[object] | None | None | default is empty list |
mode | str | train | Initial mode (train, val, test) of the environment |
return_truncation | str | True | whether to return a truncated condition in step function |
dataloader | BaseDataLoader | None | dataloader for the environment |
horizon_train | int | 100 | horizon for training mode |
underage_cost | Union | 1 | underage cost per unit |
overage_cost | Union | 0 | overage cost per unit (zero in most cases) |
Returns | None |
BaseInventoryEnv.set_observation_space
BaseInventoryEnv.set_observation_space (shape:tuple, low:Union[numpy.ndarray,float]=- inf, high:Union[numpy.ndarray,flo at]=inf, samples_dim_included=True)
Set the observation space of the environment. This is a standard function for simple observation spaces. For more complex observation spaces, this function should be overwritten. Note that it is assumped that the first dimension is n_samples that is not relevant for the observation space.
Type | Default | Details | |
---|---|---|---|
shape | tuple | shape of the dataloader features | |
low | Union | -inf | lower bound of the observation space |
high | Union | inf | upper bound of the observation space |
samples_dim_included | bool | True | whether the first dimension of the shape input is the number of samples |
Returns | None |
BaseInventoryEnv.set_action_space
BaseInventoryEnv.set_action_space (shape:tuple, low:Union[numpy.ndarray,float]=-inf, high:Union[numpy.ndarray,float]=inf, samples_dim_included=True)
Set the action space of the environment. This is a standard function for simple action spaces. For more complex action spaces, this function should be overwritten. Note that it is assumped that the first dimension is n_samples that is not relevant for the action space.
Type | Default | Details | |
---|---|---|---|
shape | tuple | shape of the dataloader target | |
low | Union | -inf | lower bound of the observation space |
high | Union | inf | upper bound of the observation space |
samples_dim_included | bool | True | whether the first dimension of the shape input is the number of samples |
Returns | None |
BaseInventoryEnv.reset
BaseInventoryEnv.reset (start_index:int|str=None, state:numpy.ndarray=None)
Reset function for the Newsvendor problem. It will return the first observation and demand. For val and test modes, it will by default reset to 0, while for the train mode it depends on the paramter “horizon_train” whether a random point in the training data is selected or 0
Type | Default | Details | |
---|---|---|---|
start_index | int | str | None | index to start from |
state | ndarray | None | initial state |
Returns | Tuple |
BaseInventoryEnv.get_observation
BaseInventoryEnv.get_observation ()
Return the current observation. This function is for the simple case where the observation is only an x,y pair. For more complex observations, this function should be overwritten.