Network flow problem-Minimum cost maximum flow __ data structure and algorithm

Source: Internet
Author: User

Continue along the 2017 Huawei Software Elite challenge to review some of the "minimum cost maximum flow" related data. This year's problem boils down to: Combinatorial optimization + minimum cost maximum flow two sub problems, a given server location to find the minimum cost maximum flow as the bottom of the algorithm support will be good to improve the final results, the server site selection of this combinatorial optimization problem has a lot of solutions, I use genetic algorithm has a better convergence (reference to a blog post " Genetic algorithm ").

Let's start with a bunch of good posts:

1. http://www.360doc.com/content/13/1208/22/14357424_335569176.shtml, introduce SPFA (Dijkstar algorithm I use)

2. http://blog.csdn.net/pi9nc/article/details/23339111, introduce Ford_fulkerson algorithm, EK algorithm, dinic algorithm

Online on the "network flow problem-Minimum cost maximum flow" data, are basically applied to a simple forward graph model, this year's topic I think must be used to the "minimum cost maximum flow" solution to the graph.

The following is a detailed explanation of the minimum cost maximum flow in the graph below, and take a look at the following ideas about the problem of the direction map:


At first glance, the above solution to the "minimum cost maximum flow" is better, but there is already a reverse edge in the graph, or can be the edge of the direction of the graph is the opposite of the two directional side, then in the non-graph "Add the reverse weight" how to deal with it. In fact, as with the map, then add the reverse edge can not be superimposed with the original side, look at this blog http://blog.csdn.net/fobdddf/article/details/19615651, inside the details ....

The blog above uses the SPFA algorithm to solve the minimum cost problem (shortest path problem), I tried it. With genetic algorithms, the optimal solution can be obtained on the test cases provided by the first batch of sponsors (each use case has the best results in the iteration 1000), but, note this but, The time complexity of the SPFA algorithm is larger than that of the Dijkstar algorithm. The second batch of test cases ran hard enough to meet the time requirement.

The next consideration is to partition the graph, or choose the shortest path algorithm with less time complexity.

Huawei this algorithm contest to the topic, it seems not to let us find the best solution, but to find a time complexity can be acceptable suboptimal solution algorithm.

When the blogger is thinking about partitioning the map, the use of Dijkstar to do zoning, find the shortest path when only to find a node in the nearest n points within the point, that is, set the n points within the point did not find the desired point of exit Dijk, slowly, found that Dijkstar can also use: 1. Dijkstar can find the shortest path from the source point to the meeting point. You can also find the closest source point from the meeting point (the edge is still pointing to the meeting point, not from the meeting point), which can greatly reduce the number of times the Dijk is called, because from the point of departure, the nearest source Point Dijk exit, That is, just call (unsaturated) meeting point a few times Dijk, if starting from the source point to invoke all the source point a number of Dijk, the average number of points in this game is much smaller than the average number of points (measured results); 2. To find the nearest source point path from the meeting point, the effect of using the stream is equivalent to the effect of the SPFA recall reverse side (measured results). Some of the children's shoes in the group say genetic iterations are less frequent, it is estimated that the underlying support algorithm is not good, I am in the primary use of the iteration 1 generation time in the 30ms (40 body number), in the intermediate use cases iterative 1 generation time in 150~200ms, advanced use case is not very well. The blogger uses heuristic search iterative optimization (simulated annealing output results than iterative optimization almost point, do not know why) + genetic combination, only the primary and partial intermediate use cases can run into heredity, others can only in the iterative optimization of a solution. Because it is iterative optimization, in order to avoid the solution being trapped in the local optimum, the solution of the neighborhood function in heuristic strategy should have some randomness and can not be searched in a particular direction, which is different from the random mutation of genetic algorithm, but only the random part of the domain. That is, after giving a field, it randomly tries a certain percentage of the domain to be solved, which greatly increases the range of the search interval and reduces the probability of being trapped in the local optimum.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.