LP modeling issue (factory process) I am working on a linear programming problem in the following logistic network : $F_1$ and $F_2$ are supply nodes, $U_1$ and $U_2$ are factories, $C_1$ and $C_2$ are customers. 


*

*$A$ and $B$ are produced at nodes $F_1$, $F_2$

*$P$ and $Q$ are produced at nodes $U_1$, $U_2$ with the following requirements: $1$ unit of $P$ requires $1$ unit of $A$ and $0.5$ units of $B$; $1$ unit of $Q$ requires $0.2$ units of $A$ and $0.3$ units of $B$.


I have a doubt on how to model this. If $p_{i}^u$ denotes the amount of product $i \in \{P,Q\}$ that is produced by factory $u \in \{U_1,U_2\}$ and $c_{i}^u$ the amount of product $i\in \{A,B\}$ that is consumed (for the production of $P$ and $Q$) by factory $u\in \{U_1,U_2\}$, it is tempting to write
$$
p_P^{U_1} = c_A^{U_1}+0.5\;c_B^{U_1}\\
p_Q^{U_1} = 0.2\;c_A^{U_1}+0.3\;c_B^{U_1}\\
$$
However, this is wrong as the solver could for example set $p_P^{U_1}$ to $1$ with $c_A^{U_1}=1$ and $c_B^{U_B}=0$, which is incorrect.
Someone told me to write the equations the other way around as follows:
$$
c_A^{U_1} = p_P^{U_1}+0.2\;p_Q^{U_1}\\
c_B^{U_1} = 0.5\;p_P^{U_1}+0.3\;p_Q^{U_1}\\
$$
Is this correct ? If not, what is the appropriate way to write these equations ? 
 A: First of all let me come back to your first attempt as I think that it is important to understand why it does not work. Then I will try to give you some pointers as to why the second set of equations is probably correct.

Your first attempt at modeling the problem was as follows:
\begin{align}
p_P^{U_1} = c_A^{U_1} + 0.5~c_B^{U_1} \\
p_Q^{U_1} = 0.2~c_A^{U_1} + 0.3~c_B^{U_1} \text{.}
\end{align}
It does not work because:


*

*The meaning of each equation is not consistent with the problem considered. Put into words the equations correspond to the following sentences:

$1$ unit of $P$ requires $1$ unit of $A$ or $0.5$ units of $B$; $1$ unit of $Q$ requires $0.2$ units of $A$ or $0.3$ units of $B$


*These equations do not take into account that the raw material is most certainly consumed when creating a product. In other words, if there is a limited amount of raw materials these two equations do not take into account the trade-off that exists between the quantity $p_P^{U_1}$ of product $P$ produced and the quantity $p_Q^{U_1}$ of product $Q$. Similarly if the goal is to produce a certain amount of each product then these equations do not take into account the fact that the raw materials $A$ and $B$ used to create product $P$ are disjoint from the raw materials $A$ and $B$ used to create product $Q$.

Your second attempt at modeling the problem is as follows:
\begin{align}
c_A^{U_1} = p_P^{U_1} + 0.2~p_Q^{U_1} \\
c_B^{U_1} = 0.5~p_P^{U_1} + 0.3~p_Q^{U_1} \text{.}
\end{align}
This is probably correct:


*

*The meaning of each equation is respectively:

$1$ unit of $A$ can be used to produce $1$ unit of $P$ or $5$ units of $Q$; $1$ unit of $B$ can be used to produce $2$ units of $P$ or $\frac{1}{0.3}$ units of $Q$


*If you produce one unit of product $P$ you will increase the need in both $A$ and $B$ since $p_P^{U_1}$ appears in both equations. In other words if you need to produce a certain amount of each product the amount of raw materials needed will be correct.

*If there is a limited amount of raw materials (fixed $c_A^{U_1}$ and $c_B^{U_1}$) these two equations take into account the trade-off that exists between the quantity $p_P^{U_1}$ of product $P$ produced and the quantity $p_Q^{U_1}$ of product $Q$. In other words if you consume some raw materials to produce the product $P$ then you have less raw materials available for product $Q$.


Here I said that it is probably correct because you did not give the underlying problem that you want to solve (Maximizing the number of products created under a limited amount of raw materials, Maximizing your profit when selling your products, Minimizing the amount of raw material used for a given profit,...). If I cannot think of a counter example right away it might still happen that you need to change your model to solve a specific problem (in fact it is very likely that you will need to add more equations).
