This might be long winded, but im struggling to generalize this question. So I'm sorry, but here goes:

So I have what I think is/was a linear optimization question.
I have a series of vendors and customers as well as a product cost per case and sale price per case. I also have the total supply at each vendor and demand at each customer. Next I have the freight for a full truck (not single case) between each vendor - customer combination. (We can assume all orders are full truck loads(1000 cases)).

I set this up as an LP (max) where the gross profit per case (Sale Price - Product Cost - Freight per case = GP) is the objective function and the total supply/demand for each vendor/customer are the constraints. So a variable for every customer vendor combination.
I solve this and all is well.

What do i do when i add additional products at different sales price/costs and different supply/demands? So 1 order could be 250 of product 1 and 750 of product 2. The freight is the problem here I think.

My intuition says when you have multiple products you could do a weighted allocation of the freight across the two products (to calculate GP per case) assuming you just create all new variables for each product (so two products doubles the amount of variables). If that's the case how do you keep the full truck load together? ie insure it comes from the same vendor? or if you allow it to come from multiple vendors how do you account for the the additional freight to get the second pick up?

Any help here is appreciated. I am doing this in SQL/R if that matters.


I would model this by using

$$ x_{i,j,k} = \text{number of cases product $k$ shipped from $i\rightarrow j$} $$

Assuming total supply $>$ total demand and all cases have the same size (i.e. 1000 per truck), we can write something like:

$$\begin{align} \max\> & \mathit{Sales} - \mathit{Cost} - \sum_{i,j} c_{i,j}\mathit{TLoad}_{i,j}\\ & \sum_i x_{i,j,k} = \mathit{demand}_{j,k}\\ & \sum_j x_{i,j,k} \le \mathit{supply}_{i,k}\\ & \mathit{Sales} = ...\\ & \mathit{Cost} = ...\\ & \mathit{TLoad}_{i,j} \ge \sum_k x_{i,j,k} /1000 \\ & \mathit{TLoad}_{i,j} \in \{0,1,2,\dots\} \end{align} $$

The exact model depends on details I don't know about. This is sometimes called a multi-commodity problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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