Branch and Bound Implementations of the Traveling Salesperson Problem - Part 4: Distributed processing solution using RMI
暂无分享,去创建一个
The multi-threaded implementation presented in the previous column (July/August, 2003) sets the stage for the distributed processing implementation to be presented in this column. Please see the previous two columns for the details regarding the TSP best-first branch and bound algorithm that forms the basis for the work that shall be described in this column. Class Node is unchanged from the single and multi-threaded implementation presented in Part 2 of this series. Before the mechanics (RMI in this case) of distributed processing can be deployed the algorithm must be setup to support parallel computation. This was accomplished during the multi-threaded design and implementation presented in the previous column. Recall that threads were spawned from an instance of class TSP after all the nodes at level 2 were generated. These nodes represent partial tours of size 2 (e. The nodes were inserted into a priority queue implemented using Java's standard collection class TreeSet. These nodes are prioritized in the TreeSet according to the value of their computed lower bound (ties being resolved by the sum of the cities in the tour – see the previous column for details). Instead of spawning threads and handing each thread one of the level 2 nodes, we define class TSP as the server and allow clients, defined by the revised class ProcessNodes (previously the thread class) to request nodes from the server. These nodes are handed off to the requesting clients until no more nodes are left.