Minimum Cost Maximum Flow Algorithm with Restrictions
The minimum cost maximum flow algorithm with restrictions is a variant of the maximum flow problem that takes into account the cost of sending flow through edges. The goal is to find a flow that maximizes the total flow while minimizing the total cost.
Algorithm
LOOP until stop Loop over servers SET closest = NULL SET shortest = INFINITY Loop over clients IF client has server CONTINUE SET dist = distance from client to server IF dist < shortest SET closest = client SET shortest = dist ENDLOOP over clients IF closest == NULL STOP Connect closest client to server ENDLOOP over servers ENDLOOP until stop
Example
Consider the following example:- There are 3 servers and 5 clients.
- The cost of sending flow from a server to a client is given by the following matrix: