make the PheromoneStrategy object abstract
[aco.git] / AntMain.java
blobff55c46627af8863dbdb9d81309f11903877373a
1 import java.io.IOException;
3 class AntMain {
5 public static void main(String[] args) {
6 try {
8 Graph graph;
9 Environment env;
10 int iterations = 0, guisize = 0;
12 try {
13 iterations = Integer.parseInt(args[0]);
14 } catch (Exception e) {
15 System.exit(1);
18 if (args.length == 2) {
19 try {
20 guisize = Integer.parseInt(args[1]);
21 } catch (Exception e) { }
23 if (guisize == 0) {
24 graph = new Graph(args[1]);
25 } else {
26 graph = Graph.sampleGraph();
28 env = new Environment(iterations, graph);
30 env.run();
31 } else if (args.length == 3) {
33 guisize = Integer.parseInt(args[1]);
34 graph = new Graph(args[2]);
35 env = new Environment(iterations, guisize, graph);
37 env.run();
38 } else {
39 System.exit(1);
42 System.out.print("Computation finished..");
43 /* wait for a keypress before exit */
44 System.in.read();
46 } catch (IOException e) {
47 System.out.println(e.toString() + "(" + e.getClass() + "): " + e);
50 System.exit(0);