rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
adaptive_basisgen_admos2007.m
Go to the documentation of this file.
1 % script for generating the MCMDS basis generation images
2 
3 % Bernard Haasdonk 22.2.2010
4 
5 % a adaptive training set extension:
6 step = 1; % generate different bases
7 % step = 2; % generate images overfitting*_small.eps
8 % step = 3; % generate diagrams of training runtimes and errors
9 % step = 4; % generate diagrams of test errors and error ratios
10 % step = 5; % generate diagrams of max test errors
11 
12 switch step
13  case 1
14  disp('to be implemented!!');
15  case 2
16  figure;
17  load(['C:\Dokumente und Einstellungen\Bernard\Eigene Dateien\',...
18  'TempMatlab\basisgen\RB_uniform_fixed_64.mat']);
19  params.num_plot_intervals = [40,40];
20  offline_data = rb_offline_prep(detailed_data,params);
21  params.N = size(detailed_data.RB,2);
22  online_data = rb_online_prep(offline_data,params);
23  params.no_lines = 1;
24  plot_error_estimator(online_data,params);
25  c = get(gca,'Children');
26  cdata = get(c(end),'Cdata');
27  cdata = log10(cdata);
28  set(c(end),'Cdata',cdata);
29  set(gca,'Clim',[-8,-7]);
30  title('log_{10}(\Delta(\mu))');
31  colorbar;
32  %colorbar;
33  hold on;
34  par.numintervals = params.RB_numintervals;
35  par.range = params.mu_ranges;
36  par.color = [0,0,0];
37  pgrid = cubegrid(par);
38  plot(pgrid,par);
39  %
40  figure;
41  load(['C:\Dokumente und Einstellungen\Bernard\Eigene Dateien\',...
42  'TempMatlab\basisgen\RB_uniform_refined_2_2_r1.mat']);
43  params.num_plot_intervals = [40,40];
44  offline_data = rb_offline_prep(detailed_data,params);
45  params.N = size(detailed_data.RB,2);
46  online_data = rb_online_prep(offline_data,params);
47  params.no_lines = 1;
48  plot_error_estimator(online_data,params);
49  c = get(gca,'Children');
50  cdata = get(c(end),'Cdata');
51  cdata = log10(cdata);
52  set(c(end),'Cdata',cdata);
53  set(gca,'Clim',[-8,-7]);
54  title('log_{10}(\Delta(\mu))');
55  colorbar;
56  hold on;
57  params.no_lines = 0;
58  params.color = [0,0,0];
59  plot(detailed_data.RB_info.MMesh_list{end},params);
60  %CLIM : 2.07876e-008 7.30869e-008
61  %
62  figure;
63  load(['C:\Dokumente und Einstellungen\Bernard\Eigene Dateien\',...
64  'TempMatlab\basisgen\RB_adaptive_refined_2_2_r1_smax1000.mat']);
65  params.num_plot_intervals = [40,40];
66  offline_data = rb_offline_prep(detailed_data,params);
67  params.N = size(detailed_data.RB,2);
68  online_data = rb_online_prep(offline_data,params);
69  params.no_lines = 1;
70  plot_error_estimator(online_data,params);
71  c = get(gca,'Children');
72  cdata = get(c(end),'Cdata');
73  cdata = log10(cdata);
74  set(c(end),'Cdata',cdata);
75  set(gca,'Clim',[-8,-7]);
76  title('log_{10}(\Delta(\mu))');
77  colorbar;
78  hold on;
79  params.no_lines = 0;
80  params.color = [0,0,0];
81  plot(detailed_data.RB_info.MMesh_list{end},params);
82 
83  case 3 % runtime diagrams
84 
85  %%%%% run basisgen_main with the following settings in the header:
86  %
87  %test_RB_methods = {...
88  % 'RB_uniform_refined_2_2_r1',...
89  % 'RB_uniform_refined_2_2_r5',...
90  % 'RB_uniform_fixed_64',...
91  % 'RB_uniform_fixed_256',...
92  % 'RB_uniform_refined_2_2_r1',...
93  % 'RB_uniform_refined_2_2_r5',...
94  % 'RB_adaptive_refined_2_2_r1_smax1000_theta5e-2',...
95  % 'RB_adaptive_refined_2_2_r5_smax1000_theta5e-2',...
96  % 'RB_adaptive_refined_2_2_r1_smax1000_theta1e-1',...
97  % 'RB_adaptive_refined_2_2_r5_smax1000_theta1e-1',...
98  % };
99  % test_RB_indicators = {'estimator'}; % only estimators
100  % compute_RB_methods = test_RB_methods;
101 
102  %%%%%% then perform the following on the generated files for getting
103  %%%%%% the figures
104 
105  %fns = {...
106  % 'RB_uniform_refined_2_2_r1_tested',...
107  % 'RB_uniform_fixed_256_tested',...
108  % 'RB_adaptive_refined_2_2_r1_smax1000_theta5e-2_tested'};
109 
110 
111  % uniform-refined approaches nur bis t=3600:
112  fns = {'RB_uniform_refined_p3_i2_r1_tested',...
113  'RB_uniform_refined_p3_i3_r1_tested',...
114  'RB_adaptive_refined_p3_i2_r1_smax1000_theta5e-2_tested',...
115  'RB_adaptive_refined_p3_i3_r1_smax1000_theta5e-2_tested',...
116  'RB_uniform_fixed_p3_64_tested',...
117  'RB_uniform_fixed_p3_125_tested',...
118  };
119 
120  params.plot_train_times = 1;
121  params.plot_train_estimators = 0;
122  params.plot_test_estimators = 0;
123  params.plot_test_errors = 0;
124  params.plot_linestyles = {'-','-.','-','-.','-','-.'};
125  params.plot_linecolors = {'r','r',[0,0.6,0],[0,0.6,0],'b','b'};
126  params.plot_linewidths = [2,2,2,2,2,2];
127  params.plot_legends_location = 'Northwest';
128  params.plot_legends = {'uniform-refined 2^3',...
129  'uniform-refined 3^3',...
130  'adaptive-refined 2^3',...
131  'adaptive-refined 3^3',...
132  'uniform-fixed 4^3',...
133  'uniform-fixed 5^3'};
134 
135  plot_basisgen_results(fns,params);
136 
137  % uniform-refined approaches jetzt ohne timeout:
138  fns = {'RB_uniform_refined_p3_i2_r1_notimeout_tested',...
139  'RB_uniform_refined_p3_i3_r1_notimeout_tested',...
140  'RB_adaptive_refined_p3_i2_r1_smax1000_theta5e-2_tested',...
141  'RB_adaptive_refined_p3_i3_r1_smax1000_theta5e-2_notimeout_tested',...
142  'RB_uniform_fixed_p3_64_tested',...
143  'RB_uniform_fixed_p3_125_tested'};
144  %'RB_uniform_fixed_p3_216_notimeout_tested',...
145 
146  params.plot_train_times = 0;
147  params.plot_train_estimators = 1;
148  params.plot_test_estimators = 0;
149  params.plot_test_errors = 0;
150  params.plot_legends_location = 'NorthEast';
151  plot_basisgen_results(fns,params);
152 
153  % => Speichern der Bilder als
154  % computation_times.eps und
155  % train_errors.eps
156 
157  case 4:
158 
159  %%%%% run basisgen_main with the following settings in the header:
160  %
161  %test_RB_methods = {...
162  % 'RB_uniform_refined_2_2_r1',...
163  % 'RB_uniform_refined_2_2_r5',...
164  % 'RB_uniform_fixed_64',...
165  % 'RB_uniform_fixed_256',...
166  % 'RB_uniform_refined_2_2_r1',...
167  % 'RB_uniform_refined_2_2_r5',...
168  % 'RB_adaptive_refined_2_2_r1_smax1000_theta5e-2',...
169  % 'RB_adaptive_refined_2_2_r5_smax1000_theta5e-2',...
170  % 'RB_adaptive_refined_2_2_r1_smax1000_theta1e-1',...
171  % 'RB_adaptive_refined_2_2_r5_smax1000_theta1e-1',...
172  % };
173  % test_RB_indicators = {'estimator'}; % only estimators
174  % compute_RB_methods = test_RB_methods;
175 
176  %%%%%% then perform the following on the generated files for getting
177  %%%%%% the figures
178 
179  %fns = {...
180  % 'RB_uniform_refined_2_2_r1_tested',...
181  % 'RB_uniform_fixed_256_tested',...
182  % 'RB_adaptive_refined_2_2_r1_smax1000_theta5e-2_tested'};
183 
184  % uniform-refined approaches jetzt ohne timeout:
185  fns = {'RB_uniform_refined_p3_i2_r1_notimeout_tested',...
186  'RB_uniform_refined_p3_i3_r1_notimeout_tested',...
187  'RB_adaptive_refined_p3_i2_r1_smax1000_theta5e-2_tested',...
188  'RB_adaptive_refined_p3_i3_r1_smax1000_theta5e-2_notimeout_tested',...
189  'RB_uniform_fixed_p3_64_tested',...
190  'RB_uniform_fixed_p3_125_tested'};
191  %'RB_uniform_fixed_p3_216_notimeout_tested',...
192 
193  params.plot_train_times = 0;
194  params.plot_train_estimators = 0;
195  params.plot_test_estimators = 1;
196  params.plot_test_errors = 1;
197  params.plot_linestyles = {'-','-.','-','-.','-','-.'};
198  params.plot_linecolors = {'r','r',[0,0.6,0],[0,0.6,0],'b','b'};
199  params.plot_linewidths = [2,2,2,2,2,2];
200  params.plot_legends_location = 'North';
201  params.plot_legends = {'uniform-refined 2^3',...
202  'uniform-refined 3^3',...
203  'adaptive-refined 2^3',...
204  'adaptive-refined 3^3',...
205  'uniform-fixed 4^3',...
206  'uniform-fixed 5^3'};
207 
208  plot_basisgen_results(fns,params);
209  close(gcf-1);
210  close(gcf);
211 
212  params.plot_legends_location = 'NorthWest';
213  plot_basisgen_results(fns,params);
214  close(gcf-2);
215  close(gcf-1);
216 
217  % => Manuelles Speichern der Bilder als
218  % test_errors.eps und
219  % test_error_ratio.eps
220 
221  case 5:
222 
223  fns = {'RB_uniform_refined_p3_i2_r1_notimeout_tested',...
224  'RB_uniform_refined_p3_i3_r1_notimeout_tested',...
225  'RB_adaptive_refined_p3_i2_r1_smax1000_theta5e-2_tested',...
226  'RB_adaptive_refined_p3_i3_r1_smax1000_theta5e-2_notimeout_tested',...
227  'RB_uniform_fixed_p3_64_tested',...
228  'RB_uniform_fixed_p3_125_tested'};
229  %'RB_uniform_fixed_p3_216_notimeout_tested',...
230 
231  params.plot_train_times = 0;
232  params.plot_train_estimators = 0;
233  params.plot_test_estimators = 1;
234  params.plot_test_errors = 0;
235  params.plot_max_test_vs_time = 1;
236  params.plot_linestyles = {'-','-.','-','-.','-','-.'};
237  params.plot_linecolors = {'r','r',[0,0.6,0],[0,0.6,0],'b','b'};
238  params.plot_linewidths = [2,2,2,2,2,2];
239  params.plot_legends_location = 'NorthEast';
240  params.plot_legends = {'uniform-refined 2^3',...
241  'uniform-refined 3^3',...
242  'adaptive-refined 2^3',...
243  'adaptive-refined 3^3',...
244  'uniform-fixed 4^3',...
245  'uniform-fixed 5^3'};
246 
247  plot_basisgen_results(fns,params);
248  close(gcf-3);
249  close(gcf-2);
250  close(gcf-1);
251  set(gca,'Xlim',[0,3600]);
252  set(gca,'Ylim',[1e-7,2e-4]);
253 
254 end;