RSOME: Robust Stochastic Optimization Made Easy
Multi-Stage Inventory Control
In this example we consider a multi-stage inventory control problem to showcase how different distributionally
robust models can be deployed in RSOME with little switching cost. The inventory control problem assumes that at the beginning of each time period t ∈ [ T ] t\in[T] t∈[T], the decision maker starts with I 0 I_{0} I0 units of product in inventory and selects a production quantity x t ∈ [ 0 , x ˉ t ] x_t \in [0, \bar{x}_t] xt∈[0,xˉt] with zero lead time at a unit cost c t c_t ct. After realization of demand d t ≥ 0 d_t \geq 0 dt≥0, the inventory is updated to I t = I t − 1 + x t − d t I_t = I_{t−1}+x_t −d_t It=It−1+xt−dt and it may incur a holding cost of h t max { I t , 0 } h_t \max\{I_t, 0\} htmax{
It,0} or a backorder cost of b t max { − I t , 0 } b_t \max\{−I_t, 0\} btmax{
−It,0}. We use the same parameters and data generation as in See and Sim (2010). Specifically, the demand follows a non-stationary autoregressive stochastic process of the form:
d ~ t ( v ) = v ~ t + α v ~ t − 1 + α v ~ t − 2 + ⋯ + α v ~ 1 + μ = d t − 1 ( v ~ ) − ( 1 − α ) v ~ t − 1 + v ~ t ∀ t ∈ [ T ] , \tilde{d}_t(\pmb{v}) = \tilde{v}_t + \alpha \tilde{v}_{t-1} + \alpha \tilde{v}_{t-2} + \cdots + \alpha \tilde{v}_1 + \mu = d_{t-1}(\tilde{\pmb{v}}) - (1-\alpha)\tilde{v}_{t-1} + \tilde{v}_t ~~~\forall t \in [T], d~t(vvv)=v~t+αv~t−1+αv~t−2+⋯+αv~1+μ=dt−1(vvv~)−(1−α)v~t−1+v~t ∀t∈[T],
where v ~ 1 , … , v ~ T \tilde{v}_1,\dots,\tilde{v}_T v~1,…,v~T are independent and identically distributed uniform random variables in [ − v ˉ , v ˉ ] [-\bar{v}, \bar{v}] [−vˉ,vˉ], and other parameters are given as:
- Number of time steps: T = 10 T=10 T=10.
- Constant in the autoregressive process: α = 0.25 \alpha=0.25 α=0.25.
- Initial inventory status: I 0 = 0 I_0=0 I0=0.
- Bounds of each random variable: v ˉ = 10 \bar{v}=10 vˉ=10.
- Mean demand: μ t = 200 \mu_t=200 μt=200.
- Upper bound of the order quantity: x ˉ t = 260 \bar{x}_t=260 xˉt=260.
- Order cost: c t = 0.1 c_t=0.1 ct=0.1.
- Holding cost: h t = 0.02 h_t=0.02 ht=0.02.
- Backorder cost: b t = 0.4 b_t=0.4 bt=0.4 if t = 1 , 2 , ⋯ , T − 1 t=1, 2, \cdots, T-1 t=1,2,⋯,T−1, and b T = 4.0 b_T=4.0 bT=4.0.
These parameters are defined by the code segment below.
import numpy as np
T = 10
alpha = 0.25
I0 = 0
vbar = 10
mu = 200 * np.ones(T)
xbar = 260 * np.ones(T)
c = 0.1 * np.ones(T)
h = 0.02 * np.ones(T)
b = 0.4 * np.ones(T)
b[T-1] = 4.0
With a null inventory on hand (i.e, I 0 = 0 I_0= 0 I0=0), the decision maker dynamically selects production quantities to minimize the expected total cost over the entire planning horizon, given by
min x , y sup P ∈ F E P [ c 1 x 1 + ∑ t ∈ [ T ] ∖ { 1 } c t x t ( s ~ , z ~ ) + ∑ t ∈ [ T ] y t ( s ~ , z ~ ) ] s.t. I 1 ( s , z ) = I 0 + x 1 − d 1 ( s , z ) ∀ z ∈ Z s , s ∈ [ S ] I t ( s , z ) = I t − 1 ( s , z ) + x t ( s , z ) − d t ( s , z ) ∀ z ∈ Z s , s ∈ [ S ] , t ∈ [ T ] ∖ { 1 } y t ( s , z ) ≥ h t I t ( s , z ) ∀ z ∈ Z s , s ∈ [ S ] , t ∈ [ T ] y t ( s , z ) ≥ − b t I t ( s , z ) ∀ z ∈ Z s , s ∈ [ S ] , t ∈ [ T ] 0 ≤ x 1 ≤ x ˉ 1 0 ≤ x t ( s , z ) ≤ x ˉ t ∀ z ∈ Z s , s ∈ [ S ] , t ∈ [ T ] ∖ { 1 } x t ∈ A ‾ ( C , J t − 1 ) ∀ t ∈ [ T ] ∖ { 1 } y t , I t ∈ A ‾ ( C , J t ) , ∀ t ∈ [ T ] . \begin{aligned} \min_{\bm{x}, ~\bm{y}} ~& \sup_{\mathbb{P} \in \mathcal{F}}\mathbb{E}_{\mathbb{P}}\left[c_1 x_1 + \sum_{t\in[T]\setminus\{1\}}c_t x_t(\tilde{s}, \tilde{\pmb{z}}) + \sum_{t\in[T]}y_t(\tilde{s}, \tilde{\pmb{z}})\right] \hspace{-0.4in} &\\ \text{s.t.}~ & I_1(s, \pmb{z}) = I_0 + x_1 - d_{1}(s, \pmb{z}) & \forall \pmb{z} \in \mathcal{Z}_s, \; s \in [S] \\ &I_t(s, \pmb{z}) = I_{t-1}(s, \pmb{z}) + x_t(s, \pmb{z}) - d_t(s, \pmb{z}) & \forall \pmb{z} \in \mathcal{Z}_s, \; s \in [S], \; t \in [T]\setminus\{1\} \\ &y_t(s, \pmb{z}) \geq h_t I_t(s, \pmb{z}) & \forall \pmb{z} \in \mathcal{Z}_s, \; s \in [S], \; t \in [T] \\ &y_t(s, \pmb{z}) \geq -b_t I_t(s, \pmb{z}) & \forall \pmb{z} \in \mathcal{Z}_s, \; s \in [S], \; t \in [T] \\ & 0 \leq x_1 \leq \bar{x}_1 \\ & 0 \leq x_t(s, \pmb{z}) \leq \bar{x}_t & \forall \pmb{z} \in \mathcal{Z}_s, \; s\in [S], \; t \in [T]\setminus\{1\} \\ & x_t \in \overline{\mathcal{A}}(\mathcal{C}, \mathcal{J}_{t-1}) &\forall t \in [T]\setminus\{1\} \\ & y_t, \; I_t \in \overline{\mathcal{A}}(\mathcal{C}, \mathcal{J}_t), &\forall t \in [T]. \end{aligned} x, ymin s.t. P∈FsupEP⎣⎡c