-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain_run_exper.m
95 lines (73 loc) · 1.8 KB
/
main_run_exper.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
function mobj=main_run_exper(varargin)
if nargin>0
exper_path=varargin{1};
maxit=varargin{2};
outname=varargin{3};
if nargin>3
checkTrans=varargin{4};
if nargin>4
tol_avg=varargin{5};
if nargin>5
no_par_processes=varargin{6};
if nargin>6
printmode=varargin{7};
damp=varargin{8};
end
end
end
end
end
% ===========================================
% program control
% ===========================================
% path to file with experiment definition
if ~exist('exper_path','var')
% exper_path='env_bench.mat';
exper_path='env_lowratefinal.mat';
end
if ~exist('no_par_processes','var')
% exper_path='env_bench.mat';
no_par_processes=2;
end
if ~exist('maxit','var')
maxit =100;
end
if ~exist('tol_avg','var')
% mean convergence
tol_avg=1e-5;
end
if ~exist('printmode','var')
% print mode
printmode=1;
end
if ~exist('checkTrans','var')
% print mode
checkTrans=0;
end
if ~exist('damp','var')
% dampening
damp=0.5;
end
open_parpool;
% ===========================================
% load environment structure
% ===========================================
load(exper_path);
% ===========================================
% outer convergence loop
% ===========================================
% policy iteration
% polIter is in
[mobj,failedPoints,dist,distT]=mobj.polIter(maxit,1,printmode,damp,tol_avg,checkTrans);
% make date string
curr_date=clock;
date_str='';
for i=1:5
date_str=[date_str,'_',num2str(curr_date(i))];
end
if ~exist('outname','var')
outname=['res',date_str,'.mat'];
end
save(outname,'mobj','stv','failedPoints','dist','distT');
% Close parallel pool
end