Skip to content

Commit dec93dc

Browse files
author
A. Wilke
committed
tests. success.
1 parent 025c638 commit dec93dc

File tree

3 files changed

+81
-2
lines changed

3 files changed

+81
-2
lines changed

src/de/adrianwilke/acotspjava/AcoTsp.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ public static void main(String[] args) {
541541
* (SIDE)EFFECTS: none
542542
* COMMENTS: this function controls the run of "max_tries" independent trials
543543
*/
544-
544+
for(String argument : args){
545+
System.out.println(argument);
546+
}
545547
Timer.start_timers();
546548

547549
InOut.init_program(args);

src/de/adrianwilke/acotspjava/Parse.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ public OptComparator() {
7676

7777
@Override
7878
public int compare(Option o1, Option o2) {
79-
return (opt.get(o1.getOpt()) - opt.get(o2.getOpt()));
79+
if (o1.getValue() == null || o2.getValue() == null)
80+
return 0;
81+
else
82+
return (opt.get(o1.getOpt()) - opt.get(o2.getOpt()));
8083
}
8184
}
8285

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package de.adrianwilke.acotspjava.test;
2+
3+
import java.util.LinkedList;
4+
import java.util.List;
5+
6+
import de.adrianwilke.acotspjava.AcoTsp;
7+
8+
public class Test {
9+
10+
private static final String TEST_FILE = "tsp/d1291.tsp";
11+
12+
private static List<String> argList = new LinkedList<String>();
13+
14+
public static void main(String[] args) {
15+
16+
// System.out.println(new File("").getAbsolutePath());
17+
18+
// argList.add("-h");
19+
20+
putTestParameters();
21+
argList.add("-l");
22+
argList.add("0");
23+
24+
// ./AcoTsp --ants 20 --time 2 --tours 2 --tries 2 -i ../../d1291.tsp -l 0 --as
25+
26+
// Comments: ACOTSP, ACOTSPJava
27+
28+
argList.add("--as");
29+
// -l 0: 62571,67053
30+
// -l 1: 52842,53925
31+
// -l 2: 52547,53464
32+
// -l 3: 51759,52609
33+
34+
// argList.add("--eas");
35+
// -l 0: 84079,90539
36+
// -l 3: 51524,52335
37+
38+
// argList.add("--ras");
39+
// -l 0: 68201,78482
40+
// -l 3: 51401,51890
41+
42+
// argList.add("--mmas");
43+
// -l 0: 97732,98702
44+
// -l 3: 52179,52698
45+
46+
// argList.add("--bwas");
47+
// -l 0:92378,94083
48+
// -l 3:51076,52068
49+
50+
// argList.add("--acs");
51+
// -l 0:61881,63012
52+
// -l 3:50962,51401
53+
54+
AcoTsp.main(argList.toArray(new String[0]));
55+
}
56+
57+
private static void putTestParameters() {
58+
argList.add("--ants");
59+
argList.add("20");
60+
61+
argList.add("--time");
62+
argList.add("2");
63+
64+
argList.add("--tours");
65+
argList.add("2");
66+
67+
argList.add("--tries");
68+
argList.add("2");
69+
70+
argList.add("-i");
71+
argList.add(TEST_FILE);
72+
}
73+
74+
}

0 commit comments

Comments
 (0)