time | Calls | line |
---|
| | 7 | function result_map = ff_abz_vf_vecsv(varargin)
|
| | 8 | %% FF_ABZ_VF_VECSV solve infinite horizon exo shock + endo asset problem
|
| | 9 | % This program solves the infinite horizon dynamic single asset and two
|
| | 10 | % shocks problem with vectorized codes.
|
| | 11 | % <https://fanwangecon.github.io/CodeDynaAsset/m_abz/solve/html/ff_abz_vf.html
|
| | 12 | % ff_abz_vf> shows looped codes.
|
| | 13 | % <https://fanwangecon.github.io/CodeDynaAsset/m_abz/solve/html/ff_abz_vf_vec.html
|
| | 14 | % ff_abz_vf_vec> shows vectorized codes. This file shows vectorized codes
|
| | 15 | % that is faster but is more memory intensive.
|
| | 16 | %
|
| | 17 | % The borrowing problem is similar to the savings problem. The main
|
| | 18 | % addition here in comparison to the savings only code
|
| | 19 | % <https://fanwangecon.github.io/CodeDynaAsset/m_az/solve/html/ff_az_vf_vecsv.html
|
| | 20 | % ff_az_vf_vec> is the ability to deal with default, as well as an
|
| | 21 | % additional shock to the borrowing interest rate.
|
| | 22 | %
|
| | 23 | % See
|
| | 24 | % <https://fanwangecon.github.io/CodeDynaAsset/m_abz/solve/html/ff_abz_vf_vec.html
|
| | 25 | % ff_az_vf_vec> how vectorization works within this structure.
|
| | 26 | %
|
| | 27 | % This _optimized-vectorized_ solution method provides very large speed
|
| | 28 | % improvements for this infinite horizon problem because the u(c(z,a,a'))
|
| | 29 | % calculation within each iteration is identical. Generally the idea is to
|
| | 30 | % identify inside iteration whether the model is infinite horizon or
|
| | 31 | % life-cycle based where repeat calculations are taking place. If such
|
| | 32 | % calculations can be identified, then potentially they could be stored and
|
| | 33 | % retrieved during future iterations/periods rather than recomputed every
|
| | 34 | % time. This saves time.
|
| | 35 | %
|
| | 36 | % @param param_map container parameter container
|
| | 37 | %
|
| | 38 | % @param support_map container support container
|
| | 39 | %
|
| | 40 | % @param armt_map container container with states, choices and shocks
|
| | 41 | % grids that are inputs for grid based solution algorithm
|
| | 42 | %
|
| | 43 | % @param func_map container container with function handles for
|
| | 44 | % consumption cash-on-hand etc.
|
| | 45 | %
|
| | 46 | % @return result_map container contains policy function matrix, value
|
| | 47 | % function matrix, iteration results, and policy function, value function
|
| | 48 | % and iteration results tables.
|
| | 49 | %
|
| | 50 | % keys included in result_map:
|
| | 51 | %
|
| | 52 | % * mt_val matrix states_n by shock_n matrix of converged value function grid
|
| | 53 | % * mt_pol_a matrix states_n by shock_n matrix of converged policy function grid
|
| | 54 | % * ar_val_diff_norm array if bl_post = true it_iter_last by 1 val function
|
| | 55 | % difference between iteration
|
| | 56 | % * ar_pol_diff_norm array if bl_post = true it_iter_last by 1 policy
|
| | 57 | % function difference between iterations
|
| | 58 | % * mt_pol_perc_change matrix if bl_post = true it_iter_last by shock_n the
|
| | 59 | % proportion of grid points at which policy function changed between
|
| | 60 | % current and last iteration for each element of shock
|
| | 61 | %
|
| | 62 | % @example
|
| | 63 | %
|
| | 64 | % % Get Default Parameters
|
| | 65 | % it_param_set = 2;
|
| | 66 | % [param_map, support_map] = ffs_abz_set_default_param(it_param_set);
|
| | 67 | % % Chnage param_map keys for borrowing
|
| | 68 | % param_map('fl_b_bd') = -20; % borrow bound
|
| | 69 | % param_map('bl_default') = false; % true if allow for default
|
| | 70 | % param_map('fl_c_min') = 0.0001; % u(c_min) when default
|
| | 71 | % % Change Keys in param_map
|
| | 72 | % param_map('it_a_n') = 500;
|
| | 73 | % param_map('it_z_n') = 11;
|
| | 74 | % param_map('fl_a_max') = 100;
|
| | 75 | % param_map('fl_w') = 1.3;
|
| | 76 | % % Change Keys support_map
|
| | 77 | % support_map('bl_display') = false;
|
| | 78 | % support_map('bl_post') = true;
|
| | 79 | % support_map('bl_display_final') = false;
|
| | 80 | % % Call Program with external parameters that override defaults.
|
| | 81 | % ff_abz_vf_vecsv(param_map, support_map);
|
| | 82 | %
|
| | 83 | % @include
|
| | 84 | %
|
| | 85 | % * <https://fanwangecon.github.io/CodeDynaAsset/m_abz/paramfunc/html/ffs_abz_set_default_param.html ffs_abz_set_default_param>
|
| | 86 | % * <https://fanwangecon.github.io/CodeDynaAsset/m_abz/paramfunc/html/ffs_abz_get_funcgrid.html ffs_abz_get_funcgrid>
|
| | 87 | % * <https://fanwangecon.github.io/CodeDynaAsset/m_az/solvepost/html/ff_az_vf_post.html ff_az_vf_post>
|
| | 88 | %
|
| | 89 | % @seealso
|
| | 90 | %
|
| | 91 | % * save loop: <https://fanwangecon.github.io/CodeDynaAsset/m_az/solve/html/ff_az_vf.html ff_az_vf>
|
| | 92 | % * save vectorized: <https://fanwangecon.github.io/CodeDynaAsset/m_az/solve/html/ff_az_vf_vec.html ff_az_vf_vec>
|
| | 93 | % * save optimized-vectorized: <https://fanwangecon.github.io/CodeDynaAsset/m_az/solve/html/ff_az_vf_vecsv.html ff_az_vf_vecsv>
|
| | 94 | % * save + borr loop: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/solve/html/ff_abz_vf.html ff_abz_vf>
|
| | 95 | % * save + borr vectorized: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/solve/html/ff_abz_vf_vec.html ff_abz_vf_vec>
|
| | 96 | % * save + borr optimized-vectorized: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/solve/html/ff_abz_vf_vecsv.html ff_abz_vf_vecsv>
|
| | 97 | %
|
| | 98 |
|
| | 99 | %% Default
|
| | 100 | %
|
| | 101 | % * it_param_set = 1: quick test
|
| | 102 | % * it_param_set = 2: benchmark run
|
| | 103 | % * it_param_set = 3: benchmark profile
|
| | 104 | % * it_param_set = 4: press publish button
|
| | 105 | %
|
| | 106 |
|
| | 107 | it_param_set = 3;
|
| | 108 | bl_input_override = true;
|
| | 109 | [param_map, support_map] = ffs_abz_set_default_param(it_param_set);
|
| | 110 |
|
| | 111 | % Note: param_map and support_map can be adjusted here or outside to override defaults
|
| | 112 | % param_map('it_a_n') = 750;
|
| | 113 | % param_map('it_z_n') = 15;
|
| | 114 | % param_map('fl_r_save') = 0.025;
|
| | 115 | % param_map('fl_r_borr') = 0.035;
|
| | 116 |
|
| | 117 | [armt_map, func_map] = ffs_abz_get_funcgrid(param_map, support_map, bl_input_override); % 1 for override
|
| | 118 | default_params = {param_map support_map armt_map func_map};
|
| | 119 |
|
| | 120 | %% Parse Parameters 1
|
| | 121 |
|
| | 122 | % if varargin only has param_map and support_map,
|
| | 123 | params_len = length(varargin);
|
| | 124 | [default_params{1:params_len}] = varargin{:};
|
| | 125 | param_map = [param_map; default_params{1}];
|
| | 126 | support_map = [support_map; default_params{2}];
|
| | 127 | if params_len >= 1 && params_len <= 2
|
| | 128 | % If override param_map, re-generate armt and func if they are not
|
| | 129 | % provided
|
| | 130 | bl_input_override = true;
|
| | 131 | [armt_map, func_map] = ffs_abz_get_funcgrid(param_map, support_map, bl_input_override);
|
| | 132 | else
|
| | 133 | % Override all
|
| | 134 | armt_map = [armt_map; default_params{3}];
|
| | 135 | func_map = [func_map; default_params{4}];
|
| | 136 | end
|
| | 137 |
|
| | 138 | % append function name
|
| | 139 | st_func_name = 'ff_abz_vf_vecsv';
|
| | 140 | support_map('st_profile_name_main') = [st_func_name support_map('st_profile_name_main')];
|
| | 141 | support_map('st_mat_name_main') = [st_func_name support_map('st_mat_name_main')];
|
| | 142 | support_map('st_img_name_main') = [st_func_name support_map('st_img_name_main')];
|
| | 143 |
|
| | 144 | %% Parse Parameters 2
|
| | 145 |
|
| | 146 | % armt_map
|
| | 147 | params_group = values(armt_map, {'ar_a', 'mt_z_trans', 'ar_z_r_borr_mesh_wage', 'ar_z_wage_mesh_r_borr'});
|
| | 148 | [ar_a, mt_z_trans, ar_z_r_borr_mesh_wage, ar_z_wage_mesh_r_borr] = params_group{:};
|
| | 149 |
|
| | 150 | % func_map
|
| | 151 | params_group = values(func_map, {'f_util_log', 'f_util_crra', 'f_cons_checkcmin', 'f_coh', 'f_cons_coh'});
|
| | 152 | [f_util_log, f_util_crra, f_cons_checkcmin, f_coh, f_cons_coh] = params_group{:};
|
| | 153 |
|
| | 154 | % param_map
|
| | 155 | params_group = values(param_map, {'it_a_n', 'it_z_n', 'fl_crra', 'fl_beta', 'fl_c_min',...
|
| | 156 | 'fl_nan_replace', 'bl_default', 'fl_default_aprime'});
|
| | 157 | [it_a_n, it_z_n, fl_crra, fl_beta, fl_c_min, ...
|
| | 158 | fl_nan_replace, bl_default, fl_default_aprime] = params_group{:};
|
| | 159 | params_group = values(param_map, {'it_maxiter_val', 'fl_tol_val', 'fl_tol_pol', 'it_tol_pol_nochange'});
|
| | 160 | [it_maxiter_val, fl_tol_val, fl_tol_pol, it_tol_pol_nochange] = params_group{:};
|
| | 161 |
|
| | 162 | % support_map
|
| | 163 | params_group = values(support_map, {'bl_profile', 'st_profile_path', ...
|
| | 164 | 'st_profile_prefix', 'st_profile_name_main', 'st_profile_suffix',...
|
| | 165 | 'bl_time', 'bl_display', 'it_display_every', 'bl_post'});
|
| | 166 | [bl_profile, st_profile_path, ...
|
| | 167 | st_profile_prefix, st_profile_name_main, st_profile_suffix, ...
|
| | 168 | bl_time, bl_display, it_display_every, bl_post] = params_group{:};
|
| | 169 |
|
| | 170 | %% Initialize Output Matrixes
|
| | 171 | % include mt_pol_idx which we did not have in looped code
|
| | 172 |
|
| | 173 | mt_val_cur = zeros(it_a_n, it_z_n);
|
| | 174 | mt_val = mt_val_cur - 1;
|
| | 175 | mt_pol_a = zeros(it_a_n, it_z_n);
|
| | 176 | mt_pol_a_cur = mt_pol_a - 1;
|
| | 177 | mt_pol_idx = zeros(it_a_n, it_z_n);
|
| | 178 |
|
| | 179 | % We did not need these in ff_abz_vf or ff_abz_vf_vec
|
| | 180 | % see
|
| | 181 | % <https://fanwangecon.github.io/M4Econ/support/speed/partupdate/fs_u_c_partrepeat_main.html
|
| | 182 | % fs_u_c_partrepeat_main> for why store using cells.
|
| | 183 | cl_u_c_store = cell([it_z_n, 1]);
|
| | 184 | cl_c_valid_idx = cell([it_z_n, 1]);
|
| | 185 |
|
| | 186 | %% Initialize Convergence Conditions
|
| | 187 |
|
| | 188 | bl_vfi_continue = true;
|
| | 189 | it_iter = 0;
|
| | 190 | ar_val_diff_norm = zeros([it_maxiter_val, 1]);
|
| | 191 | ar_pol_diff_norm = zeros([it_maxiter_val, 1]);
|
| | 192 | mt_pol_perc_change = zeros([it_maxiter_val, it_z_n]);
|
| | 193 |
|
| | 194 | %% Iterate Value Function
|
| | 195 | % Loop solution with 4 nested loops
|
| | 196 | %
|
| | 197 | % # loop 1: over exogenous states
|
| | 198 | % # loop 2: over endogenous states
|
| | 199 | % # loop 3: over choices
|
| | 200 | % # loop 4: add future utility, integration--loop over future shocks
|
| | 201 | %
|
| | 202 |
|
| | 203 | % Start Profile
|
| | 204 | if (bl_profile)
|
| | 205 | close all;
|
| | 206 | profile off;
|
| | 207 | profile on;
|
< 0.001 | 1 | 208 | end
|
| | 209 |
|
| | 210 | % Start Timer
|
< 0.001 | 1 | 211 | if (bl_time)
|
< 0.001 | 1 | 212 | tic;
|
< 0.001 | 1 | 213 | end
|
| | 214 |
|
| | 215 | % Value Function Iteration
|
< 0.001 | 1 | 216 | while bl_vfi_continue
|
< 0.001 | 181 | 217 | it_iter = it_iter + 1;
|
| | 218 |
|
| | 219 | %% Solve Optimization Problem Current Iteration
|
| | 220 | % Only this segment of code differs between ff_abz_vf and ff_abz_vf_vec
|
| | 221 | % Store in cells results and retrieve, this is more memory intensive
|
| | 222 | % than ff_abz_vf_vec.
|
| | 223 |
|
| | 224 | % loop 1: over exogenous states
|
< 0.001 | 181 | 225 | for it_z_i = 1:it_z_n
|
| | 226 |
|
| | 227 | % Current Shock
|
0.003 | 13575 | 228 | fl_z_r_borr = ar_z_r_borr_mesh_wage(it_z_i);
|
0.003 | 13575 | 229 | fl_z_wage = ar_z_wage_mesh_r_borr(it_z_i);
|
| | 230 |
|
| | 231 | % cash-on-hand
|
0.176 | 13575 | 232 | ar_coh = f_coh(fl_z_r_borr, fl_z_wage, ar_a);
|
| | 233 |
|
| | 234 | % Consumption and u(c) only need to be evaluated once
|
0.004 | 13575 | 235 | if (it_iter == 1)
|
| | 236 |
|
| | 237 | % Consumption: fl_z = 1 by 1, ar_a = 1 by N, ar_a' = N by 1
|
| | 238 | % mt_c is N by N: matrix broadcasting, expand to matrix from arrays
|
0.120 | 75 | 239 | mt_c = f_cons_coh(ar_coh, ar_a');
|
| | 240 |
|
| | 241 | % EVAL current utility: N by N, f_util defined earlier
|
| | 242 | % slightly faster to explicitly write function
|
< 0.001 | 75 | 243 | if (fl_crra == 1)
|
| | 244 | mt_utility = log(mt_c);
|
| | 245 | fl_u_cmin = f_util_log(fl_c_min);
|
< 0.001 | 75 | 246 | else
|
| | 247 | % slightly faster if write function here directly, but
|
| | 248 | % speed gain is very small, more important to have single
|
| | 249 | % location control of functions.
|
0.966 | 75 | 250 | mt_utility = f_util_crra(mt_c);
|
0.002 | 75 | 251 | fl_u_cmin = f_util_crra(fl_c_min);
|
< 0.001 | 75 | 252 | end
|
| | 253 |
|
| | 254 | % Eliminate Complex Numbers
|
0.038 | 75 | 255 | mt_it_c_valid_idx = (mt_c <= fl_c_min);
|
0.357 | 75 | 256 | mt_utility(mt_it_c_valid_idx) = fl_u_cmin;
|
| | 257 |
|
| | 258 | % Store in cells
|
< 0.001 | 75 | 259 | cl_u_c_store{it_z_i} = mt_utility;
|
< 0.001 | 75 | 260 | cl_c_valid_idx{it_z_i} = mt_it_c_valid_idx;
|
| | 261 |
|
< 0.001 | 75 | 262 | end
|
| | 263 |
|
| | 264 | % f(z'|z)
|
0.019 | 13575 | 265 | ar_z_trans_condi = mt_z_trans(it_z_i,:);
|
| | 266 |
|
| | 267 | % EVAL EV((A',K'),Z'|Z) = V((A',K'),Z') x p(z'|z)', (N by Z) x (Z by 1) = N by 1
|
| | 268 | % Note: transpose ar_z_trans_condi from 1 by Z to Z by 1
|
| | 269 | % Note: matrix multiply not dot multiply
|
0.279 | 13575 | 270 | mt_evzp_condi_z = mt_val_cur * ar_z_trans_condi';
|
| | 271 |
|
| | 272 | % EVAL add on future utility, N by N + N by 1
|
2.055 | 13575 | 273 | mt_utility = cl_u_c_store{it_z_i} + fl_beta*mt_evzp_condi_z;
|
| | 274 |
|
| | 275 | % Index update
|
| | 276 | % using the method below is much faster than index replace
|
| | 277 | % see <https://fanwangecon.github.io/M4Econ/support/speed/index/fs_subscript.html fs_subscript>
|
0.017 | 13575 | 278 | mt_it_c_valid_idx = cl_c_valid_idx{it_z_i};
|
| | 279 | % Default or Not Utility Handling
|
0.003 | 13575 | 280 | if (bl_default)
|
| | 281 | % if default: only today u(cmin), transition out next period, debt wiped out
|
0.119 | 13575 | 282 | fl_v_default = fl_u_cmin + fl_beta*mt_evzp_condi_z(ar_a == fl_default_aprime);
|
2.904 | 13575 | 283 | mt_utility = mt_utility.*(~mt_it_c_valid_idx) + fl_v_default*(mt_it_c_valid_idx);
|
| | 284 | else
|
| | 285 | % if default is not allowed: v = u(cmin)
|
| | 286 | mt_utility = mt_utility.*(~mt_it_c_valid_idx) + fl_nan_replace*(mt_it_c_valid_idx);
|
0.002 | 13575 | 287 | end
|
| | 288 |
|
| | 289 | % Optimization: remember matlab is column major, rows must be
|
| | 290 | % choices, columns must be states
|
| | 291 | % <https://en.wikipedia.org/wiki/Row-_and_column-major_order COLUMN-MAJOR>
|
| | 292 | % mt_utility is N by N, rows are choices, cols are states.
|
5.400 | 13575 | 293 | [ar_opti_val_z, ar_opti_idx_z] = max(mt_utility);
|
0.144 | 13575 | 294 | ar_opti_aprime_z = ar_a(ar_opti_idx_z);
|
0.201 | 13575 | 295 | ar_opti_c_z = f_cons_coh(ar_coh, ar_opti_aprime_z);
|
| | 296 |
|
| | 297 | % Handle Default is optimal or not
|
0.003 | 13575 | 298 | if (bl_default)
|
| | 299 | % if defaulting is optimal choice, at these states, not required
|
| | 300 | % to default, non-default possible, but default could be optimal
|
0.086 | 13575 | 301 | ar_opti_aprime_z(ar_opti_c_z <= fl_c_min) = fl_default_aprime;
|
0.133 | 13575 | 302 | ar_opti_idx_z(ar_opti_c_z <= fl_c_min) = find(ar_a == fl_default_aprime);
|
| | 303 | else
|
| | 304 | % if default is not allowed, then next period same state as now
|
| | 305 | % this is absorbing state, this is the limiting case, single
|
| | 306 | % state space point, lowest a and lowest shock has this.
|
| | 307 | ar_opti_aprime_z(ar_opti_c_z <= fl_c_min) = ar_a(ar_opti_c_z <= fl_c_min);
|
0.002 | 13575 | 308 | end
|
| | 309 |
|
| | 310 | % store optimal values
|
0.076 | 13575 | 311 | mt_val(:,it_z_i) = ar_opti_val_z;
|
0.053 | 13575 | 312 | mt_pol_a(:,it_z_i) = ar_opti_aprime_z;
|
| | 313 |
|
0.003 | 13575 | 314 | if (it_iter == (it_maxiter_val + 1))
|
< 0.001 | 75 | 315 | mt_pol_idx(:,it_z_i) = ar_opti_idx_z;
|
< 0.001 | 75 | 316 | end
|
0.004 | 13575 | 317 | end
|
| | 318 |
|
| | 319 | %% Check Tolerance and Continuation
|
| | 320 |
|
| | 321 | % Difference across iterations
|
0.276 | 181 | 322 | ar_val_diff_norm(it_iter) = norm(mt_val - mt_val_cur);
|
0.210 | 181 | 323 | ar_pol_diff_norm(it_iter) = norm(mt_pol_a - mt_pol_a_cur);
|
0.021 | 181 | 324 | mt_pol_perc_change(it_iter, :) = sum((mt_pol_a ~= mt_pol_a_cur))/(it_a_n);
|
| | 325 |
|
| | 326 | % Update
|
0.007 | 181 | 327 | mt_val_cur = mt_val;
|
0.005 | 181 | 328 | mt_pol_a_cur = mt_pol_a;
|
| | 329 |
|
| | 330 | % Print Iteration Results
|
< 0.001 | 181 | 331 | if (bl_display && (rem(it_iter, it_display_every)==0))
|
| | 332 | fprintf('VAL it_iter:%d, fl_diff:%d, fl_diff_pol:%d\n', ...
|
| | 333 | it_iter, ar_val_diff_norm(it_iter), ar_pol_diff_norm(it_iter));
|
| | 334 | tb_valpol_iter = array2table([mean(mt_val_cur,1); mean(mt_pol_a_cur,1); ...
|
| | 335 | mt_val_cur(it_a_n,:); mt_pol_a_cur(it_a_n,:)]);
|
| | 336 | tb_valpol_iter.Properties.VariableNames = strcat('z', string((1:size(mt_val_cur,2))));
|
| | 337 | tb_valpol_iter.Properties.RowNames = {'mval', 'map', 'Hval', 'Hap'};
|
| | 338 | disp('mval = mean(mt_val_cur,1), average value over a')
|
| | 339 | disp('map = mean(mt_pol_a_cur,1), average choice over a')
|
| | 340 | disp('Hval = mt_val_cur(it_a_n,:), highest a state val')
|
| | 341 | disp('Hap = mt_pol_a_cur(it_a_n,:), highest a state choice')
|
| | 342 | disp(tb_valpol_iter);
|
| | 343 | end
|
| | 344 |
|
| | 345 | % Continuation Conditions:
|
| | 346 | % 1. if value function convergence criteria reached
|
| | 347 | % 2. if policy function variation over iterations is less than
|
| | 348 | % threshold
|
< 0.001 | 181 | 349 | if (it_iter == (it_maxiter_val + 1))
|
< 0.001 | 1 | 350 | bl_vfi_continue = false;
|
0.003 | 180 | 351 | elseif ((it_iter == it_maxiter_val) || ...
|
| 180 | 352 | (ar_val_diff_norm(it_iter) < fl_tol_val) || ...
|
| 180 | 353 | (sum(ar_pol_diff_norm(max(1, it_iter-it_tol_pol_nochange):it_iter)) < fl_tol_pol))
|
| | 354 | % Fix to max, run again to save results if needed
|
< 0.001 | 1 | 355 | it_iter_last = it_iter;
|
< 0.001 | 1 | 356 | it_iter = it_maxiter_val;
|
< 0.001 | 1 | 357 | end
|
| | 358 |
|
< 0.001 | 181 | 359 | end
|
| | 360 |
|
| | 361 | % End Timer
|
< 0.001 | 1 | 362 | if (bl_time)
|
< 0.001 | 1 | 363 | toc;
|
< 0.001 | 1 | 364 | end
|
| | 365 |
|
| | 366 | % End Profile
|
< 0.001 | 1 | 367 | if (bl_profile)
|
0.001 | 1 | 368 | profile off
|
| | 369 | profile viewer
|
| | 370 | st_file_name = [st_profile_prefix st_profile_name_main st_profile_suffix];
|
| | 371 | profsave(profile('info'), strcat(st_profile_path, st_file_name));
|
| | 372 | end
|
| | 373 |
|
| | 374 | %% Process Optimal Choices
|
| | 375 |
|
| | 376 | result_map = containers.Map('KeyType','char', 'ValueType','any');
|
| | 377 | result_map('mt_val') = mt_val;
|
| | 378 | result_map('mt_pol_idx') = mt_pol_idx;
|
| | 379 |
|
| | 380 | result_map('cl_mt_coh') = {f_coh(ar_z_r_borr_mesh_wage, ar_z_wage_mesh_r_borr, ar_a'), zeros(1)};
|
| | 381 | result_map('cl_mt_pol_a') = {mt_pol_a, zeros(1)};
|
| | 382 | result_map('cl_mt_pol_c') = {f_cons_checkcmin(ar_z_r_borr_mesh_wage, ar_z_wage_mesh_r_borr, ar_a', mt_pol_a), zeros(1)};
|
| | 383 | result_map('ar_st_pol_names') = ["cl_mt_pol_a", "cl_mt_coh", "cl_mt_pol_c"];
|
| | 384 |
|
| | 385 | if (bl_post)
|
| | 386 | bl_input_override = true;
|
| | 387 | result_map('ar_val_diff_norm') = ar_val_diff_norm(1:it_iter_last);
|
| | 388 | result_map('ar_pol_diff_norm') = ar_pol_diff_norm(1:it_iter_last);
|
| | 389 | result_map('mt_pol_perc_change') = mt_pol_perc_change(1:it_iter_last, :);
|
| | 390 | result_map = ff_az_vf_post(param_map, support_map, armt_map, func_map, result_map, bl_input_override);
|
| | 391 | end
|
| | 392 |
|
| | 393 | end
|
Other subfunctions in this file are not included in this listing.