Traveling salesman problem based on branch-bound method (TSP) Two

Source: Internet
Author: User

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

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.