-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsafe.cpp
More file actions
53 lines (38 loc) · 1.25 KB
/
safe.cpp
File metadata and controls
53 lines (38 loc) · 1.25 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
// Run: make
// ./safe
// Created by Ben Wooding 8 Jan 2024
#include <iostream>
#include <vector>
#include <functional>
#include "../../src/IMDP.h"
#include <chrono>
#include <armadillo>
using namespace std;
using namespace arma;
/*
################################# PARAMETERS ###############################################
*/
// Set the dimensions
const int dim_x = 2;
const int dim_u = 0;
const int dim_w = 0;
/*
################################# MAIN FUNCTION ##############################################
*/
int main() {
/* ###### create IMDP object ###### */
IMDP mdp(dim_x,dim_u,dim_w);
/*###### load the files ######*/
mdp.loadStateSpace("ss.h5");
mdp.loadMinAvoidTransitionVector("minatm.h5");
mdp.loadMaxAvoidTransitionVector("maxatm.h5");
mdp.loadMinTransitionMatrix("mintm.h5");
mdp.loadMaxTransitionMatrix("maxtm.h5");
/*###### Run over infinite horizon, absorbing state so the two bounds will not converge ######*/
mdp.infiniteHorizonSafeController(true);
/*###### Take steps given from previous function to get convergent solution ######*/
mdp.finiteHorizonSafeController(true,67);
/*###### Save the controller ######*/
mdp.saveController();
return 0;
}