my changes
[IRC.git] / Robust / src / Benchmarks / Scheduling / GC / NON_BAMBOO / tsp / TestRunner.p
1 package tsp;
2
3 //import java.io.*;
4
5 /**
6  * A Java implementation of the <tt>tsp</tt> Olden benchmark, the traveling
7  * salesman problem.
8  * <p>
9  * <cite>
10  * R. Karp, "Probabilistic analysis of partitioning algorithms for the 
11  * traveling-salesman problem in the plane."  Mathematics of Operations Research 
12  * 2(3):209-224, August 1977
13  * </cite>
14  **/
15 public class TestRunner extends Thread
16 {
17
18   /**
19    * Number of cities in the problem.
20    **/
21   public int cities;
22   /**
23    * Set to true if the result should be printed
24    **/
25   //private static boolean printResult = false;
26   /**
27    * Set to true to print informative messages
28    **/
29   //private static boolean printMsgs = false;
30
31   public TestRunner(int cities) {
32     this.cities = cities;
33   }
34
35   /**
36    * The main routine which creates a tree and traverses it.
37    * @param args the arguments to the program
38    **/
39   public void run()
40   {
41     /*parseCmdLine(args);
42
43     if (printMsgs)
44       System.out.println("Building tree of size " + cities);
45
46     long start0 = System.currentTimeMillis();*/
47     Tree_tsp  t = Tree_tsp.buildTree(this.cities, false, 0.0f, 1.0f, 0.0f, 1.0f);
48     /*long end0 = System.currentTimeMillis();
49
50     long start1 = System.currentTimeMillis();*/
51     t.tsp(150);
52     /*long end1 = System.currentTimeMillis();
53
54     if (printResult) {
55       // if the user specifies, print the final result
56       t.printVisitOrder();
57     }
58
59     if (printMsgs) {
60       System.out.println("Tsp build time  " + (end0 - start0)/1000.0);
61       System.out.println("Tsp time " + (end1 - start1)/1000.0);
62       System.out.println("Tsp total time " + (end1 - start0)/1000.0);
63     }
64     System.out.println("Done!");*/
65   }
66
67   /**
68    * Parse the command line options.
69    * @param args the command line options.
70    **/
71   /*private static final void parseCmdLine(String args[])
72   {
73     int i = 0;
74     String arg;
75
76     while (i < args.length && args[i].startsWith("-")) {
77       arg = args[i++];
78
79       if (arg.equals("-c")) {
80         if (i < args.length)
81           cities = new Integer(args[i++]).intValue();
82         else throw new Error("-c requires the size of tree");
83       } else if (arg.equals("-p")) {
84         printResult = true;
85       } else if (arg.equals("-m")) {
86         printMsgs = true;
87       } else if (arg.equals("-h")) {
88         usage();
89       }
90     }
91     if (cities == 0) usage();
92   }*/
93
94   /**
95    * The usage routine which describes the program options.
96    **/
97   /*private static final void usage()
98   {
99     System.err.println("usage: java TSP -c <num> [-p] [-m] [-h]");
100     System.err.println("    -c number of cities (rounds up to the next power of 2 minus 1)");
101     System.err.println("    -p (print the final result)");
102     System.err.println("    -m (print informative messages)");
103     System.err.println("    -h (print this message)");
104     System.exit(0);
105   }*/
106   public static void main(String[] args) {
107     int threadnum = THREADNUM;
108     int ncities = 4080*2;
109     System.setgcprofileflag();
110     for(int i = 0; i < threadnum; ++i) {
111       TestRunner tr = new TestRunner(ncities);
112       tr.start();
113     }
114   }
115 }
116