-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
97 lines (74 loc) · 2.11 KB
/
main.cpp
File metadata and controls
97 lines (74 loc) · 2.11 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <iostream>
#include "class_node.h"
#include "class_map.h"
#include "class_AStar.h"
#include "uniformCost.cpp"
#include "breadthfirst.cpp"
#include "greedyBestFirst.cpp"
//int main(int argc, char** argv){
int main(){
/*
pfNode n1(1) ;
pfNode n2(2);
pfNode n3(3);
std::cout << n1.GetTypeName() << std::endl ;
std::cout << n2.GetTypeName() << std::endl ;
std::cout << n3.GetTypeName() << std::endl ;
*/
/*
pfMap map1(50,20); // create map on stack
map1.PrintMap(); // print the map to the console
map1.GetNodeAt(3,3)->SetStart() ; // change something
pfMap* map2 = new pfMap(30,30); // create another map on the heap
map2->PrintMap(); // print this one
std::cout << map2->GetNodeAt(4,3)->GetWeight() << std::endl ; // print weight of a node
pfMap map3(*map2); // make a copy of map2
map3.PrintMap(); // print the copy
pfMap map4(map1); // create a copy of map1
delete map2 ; // delete map from the heap
*/
/*
int n = 50;
pfMap map1(n,n,0);
map1.SetTypeAt(2,2,4);
map1.SetTypeAt(n-3,n-3,5);
map1.PrintMap();
auto flow = Breadthfirst(map1);
bfDrawPath(flow,map1);
map1.PrintMap();
*/
pfMap* map2 = pfMap::LoadMap("maps/map1.csv") ;
/*
int n = 50;
pfMap* map1 = new pfMap(n,n);
map1->SetTypeAt(2,2,4);
map1->SetTypeAt(n-3,n-3,5);
map1->PrintMap();
*/
pfMap* map3 = new pfMap(*map2) ;
std::cout << "starting Breadthfirst" << '\n';
Breadthfirst(*map3, true) ;
map3->PrintMap();
delete map3 ;
//map5->PrintMap();
pfMap* map5 = new pfMap(*map2) ;
std::cout << "starting greedyBestFirst" << '\n';
auto flow = GreedyBestFirst(*map5);
ucDrawPath(flow,*map5) ;
map5->PrintMap();
//map5->PrintMap();
delete map5 ;
/*
pfMap* map2 = new pfMap(*map1) ;
// test uniformCost algorithm
pfMap* map1_b = pfMap::LoadMap("maps/map1_b.csv");
std::cout << "starting uniformCost" << '\n';
auto ucHistory = uniformCost(*map1_b,0,1);
ucDrawPath(ucHistory, *map1_b);
map1_b->PrintMap();
delete map2;
*/
// delete map(s) created on heap
delete map2;
return 0;
}