I have implemented both the Nearest Insertion Heuristic and the Smallest Insertion Heuristic. However, I want to develop a way to manage the nodes by brute force to find the best possible tour. So there will be n! different paths to be traversed.
What is a good way to move nodes around to get all the possibilities? I know I could reduce this to (n-1)! ways pretty easily, but brute force goes through EVERY possibility. Any good ideas on moving nodes around for this case (including the first node)?
My nodes are defined as follows:
Code: Select all
private Node first;
private static class Node {
private Point p;
private Node next;
}
Could I use brute force with this definition, or would I need a doubly-linked list?