# How to construct the linear programing representation of a blending problem?

THE PROBLEM

A refinery has 10 million barrels of type A crude and 6 million barrels of Type B crude oil. The refinery has 3 plants to produce gasoline (it produces a profit of 2 USD / barrel) and naphtha (produces a profit of 1 USD / barrel) with the following features:

$$\begin{array}{|l|l|l|l|l|} & Input & { Input } & { Output } & { Output } \\ \hline \text { plant } & \text { A } & \text { B } & \text { Gasoline } & \text { Naphtha } \\ \hline 1 & 3 & 5 & 4 & 3 \\ \hline 2 & 1 & 1 & 1 & 1 \\ \hline 3 & 5 & 3 & 3 & 4 \\ \hline \end{array}$$

The data in the table above means that for example, if 3 barrels of crude oil type A and 5 barrels of type B crude enter plant 1, you can get 4 barrels of gasoline and 3 barrels of naphtha.

MY SOLUTION:

My approach (which is faulty) does not take into account the proportion of raw materials A and B that get into the 3 plants for its processing (no idea how to do it). Certainly, I was not able to establish the appropriate relation between input and output, consequently, my decision variable does not take into account the proportions that need to be combined to get material into the plants to get the output of the 2 final products.

Thank you for any correction and guide about how to solve this problem

My approach goes as follows:

SETS:

• $$P=\{1,2,3\}$$ is the set of Plants.

• $$TC=\{A,B\}$$ is the set of Crude Types.

• $$Pro=\{Gasoline, Naphtha\}$$ is the set of Products afer processing in each plant.

• $$Profit=\{Gasoline=2, Naphtha=1\}$$ profit for each barrel of each type of Product. PARAMETERS:

• $$ic_{tc}^{p} \in \mathbb{R}^+$$ input coefficient for each crude type $$tc$$, $$\forall tc \in TC$$ for plant $$p$$, $$\forall p \in P$$

• $$oc_{pro}^{p,tc} \in \mathbb{R}^+$$ is the output coefficient for each type of Product $$pro$$, $$\forall pro \in Pro$$ for plant $$p$$, $$\forall p \in P$$, for each crude type $$tc \in TC$$

• $$Stored_{tc}=\{ 10e^6, 6e^6 \} \in \mathbb{Z}^+$$ Barrels inventory of Crude Type $$tc$$, $$\forall tc \in TC$$

• $$Profit_{pro} \in \mathbb{Z}^+$$ is the Profit for each Product $$pro$$, $$\forall pro \in Pro$$

DECISION VARIABLE

\begin{align} x_{tc,p}\in \mathbb{Z}^+ , \; \forall tc \in TC,\; \forall p \in P \end{align} Number of crude barrel $$tc \in TC$$ that is processed at plant $$p \in P$$

OBJECTIVE FUNCTION \begin{align} \ &\textit{Maximize the profit}\\ & \max \sum_{pro \in PRO \\ p \in P} x_{tc,p} oc_{pro}^{p,tc} Profit_{pro} , \; \\ \textit{S.t:}\\ \\ &* \textit{Relation of input and output:}\\ & \sum_{tc \in TC} x_{tc,p} ce_{tc}^{p} = \sum_{pro \in PRO} y_{pro,p}, \forall p \in P, \tag 1\\ &* \textit{Processing each crude type throughout each plant cannot be greater than the inventory of each crude types}\\ & \sum_{p \in P} x_{A,p} \leq Stored_{A},\tag 2\\ & \sum_{p \in P} x_{B,p} \leq Stored_{B},\tag 3\\ &* \textit{Non-negativity of decision variable}\\ & x_{tc,p} \geq 0, \; \forall tc \in TC, \forall p \in P. \tag 4 \end{align}

• Can you please elaborate on the meaning of the table? Dec 23, 2021 at 21:56
• The data in the table above means that for example, if 3 barrels of crude oil type A and 5 barrels of type B crude enter plant 1, you can get 4 barrels of gasoline and 3 barrels of naphtha Dec 24, 2021 at 2:40
• @Pedrinho to be honest, I've been trying to solve but I didn't come with a solution, I don't know how to deal with this kind of blending 2 raw materials and getting as result 2 final products. I'll appreciate your help on this one. Dec 24, 2021 at 2:52

## 1 Answer

I believe the following LP should satisfy your constraints. Please try to understand constraint (3) and tell me if this is what you wanted. I modeled it separately for each input, output, plant combination. Let's assume that you want to produce 1 barrel of gasoline at the first plant. Constraint 3 then states, that $$3 \leq 4x_{00}$$ and $$5 \leq 4x_{10}$$, so you need at least $$\frac{3}{4}$$ barrels of input 0 and $$\frac{5}{4}$$ of input 1.

DECISION VARIABLES

\begin{align} x_{ij} \end{align} Number of crude barrel $$i \in I$$ processed at plant $$j \in J$$ \begin{align} y_{kj} \end{align} Number of output barrel $$k \in K$$ produced at plant $$j \in J$$

Linear Program \begin{align} \ & \max z = 2\sum_{j \in J} y_{0j} + \sum_{j \in J} y_{1j} \; \\ \textit{S.t:}\\ \\ & \sum_{j \in J} x_{0j} \leq 10,000,000 \tag1\\ & \sum_{j \in J} x_{1j} \leq 6,000,000 \tag2\\ & ic_{ij} y_{kj} \leq oc_{jk}x_{ij} \; \forall i \in I, j \in J, k \in K \tag3\\ & x_{ij} \geq 0, \; \forall i \in I, j \in J \tag4\\ & y_{kj} \geq 0, \; \forall k \in K, j \in J \tag5 \end{align}

• Thank you @Pedrinho, now is more clear how to deal with restrictions for blending problems. It's clear to me that $ic_{ij}$ is the input coefficient for the crude type $i \in I$ required for the plant $j \in J$ and $oc_{jk}$ is the output coefficient of plant $j \in J$ for Products type $k \in K$, but could you please elaborate more about how to establish the set of values for the parameters $ic_{ij}$ and $oc_{jk}$ in the model? and I'm not sure how that constraint ensures that plant 1 requires batches of $3*x_{A1}$ & $5*x_{B1}$ to produces $4*y_{G1}$ and $3*y_{N1}$. Dec 30, 2021 at 4:14
• Hi @Pedrinho, correct me if I´m wrong, but I think restriction 3 does not take into account that the coefficients of inputs for crude A and crude B, that are blended in a giving plant will produce jointly 2 outputs Gasoline and Naphtha. I believe that at the moment the constraint will let the linear program produce either Gasoline or Naphtha from a giving plant. What do yo think? Dec 31, 2021 at 16:12
• The constraint simply assures that your input of A and B is enough, given a certain amount of Gasoline and/or Natpha that you want to produce. You can still produce both at the same plant. Try to implement the model model in a solver and see what happens. Jan 1 at 22:04