Simplified problem:
Let's say we sell chicken. There are an order for today for 10 pieces from KFC that requires chicken to be good for at least 1 month and an order for tomorrow for 5 pieces from McDonald’s, that requires chicken to be good for at least 3 month. We have 6 pieces of chicken on stock with expiration date of 1 month and 12 pieces of 3 month. How to complete KFC's order with worst possible chicken (that pass the requirement) enabling completing MD order tomorrow?
Additional information:
- we are interested only in today's and tomorrow's orders;
- number of orders can vary (we need to optimize only orders for today);
- number of requirement can vary (for example 1) expiration date 2) production date)
- optimization applies to only one known requirement;
- it's not possible to divide piece of chicken into fractional pieces;
- it's not possible to sell negative amount of chicken.
I tried to build a system of linear inequalities, for example:
\begin{cases} KFC_{1m} + KFC_{3m} = 10 \\ MD_{3m} = 5 \\ KFC_{1m} \leq 6 \\ KFC_{3m} + MD_{3m} \leq 12 \\ \end{cases}
So the answer is: \begin{cases} KFC_{1m} = 6 \\ KFC_{3m} = 4 \\ \end{cases}
In this case it's easy to find a solution by hand, but for large systems it's not possible. I was thinking about extrapolating my logic to a general form like: \begin{cases} \sum_{i=1}^{n} X_{1i} = C_{1} \\ \sum_{i=1}^{n} X_{2i} = C_{2} \\ ... \\ \sum_{i=1}^{n} X_{mi} = C_{m} \\ \sum_{i=1}^{m} X_{i1} \leq K_{1} \\ \sum_{i=1}^{m} X_{i2} \leq K_{2} \\ ... \\ \sum_{i=1}^{m} X_{in} \leq K_{n} \\ \end{cases}
- $m$ is the amount of total orders (today + tomorrow);
- $n$ is the amount of different stock items;
- $X$ represents amount of a stock item for given order, for example $X_{11}$ is the amount of the first stock item for the first order, $X_{12}$ is the amount of the second stock item for the first order etc. Some of $X$ would be zero at the begging if a stock item doesn't pass the requirements for the order;
- $C_{p}$ is the ordered amount for $p$th order;
- $K_{p}$ is the total available amount of $p$th item (for example total amount of chicken with expiration date of 1 month is 12);
- we can also assume that $(k-1)$th stock item is worse than $k$th stock item (chicken with exp. date of 1m is worse than a chicken with 3m).
So the goal is to find a solutions for first $x$ orders with the worst possible stock items used and also enable completion of the other orders.
I tried to apply some of the lp. algorithms, but had no success, any thoughts?
P.S. I appreciate any feedback on improving the question.