-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain_run_exper.m
71 lines (52 loc) · 1.32 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
if ~exist('clear_flag', 'var'), clear_flag = 1; end
if usejava('desktop') && clear_flag
clear;
end
close all;
% ===========================================
% program control
% ===========================================
open_parpool; % HERE
% path to file with experiment definition
if ~exist('exper_path','var')
exper_path='env_bench_ini0.mat';
end
if ~exist('maxit','var')
maxit=150;
end
if ~exist('tol_avg','var')
% mean convergence
tol_avg=1e-5;
end
if ~exist('maxit_VF','var')
% extra VF convergence iterations?
maxit_VF = 100;
end
% print mode
printmode=0;
% dampening
damp=0.5;
% ===========================================
% load environment structure
% ===========================================
load(exper_path);
% ===========================================
% outer convergence loop
% ===========================================
% policy iteration
[mobj,failedPoints,dist,distT]=mobj.polIter(maxit,1,printmode,damp,tol_avg);
if maxit_VF>0
[mobj,distVF,mean_distVF]=mobj.convergeVF(maxit_VF,0,tol_avg);
end
% 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'];
else
outname=[outname,date_str,'.mat'];
end
save(outname,'mobj','stv','failedPoints','dist','distT');