-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRLShortestPath.cpp
More file actions
40 lines (31 loc) · 869 Bytes
/
RLShortestPath.cpp
File metadata and controls
40 lines (31 loc) · 869 Bytes
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
#include <iostream>
#include "RLShortestPath.h"
using namespace RL;
int main()
{
const uint32_t ITERATIONS = 700;
const size_t GRAPHS_MATRIX_SIZE = 9;
const size_t REWARD_MATRIX_SIZE = 9;
const size_t QLEARN_MATRIX_SIZE = 9;
const uint32_t GOAL_NODE = 7;
const double GAMMA = 0.8f;
RLShortestPath rlShortestPath(GRAPHS_MATRIX_SIZE, REWARD_MATRIX_SIZE, QLEARN_MATRIX_SIZE, GOAL_NODE, GAMMA);
ArrayEdge edges = {
createEdge(0, 2),
createEdge(0, 1),
createEdge(0, 3),
createEdge(2, 4),
createEdge(5, 6),
createEdge(7, 4),
createEdge(0, 6),
createEdge(5, 3),
createEdge(3, 7),
createEdge(0, 8)
};
rlShortestPath.addEdges(edges);
rlShortestPath.printGraphNodes();
rlShortestPath.learn(ITERATIONS);
ArrayInt steps = rlShortestPath.solve();
rlShortestPath.printArrayDebug(steps);
return 0;
}