|
There are quite a lot of discussions on the algorithm. If the host is interested in this algorithm, you can try Google it: postman problem, quenching problem, genetic algorithm, heuristic algorithm, etc., basically all discussions of this algorithm
The basic idea:
A significant sign of judging the shortest path is that there must be no two crossing lines.
algorithm:
Use Dijkstra to generate the initial node. After that, randomly extract two line segments, exchange vertices, for example, line segments ab and cd, which become ad and bc after the exchange, and then calculate whether the sum of the two line segments is shortened. The number of extractions determines the final ideality.
After the number of exchanges reaches a critical value, the results cannot be optimized.
This algorithm has a relatively large flaw. In such a connection graph, there must be a line segment connecting from one side of the graph to the other side. That is, the optimal solution will never be obtained.
improve algorithm:
Requirements: probability theory and mathematical statistics.
For the improvement of the above-mentioned exchange algorithm, in the exchange process, it is not strictly determined whether to shorten, but to allow a certain degree of total increase in the exchange process, and the increase ratio can be calculated. Then, the algorithm requires recording a few steps of the exchange process, and, after a few steps, there is no reduction in the back. Use iteratively until it reaches that there is no cross between any two connections, and the optimal solution result is reached.
All relevant mathematical models have not been listed due to space reasons, but just a general idea, I believe it should be able to satisfy your interviewer! |
|