As in the previous article, write the pseudo-code before the exam, fill in the specific explanation and code.
Status {matrix, result set, Nether}
Global result set list, with global upper bound initially infinite
Set up a heap, store state, and heap rules to have the smallest lower bound.
Using the reduced cost matrix to simplify the matrix, simplify the reduction of consumption as the lower bound, adding the initial state to the heap
When the heap is not empty
{
POPs a state from the heap and assigns a value to two temporary states.
If the lower bound of the state is greater than or equal to the global upper bound, return
Traverse all arcs, select Delete to cause the upper bound to rise to the maximum arc
If you use the arc
{
Update Nether
If you have traversed all cities and returned to the starting point and less than or equal to the global upper bound, record the state and update the global upper bounds
Otherwise, the entire row and the entire column corresponding to the arc are assigned a value of infinite, the inverse arc of the current arc is assigned a value of infinite, the arc is recorded in the result set, and the state is added to the heap
}
Otherwise, the arc is assigned a value of infinite in the matrix, the lower bound is updated, and the state is added to the heap
}
Traveling salesman problem based on branch-bound method (TSP) Two