We'd like to know if there exists a \textit{feasible circulation} in this network---that is, can we supply our cities with the energy they need without exceeding the capacity of our power plants and transmission lines?
\textbf{Your job:} Devise an algorithm that solve this problem.
\vspace{2ex}
\note{\textbf{Bonus:} Say certain edges have a lower bound on their capacity, meaning that we must send \textit{at least} that much flow down the edge. Modify your algorithm to account for these additional constraints.}
\begin{solution}
Create a source node $S$, and connect it to each station with an edge. Set the capacity of that edge to the capacity of the station. \\
Create a sink node $T$ and do the same for cities.
\vspace{2ex}
This is now a maximum-flow problem with one source and one sink. Apply FF.
\linehack{}
To solve the bonus problem, we'll modify the network before running the algorithm above.
\vspace{2ex}
Say an edge from $A$ to $B$ has minimum capacity $l$ and maximum capacity $u \geq l$. Apply the following transformations:
\begin{itemize}
\item Add $l$ to the capacity of $A$
\item Subtract $l$ from the capacity of $B$
\item Subtract $l$ from the total capacity of the edge.
\end{itemize}
Do this for every edge that has a lower bound then apply the algorithm above.