forked from timlandvoigt/FinRegModernBanking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_run_exper.m
74 lines (54 loc) · 1.44 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
if ~exist('clear_flag', 'var'), clear_flag = 1; end
if usejava('desktop') && clear_flag
clear;
end
close all;
% ===========================================
% program control
% ===========================================
% path to file with experiment definition
if ~exist('exper_path','var')
exper_path='env_base.mat';
end
if ~exist('maxit','var')
maxit=10;
end
if ~exist('tol_avg','var')
% mean convergence
tol_avg=1e-5;
end
if ~exist('localpool','var')
% local cluster profile for parpool?
localpool=true;
end
if ~exist('no_par_processes','var')
% local cluster profile for parpool?
no_par_processes=4;
end
open_parpool;
% print mode
printmode=1;
% ===========================================
% load environment structure
% ===========================================
load(exper_path);
% ===========================================
% outer convergence loop
% ===========================================
% policy iteration
mobj=mobj.polIter(maxit,1,printmode,tol_avg);
% ===========================================
% results
% ===========================================
% 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');