I am trying for formulate a mixed integer program that optimizes the cost of transferring water through three piping systems.
I have three tanks $S_i$, $i= 1,2,3$. Each tank $S_i$ has $5$ pipes ($j=1$ to $5$) draining the contents to next tank $S_{i+1}$. Each pipe has different flow rates $F_{ij}$. There is a demand $K$ at the end tank $S_k$. $D_{ij}$ is my binary decision variable that decides whether to open a valve $S_i$ or not.
$1$- open the valve, $0$- do not open the valve.
There is a fixed cost $C_{ij}$ to open each pipe. So my total cost of opening pipes is ‘sigma $C_{ij} D_{ij}$’. Now when I optmize this with cost as objective, I get cumulative flowrate of every $S_i$ ‘sigma $D_j$ $F_j$’ for every $i$. These cumulative flow rates are highly different from each other which is highly undesirable in this case. So to minimize that I put a cost to the difference in cumulative flowrates of each system. But when I do so, I end up getting negative values. Say, cum $F_{1j}= 40$ litres/ hr, $F_{2j}=30$, $F_{3j}=50$. Now when I take the differences $1-2$ gives $40-30=10$ and $2$ and $3$ gives $30-50= -20$.
I want to avoid this negative values because it will reduce the objective when the difference exists. I do not want to use absolute value function because that will make my problem non- linear. Can someone help me get absolute values of the difference in cum. Flow rates without making my objective non-linear? Or is there any other way to minimize the differences in cumulative flowrates across three systems?