Known
$$ a , B=\begin{pmatrix}b_0\\b_1\\ \vdots \\b_i\end{pmatrix} , C=\begin{pmatrix}c_0\\c_1\\ \vdots \\c_i\end{pmatrix} $$
Equation
$$ Y=\begin{pmatrix}y_0\\y_1\\\vdots\\y_i\end{pmatrix}, $$
$$ Y = a B x - C $$
Condition
$$ y_i \ge 0, a = \sum_{j=1}^i y_j $$
About this question background
- a: total count for a product I should order, which my colleagues give (can make little change).
- B: each store's 14days mean salecount of this product
- C: stock number of this product , which can be sold on next day
- x: a single raito to control the daily replenishment for each store
- Y: the replenishment for each store, sum need equal to a
Question
How do I solve a best x (single varriable) ??
Maybe wee need set a = sum(Y) to optimization target ? I don't know , for me sum(Y) should as much as close to a and y_i also should >= 0 , so I think they are all condition .
Sorry, I don't know how to write a proper format. Feel free to alter my equation expression .
You have $i+1$ equations and $i+1$ variables. If you sum up you get $$\sum_{j=1}^i y_j=a (\sum_{j=1}^i b_j)x+\sum_{j=1}^i c_j$$ and if you replace $\sum_{j=1}^i y_j$ by $a$:
$$a=a (\sum_{j=1}^i b_j)x+\sum_{j=1}^i c_j$$ From this you get $$x=\frac{a-\sum_{j=1}^i c_j}{a(\sum_{j=1}^i b_j)}$$ You have to check if $y_j\ge 0$ for your solution.
It seems that your model is not appropriate for your situation.
Maybe the following is appropriate for your situation:
I will assume that $b_j$ is the avarage number of items sold in store $j$ per day. calculate the number of days that it will take until a store is empty. This ist
$$T_j=\frac{c_j}{b_j}$$
Now assume that the indexes are chosen that $$T_1\le T_2\le T_3\ldots$$
After $T_1$ days the first store, store 1, is empty. Now se add every day $b_1$ items from the ordered products. This is exactly the number of products that the store needs to fulfill the customer requests
After $T_2$ days the next store, store 2, is empty. So now we qdd every day $b_2$ items from the ordered products to store 2. This can be done for store 3,4 and so on until wee have no more ordered items.
So we use the following strategy to distribute our ordered products:
we want that store 1 to k+1 run out of items at the same time, so we choose $T$ such that
$$b_1(T-T_1)+b_2(T-T_2)+\ldots b_{k-1}(T-T_{k-1})+b_{k}(T-T_{k})= a $$ so $$T=\frac{a+b_1 T_1+b_2 T_2+\ldots b_k T_k}{b_1+b_2+\ldots+b_k}=\frac{a+c_1 +c_2 +\ldots c_k }{b_1+b_2+\ldots+b_k}$$ From $T$ wer now calculater the number of items we deliver to each store:
$$y_j=(T-T_j)b_j, j\le k$$ $$y_j=0, j\gt k$$
$T$ is the smallest time that is possible to avoaid that one store runs out of product $T.$