# Transportation Problem

I want to create a transportation model. I have identified importing and exporting countries with their estimated demand and supply. The cost of transportation per one uni is already calculated for each ex- and importer. Some exporters transport the hydrogen by ship and others by pipeline.

The problem I have is that I need to introduce losses when it is transported by ship. About 20% is lost and won't reach the importer. For pipeline transport there is no losses. I am having trouble to implement this into the objective function or the constraints. Is there a way to integrate this into the model?

• Is the shipping loss really 20% Maybe the loss is stochastic? is that variability significant relative to what you care about? Commented Jun 15, 2023 at 13:36
• generalized transportation problem Commented Jun 15, 2023 at 22:31

You can add an index to the $$x$$ variables to indicate whether transport is via pipeline or by ship: $$x_{ij}^k$$ denotes the quantity shipped on link $$(i,j)$$ via transport mode $$k\in\{\mbox{pipeline, ship}\}$$.

The problem becomes: $$\min \sum_k\sum_i\sum_jc_{ij}^kx_{ij}^k$$ subject to

• supply constraints: $$\sum_k\sum_jx_{ij}^k \le a_i \quad \forall i \tag{1}$$
• demand constraints: $$\sum_k\sum_ix_{ij}^k \ge b_j \quad \forall j \tag{2}$$

To take into account $$20\%$$ loss when transported by ship, you can consider that a dummy copy of node $$j$$ absorbs the $$20\%$$ loss. Constraints $$(2)$$ should be modified as follows:

$$\sum_k\sum_ix_{ij}^k \ge b_j + 0.2\sum_ix_{ij}^{\mbox{ship}}\quad \forall j \tag{3}$$

Alternatively, as proposed by @Sune, you could simply say that only $$80\%$$ of the shipped quantity reaches the destination:

$$\sum_ix_{ij}^{\mbox{pipeline}} + 0.8\sum_ix_{ij}^{\mbox{ship}} \ge b_j \quad \forall j \tag{4}$$

Both constraints are of course equivalent, as $$\sum_k\sum_ix_{ij}^k = \sum_ix_{ij}^{\mbox{pipeline}} +0.8\sum_ix_{ij}^{\mbox{ship}} +0.2\sum_ix_{ij}^{\mbox{ship}} \tag{5}$$

• Would this be easier, if you simply say that only 80% of the shipped quantity reaches the destination? Using your variables, it could be something like $\sum_{i} x_{ij}^{pipeline}+0.8 \sum_{i} x_{ij}^{ship}\geq b_j$
– Sune
Commented Jun 15, 2023 at 10:53
• Yes that looks good to me! I will add it as an alternative. Commented Jun 15, 2023 at 11:43
• yes, in this case don't define the option that is not available. Likewise, if a link does not exist in the initial transportation problem, variable $x_{ij}$ is not defined for this link. In other words, $x_{ij}^k$ is defined only when possible, not for all $i,j,k$. Commented Jun 15, 2023 at 12:57
• if you really don't want to work with index $k$, you could write constraint $(4)$ as follows: $$\sum_{i|(i,j)\mbox{is via pipeline}}x_{ij} + 0.8\sum_{i|(i,j)\mbox{is via ship}} x_{ij}\ge b_j$$ Commented Jun 15, 2023 at 13:18
• @anton You might even generalise it a bit and define a parameter $0 \leq \alpha_{ij} \leq 1$ denoting the proportion lost one arc $(i,j)$ and then define the constraints as $\sum_{i} (1-\alpha_{ij})x_{ij}\geq b_j$ for all $j=1,\dots,m$. Then you would have $\alpha_{ij}=0.2$ if the transport mode from $i$ to $j$ is by ship, and $\alpha_{ij}=0$ if it is by pipeline.
– Sune
Commented Jun 15, 2023 at 19:07

You can try as below as: $$\sum_{i}(x_{i,j}P_i + 0.8x_{i,j}(1-P_i)) \ge b_j \quad \forall j$$
where known parameter $$P_i = \begin{cases} 1, \text{if transport by pipe from i} \\ 0, \text{by ship} \end{cases}$$

Edit: correction made as suggested below.