-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.rb
More file actions
62 lines (56 loc) · 1.33 KB
/
Copy pathinit.rb
File metadata and controls
62 lines (56 loc) · 1.33 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
require_relative "problem"
require_relative "search"
print "\n\n"
print "--- problem 1 --- \n"
problem1 = Problem.new(3, 0, 8)
agent1 = SearchAgent.new(problem1)
print "bfs node expansion: "
print agent1.solve("bfs")
print "\n"
print "djk map: "
print agent1.solve("djk")
print "\n"
print "nearest neighbor: "
print agent1.solve("tour")
print "\n"
print "nearest neighbor w/ heuristic: "
print agent1.solve("cust")
print "\n"
print "minimum spanning tree: "
print agent1.solve("krus")
print "\n\n"
print "--- problem 2 --- \n"
problem2 = Problem.new(4, 0, 15)
agent2 = SearchAgent.new(problem2)
print "bfs node expansion: "
print agent2.solve("bfs")
print "\n"
print "djk map: "
print agent2.solve("djk")
print "\n"
print "nearest neighbor: "
print agent2.solve("tour")
print "\n"
print "nearest neighbor w/ heuristic: "
print agent2.solve("cust")
print "\n"
print "minimum spanning tree: "
print agent2.solve("krus")
print "\n\n"
print "--- problem 3 --- \n"
problem3 = Problem.new(5, 0, 24)
agent3 = SearchAgent.new(problem3)
print "bfs node expansion: "
print agent3.solve("bfs")
print "\n"
print "djk map: "
print agent3.solve("djk")
print "\n"
print "nearest neighbor: "
print agent3.solve("tour")
print "\n"
print "nearest neighbor w/ heuristic: "
print agent3.solve("cust")
print "\n"
print "minimum spanning tree: "
print agent3.solve("krus")