5
$\begingroup$

I am looking for an optimization algorithm to minimize the cost of transportation and storage cost in warehouse.

Let's assume the following table gives us the weekly forecast of Demand.

+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
|              | Week 1  | Week 2  | Week 3  | Week 4  | Week 5  | Week 6  | Week 7  | Week 8  | Week 9  | Week 10 | Week 11 | Week 12 |
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
| Demand       |  2,300  |  1,800  |  1,100  |  2,300  |  2,000  |  1,600  |  2,200  |  2,000  |  2,900  |  1,900  |  2,000  |   1,000 |
| Buffer       |    600  |    500  |    300  |    600  |    500  |    400  |    600  |    500  |    800  |    500  |    500  |     300 |
| Total Demand |  2,900  |  2,300  |  1,400  |  2,900  |  2,500  |  2,000  |  2,800  |  2,500  |  3,700  |  2,400  |  2,500  |   1,300 |
+--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+

The transportation cost follows the below mentioned price buckets given the ordered amount of units.

+---------------+----------------------+
|     Units     | Delivery Cost / Unit |
+---------------+----------------------+
| Less than 500 |                   50 |
| 500 - 1000    |                   40 |
| 1000 - 1500   |                   35 |
| 1500 - 2000   |                   30 |
| 2000 - 2500   |                   25 |
| 2500 - 3000   |                   20 |
| 3000 above    |                   15 |
+---------------+----------------------+

There is fixed 30$ storage cost to maintain inventory in warehouse. Time for delivery of stock from order point is 5 days. So we need to order 5 days prior if a certain quantity is required today.

I am looking for an algorithm that would help minimize the total cost while meeting the demand for each week. Also the order point should be provided.

Primarily, I am looking for readings or tutorial that would help understand how to solve such a problem. It would be great if someone can help with this particular example.

$\endgroup$
4
  • 1
    $\begingroup$ Are you tied to the Python programming language and it's eco system or why did you put the python tag there? The question feels more like a reference request. Is the storage cost per unit, per unit of peak storage because that is not clear. $\endgroup$ Sep 30, 2021 at 8:20
  • $\begingroup$ Your delivery cost function isn't clear would i pay more getting 499 than 501? As 499*50>501*40? Is the storage cost once per item or every day/week. $\endgroup$ Sep 30, 2021 at 8:52
  • $\begingroup$ Python would be my preferred choice to code algorithm that is why I've kept a Python tag. Storage cost is 30$ per unit. To get 499 units delivered it would cost more than getting delivered 501 units. 501 units will be delivered for $20,040 while delivery cost for 499 units is $24,950 $\endgroup$
    – Lopez
    Sep 30, 2021 at 9:09
  • $\begingroup$ @Lopez, to add other useful answers, the problem you have faced is a variant of the Lot-Sizing problem that is frequently used in the planning and order problem. If the problem data is consisting the row materials and NOT only the end product, using the MILP approach might not be the best one as the inventory balancing constraints satisfying is a complicating task. Instead of using MILP, the MRP heuristic approach might be interested. $\endgroup$
    – A.Omidi
    Sep 30, 2021 at 19:57

3 Answers 3

5
$\begingroup$

I won't write a python solution as i am not familiar with any python modeling language but i can describe the approach i took in the past to solve problems like this.

I would solve this problem using a technique of finite horizon optimal control where we have an $x_t$ a state vector for each time point, a control signal $u_t$, a prediction $p_t$.

The core of idea is that you define a transition function which defines $x_t = f_t(x_{t-1},x_{t-2}, ... ,x_{0},u_{t-1},u_{t-2}, ... ,u_{0}, p_t, p_{t+1}, ... , p_{t+h})$ depending on past state, past controls and future predictions of demand and those as constraint of your model the time interval your model runs over. Futhermore you define constraints involving the predictions $p_t$, $x_t$, $u_t$ that ensure you always have enough stock. You define your objective in terms of $x_t$ and $u_t$.

The idea is that on day $\tau$ you run a the model with updated predictions, the 5 past $u_{\tau-1}, u_{\tau-2}, u_{\tau-3}, u_{\tau-4}, u_{\tau-5}$ as you ordered and they will arrive, $x_{\tau-1}, x_{\tau-2}, x_{\tau-3}, x_{\tau-4}, x_{\tau-5}$ as the historic stock levels and $p_t, ..., p_{t+h}$ as predict the demand on these days, you leave $x_{\tau}, ... x_{\tau + h}$ as free variables, constraint by transition function and leave $u_\tau, ... , u_{\tau + h}$ as free variables where $h$ is the length of time horizon. The choice of $h$ is a trade off between model performance and amount of computation. After running the model you get an $u_\tau$ and you order that many. The next day you rerun the model with updated predictions and one day further.

In your case the transition constraint would look like $x_{t} = x_{t-1} + u_{t-5} -p_{t-1}$. The stock level of the next day is the stock level of the previous day plus what you order 5 days ago minus that you expect to sell. You in addition can pose a contraint how much buffer you want atleast for each $x_t$.

The objective would be a sum of a piece wise function applied to how much was order plus storage costs. There is a lot of research how you can express piecewise function as mixed integer problems but some of them are about continous functions which yours is not.

It think you could express this problem completly in the language of Mixed Integer Linear Programming. I hope this gave you an idea how to approach it.

$\endgroup$
2
  • $\begingroup$ The answer is pretty helpful, can you comment on which programming language would have implementation of such problem? Or what would be your preferred programming language choice to solve such problems? $\endgroup$
    – Lopez
    Sep 30, 2021 at 13:49
  • 1
    $\begingroup$ I would have choosen Julia with the modeling language JuMP as i am familiar with it and it has access to many open source and closed source solvers. For this problem the choice of progamming language would have little impact for performance as most of the time would be spent in the solver. In Python there are many modeling languages, PuLP seems to have the best coverage of solvers for this problem type but i am not sure in how far callbacks are supported (those wouldn't be helpfull here anyway). $\endgroup$ Sep 30, 2021 at 13:58
6
$\begingroup$

I would approach this as a mixed integer linear programming (MILP) problem. There are a number of MILP solvers, some open source, some commercial (with some of the commercial solvers providing free licenses for educational use). Many of them either have a Python API or can be used with PuLP (mentioned in comment to the selected answer).

You might want to search the web for references to integer programming models that involve "all units discounts", which describes your delivery costs. All units discounts frequently occur in the context of order costs rather than shipping costs, but the method of modeling them would be easily transferable.

$\endgroup$
1
$\begingroup$

Depending on what your decision variables are you are looking at an integer, mixed integer, or mixed integer linear programming problem. It seems to me that you want to solve it using a Python model. If that is the case, you can look at Pyomo or PuLP systems if you're looking for open-source solvers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.