## 4 Analysis
### Max-Flow Problems for Network Optimization  
The max-flow problem is a mathematical optimization model used to maximize the flow of goods or resources through a network, subject to capacity constraints on the network's edges (roads, railways, etc.). In the context of Dar es Salaam Port, this model can be applied to optimize the transportation of cargo from the port to hinterland destinations, considering the infrastructure limitations, vehicle capacities, and road conditions typical of African ports. 1. Problem Setup for Dar es Salaam Port  
We consider the transportation network from Dar es Salaam Port to key inland destinations. The network consists of nodes (representing the port, intersections, and inland cities) and edges (representing roads and railways). Each edge has a capacity (the maximum amount of cargo or number of vehicles it can handle) and a flow (the actual amount of cargo or vehicles moving through the edge). Key Components:  
Source Node: Dar es Salaam Port (where cargo originates). Sink Nodes: Hinterland cities, including:  
Kampala (Uganda), Kigali (Rwanda), Lusaka (Zambia), Bujumbura (Burundi), Lilongwe (Malawi), Lubumbashi (DR Congo). Intermediate Nodes: Intersections, road hubs, and rail stations along the transport routes. Edges: Roads connecting Dar es Salaam to each city, with the addition of a rail link only to Lusaka. 2. Max-Flow Formulation  
The objective is to maximize the amount of cargo that can flow from Dar es Salaam Port to the hinterland destinations while respecting the capacity constraints of the transport infrastructure. Max-Flow Objective:The goal is to maximize the total flow \(F\) from the source node s (Dar es Salaam Port) to the sink nodes \(t\) (inland destinations). This can be expressed as:  
\[max\sum_{(s,i)\in E}f_{si}\]  
where  
\(f_{si}\)--is the flow from the source node s to the intermediate node \(i\). \(E\)--is the set of edges (roads/railways) in the network. \(f_{ij}\)--is the flow from node \(i\) to node \(j\). Capacity Constraints:  
The flow on each edge (road or rail) must not exceed its capacity. The flow _fi_ between nodes i and j is constrained by the capacity _Cij_  
\[f_{ij}\ \leq c_{ij}\]  
where  
Cij is the capacity of the road or rail between node \(i\) and node \(j\). 3. Data for the Max-Flow Problem  
Network Data:  
Source Node: Dar es Salaam Port. Sink Nodes: Kampala (Uganda), Kigali (Rwanda), Lusaka (Zambia), Bujumbura (Burundi), Lilongwe (Malawi), Lubumbashi (DR Congo). Edge Capacities (tons/hour):  
Road Capacities:  
Dar es Salaam to Kampala: 2500 t/h, Dar es Salaam to Kigali: 1500 t/h, Dar es Salaam to Lusaka 1800 t/h (road). Dar es Salaam to Bujumbura 1300 t/h, Dar es Salaam to Lilongwe: 1200 t/h, Dar es Salaam to Lubumbashi: 2000 t/h. Rail Capacity (tons/day):  
Dar es Salaam to Lusaka (Rail): 1500 t/day. Cargo Demand:  
Dar es Salaam Port: Handles 6000 to 8000 t of cargo per day. Hinterland Demand:  
Kampala: 2500 t/day, Kigali: 1200 t/day, Lusaka: 1800 t/day, Bujumbura: 1000 t/day, Lilongwe: 1200 t/day, Lubumbashi: 2500 t/day. 4. Solving the Max-Flow Problem  
Step 1: Initialization  
We start with zero flow on all roads and rail lines:  
\[f_{ij}\ =0\forall(i,j)\in E\]  
Step 2: Ford-Fulkerson algorithm  
We apply the Ford-Fulkerson algorithm to maximize the cargo flow, focusing on identifying augmenting paths and updating the flow along those paths. Find Augmenting Paths:  
We identify all available paths from Dar es Salaam to the sink nodes (using roads to all cities, and rail to Lusaka). The residual capacity of each path is checked to determine the maximum possible flow that can still be sent along that path. Update Flows:  
For each augmenting path, we increase the flow along the path by the minimum residual capacity:  
\[f_{ij}\to f_{ij}+\min\left(c_{ij}-f_{ij}\right)\]  
Repeat:  
This process is repeated until no more paths with residual capacity can be found.