1. volunteer recruitment
It is very convenient and easy to understand according to the traffic balance equation. It may become one of the ways to create network streams in the future.
Let's take a look at the steps of the traffic balance equation ing method:
A. List demand Inequalities
B. Change the inequality to an equation by setting the relaxation variable.
C. subtract from each other to obtain the traffic balance equation.
D. observe the equation.> 0 indicates the obtained traffic. <0 indicates the output traffic. If it is a variable related to the demand, it is connected to the source and sink, if it is a cost-related variable, the related equation is mapped to the edge
E. Use the maximum flow algorithm with minimum cost
Specific EDGE connection method: Make oo = maxlongint, and connect (I, J, K, L) indicates that the I-to-J connection capacity is K, and the cost is L.
A. make a [0] = A [n + 1] = 0, for a [I]-A [I-1]> 0 (S, I, A [I]-A [I-1], 0), and a [I]-A [I-1] <0, then connect (I, T, A [I-1]-A [I], 0)
B. Connect (I + 1, I, Oo, 0)
C. For each type of volunteers (x, y, z), connect (X, Y + 1, Oo, Z)
2. Summary
The essence of network stream is actually greedy.
Network flows are inseparable from inequalities and traffic balancing equations. In a sense, they can even be equivalent.
Network stream can often deal with optimization problems with strong Dependencies
You must be familiar with some classic network stream models, such as the application of the smallest cut model in the largest weighted closed graph, and the shortest circuit of the plan network flow (which is also possible in other words)
If you want to use a network stream to create a question, you must list the target type, specify the direction for optimization, and make it impossible to do anything through the deformation of the form; or directly column the traffic balance equation to figure out
The cost stream adds one dimension to the maximum stream. The more powerful the function, the slower the speed.