-
Notifications
You must be signed in to change notification settings - Fork 0
/
AntColonyOptimization.java
43 lines (37 loc) · 1.13 KB
/
AntColonyOptimization.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.System.exit;
import java.util.logging.Level;
import java.util.logging.Logger;
public class AntColonyOptimization
{
public static void main(String[] args)
{
Graph grp = new Graph();
grp.buildGraph();
grp.print_Graph();
System.out.print("\n"+"Enter name of starting node: ");
InputStreamReader r=new InputStreamReader(System.in);
BufferedReader br1 = new BufferedReader(r);
try
{
grp.setStart(br1.readLine());
}
catch (IOException ex)
{
Logger.getLogger(Graph.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.print("\n"+"Enter name of ending node: ");
try
{
grp.setEnd(br1.readLine());
}
catch (IOException ex)
{
Logger.getLogger(Graph.class.getName()).log(Level.SEVERE, null, ex);
}
ShortestACO aco = new ShortestACO(grp);
aco.start();
}
}