-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerSetupKF.m
134 lines (115 loc) · 3.77 KB
/
dockerSetupKF.m
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
function dockerSetupKF()
%go to koopman falsification home folder
cdr = pwd; %current folder
filePath = which('setupKF'); %filepath
[kfFolder, ~, ~] = fileparts(filePath);
cd(kfFolder);
% add to path and remove archive and hacky cora files
warning('off')
addpath(genpath(kfFolder))
rmpath(fullfile('external','CORA'))
rmpath(genpath('archive'))
warning('on')
%check installed toolbox
%code taken from CORA installation.
auxInstallToolbox('Symbolic Math Toolbox');
%setup Breach and CORA
InitBreach()
setupBreach()
setupCora()
%setup mpt
mpt_init
%add gurobi to path
addpath(genpath('/opt/gurobi/linux64/matlab'));
% run setup
gurobi_setup
%setup staliro
setupStaliro()
%go back to base folder
cd(cdr);
%save modified path
savepath;
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -')
disp('Koopman Falsification Successfully Setup!')
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -')
disp('proceeding to run experiments...')
disp('- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -')
end
% -------------------------- Auxiliary Functions --------------------------
function res = auxInstallToolbox(text)
res = auxTestToolboxInstallation(text);
while ~res
auxDisplayInstallPrompt(text);
res = auxTestToolboxInstallation(text);
end
end
function res = auxTestToolboxInstallation(text)
res = any(any(contains(struct2cell(ver),text)));
end
function auxDisplayInstallPrompt(text)
error(['''<strong>%s</strong>'' is missing and requires manual installation. \n' ...
' Please install it via the MATLAB Add-On Explorer. \n'], text)
end
function setupBreach()
%remove conflicting breach files from path
filePath = which('InitBreach');
[breachFolder, ~, ~] = fileparts(filePath);
warning('off', 'MATLAB:rmpath:DirNotFound');
rmpath(genpath(fullfile(breachFolder, 'Ext')))
rmpath(genpath(fullfile(breachFolder, 'Examples')))
rmpath(genpath(fullfile(breachFolder, 'Online')))
warning('on', 'MATLAB:rmpath:DirNotFound');
end
function setupCora()
filePath = which('stl'); %cora stl filepath
[coraStlFolder,~,~] = fileparts(filePath);
%replace CORA stl files to add string representation and abs function
sourceFolder = fullfile('external','CORA');
destinationFolder = coraStlFolder;
files = '*.m'; % all m files
% Construct the full paths for the source and destination files
sourceFiles = fullfile(sourceFolder, files);
% Move the files with the option to overwrite existing files
[success,message]=copyfile(sourceFiles, destinationFolder, 'f');
assert(success, ['File copy failed with message ' message]);
%remove CORA modification files from path
if contains(path, sourceFolder)
rmpath(sourceFolder)
end
end
function setupStaliro()
%remove conflicting breach files from path
filePath = which('setup_staliro');
[staliroFolder, ~, ~] = fileparts(filePath);
cd(staliroFolder)
skip_mex=0;
path_var=pwd;
addpath(path_var);
addpath([path_var,'/ha_robust_tester']);
addpath([path_var,'/Distances']);
addpath([path_var,'/auxiliary']);
addpath([path_var,'/optimization']);
addpath([path_var,'/optimization/auxiliary']);
addpath([path_var,'/optimization/auxiliary/Global_Kriging']);
addpath([path_var,'/LocalDescent']);
addpath([path_var,'/signal_interpolation']);
addpath([path_var,'/auxiliary/Singleton']);
if exist([path_var,'/matlab_bgl'],'dir')==7
addpath([path_var,'/matlab_bgl']);
end
cd('Polarity')
setup_polarity(skip_mex)
cd('..')
disp(' ')
cd('dp_taliro')
setup_dp_taliro(skip_mex)
cd('..')
disp(' ')
warning('off', 'MATLAB:rmpath:DirNotFound');
rmpath(genpath(fullfile(staliroFolder, 'BayesianSMC')))
rmpath(genpath(fullfile(staliroFolder, 'benchmarks')))
rmpath(genpath(fullfile(staliroFolder, 'CaseStudies')))
rmpath(genpath(fullfile(staliroFolder, 'demoCreator')))
rmpath(genpath(fullfile(staliroFolder, 'demos')))
warning('on', 'MATLAB:rmpath:DirNotFound');
end