Path: blob/main/notebooks/09/03-seafood-distribution-center.ipynb
663 views
9.3 Stock optimization for seafood distribution center
Preamble: Install Pyomo and a solver
The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object SOLVER for later use.
Problem description
Each day a seafood distribution center buys tons of tuna at the unit cost per ton. The next day a demand is observed from the retailers to whom the fish is sold at a unit price . Any leftover tuna needs to be stored in a cold warehouse at a unit holding cost . The seafood distribution center cannot sell more fish than it has in stock, thus at most tons will be sold which will leave tons leftover, where is the positive residual (that is ). Accounting for these costs, the net profit is
Given a reasonable estimate of the probability distribution of the tuna demand , to maximize the long-term net profit then we can formulate the following optimization problem:
Since we have regardless of the demand , the feasible set for the decision variable is not affected by unknown demand.
Explicit analytical solution
Assume further that the demand for tuna in tons can be modeled as a continuous random variable with cumulative distribution function . We consider the following three distributions:
A uniform distribution on the interval ;
A Pareto distribution on the interval with and exponent . Recall that the inverse CDF for a Pareto distribution is given by* ;
A Weibull distribution on the interval with shape parameter and scale parameter .
Note that all the three distributions above have the same expected value, that is tons.
The optimal solution of the seafood inventory problem using the closed-form formula that features the inverse CDFs/quantile functions of the considered distribution, that is
In the example below, we report the numerical solution corresponding to the parameters , , and , which determine the quantile of interest, that is .
Deterministic solution for average demand
We now find the optimal solution of the deterministic linear problem model obtained by assuming the demand is constant and equal to the average demand, i.e., .
Profits resulting from using average demand
We now assess how well we perform by taking the average demand as input for each of the three demand distributions above.
For a fixed decision variable , approximate the expected net profit of the seafood distribution center for each of the three distributions above using the Sample Average Approximation method with points. More specifically, generate samples from the considered distribution and solve the extensive form of the stochastic linear problem resulting from those scenarios.
Approximating the solution using Sample Average Approximation method
We now approximate the optimal solution of stock optimization problem for each of the three distributions above using the Sample Average Approximation method. More specifically, generate samples from each of the three distributions and then solve the extensive form of the stochastic linear problem resulting from those scenarios. For each of the three distribution, we compare the optimal expected profit with that obtained before and calculate the value of the stochastic solution (VSS).
Convergence of the SAA method
The SAA method becomes more precise as the sample size increases. To illustrate this, we solve the same optimization problem as before but using a different number of samples, with the sample size increasing from to . As we can see, the approximate solutions converge to the theoretical ones as the sample size increases.