Make verbosity flag effective: do not print informations about perfect foresight solvers if options_.ep.verbosity=0.
parent
a36cf30118
commit
3ba5a645be
|
@ -32,7 +32,9 @@ function time_series = extended_path(initial_conditions,sample_size)
|
|||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
global M_ options_ oo_
|
||||
|
||||
|
||||
debug = 1;
|
||||
verbosity = options_.ep.verbosity+debug;
|
||||
|
||||
% Test if bytecode and block options are used (these options are mandatory)
|
||||
if ~( options_.bytecode && options_.block )
|
||||
error('extended_path:: Options bytecode and block are mandatory!')
|
||||
|
@ -128,7 +130,7 @@ while (t<sample_size)
|
|||
info.convergence = ~flag;
|
||||
info.time = ctime;
|
||||
end
|
||||
if options_.ep.verbosity
|
||||
if verbosity
|
||||
if info.convergence
|
||||
if t<10
|
||||
disp(['Time: ' int2str(t) '. Convergence of the perfect foresight model solver!'])
|
||||
|
@ -158,7 +160,7 @@ while (t<sample_size)
|
|||
options_.periods = options_.periods + options_.ep.step;
|
||||
options_.minimal_solving_period = options_.periods;
|
||||
increase_periods = increase_periods + 1;
|
||||
if options_.ep.verbosity
|
||||
if verbosity
|
||||
if t<10
|
||||
disp(['Time: ' int2str(t) '. I increase the number of periods to ' int2str(options_.periods) '.'])
|
||||
elseif t<100
|
||||
|
@ -195,7 +197,7 @@ while (t<sample_size)
|
|||
continue
|
||||
else
|
||||
if increase_periods==10;
|
||||
if options_.ep.verbosity
|
||||
if verbosity
|
||||
if t<10
|
||||
disp(['Time: ' int2str(t) '. Even with ' int2str(options_.periods) ', I am not able to solve the perfect foresight model. Use homotopy instead...'])
|
||||
elseif t<100
|
||||
|
@ -222,7 +224,7 @@ while (t<sample_size)
|
|||
else
|
||||
info.convergence = 1;
|
||||
oo_.endo_simul = tmp;
|
||||
if options_.ep.verbosity && info.convergence
|
||||
if verbosity && info.convergence
|
||||
disp('Homotopy:: Convergence of the perfect foresight model solver!')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1719,7 +1719,7 @@ Interpreter::evaluate_a_block(const int size, const int type, string bin_basenam
|
|||
}
|
||||
|
||||
int
|
||||
Interpreter::simulate_a_block(const int size, const int type, string file_name, string bin_basename, bool Gaussian_Elimination, bool steady_state, int block_num,
|
||||
Interpreter::simulate_a_block(const int size, const int type, string file_name, string bin_basename, bool Gaussian_Elimination, bool steady_state, bool print_it, int block_num,
|
||||
const bool is_linear, const int symbol_table_endo_nbr, const int Block_List_Max_Lag, const int Block_List_Max_Lead, const int u_count_int)
|
||||
{
|
||||
it_code_type begining;
|
||||
|
@ -1980,7 +1980,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
if (cvg)
|
||||
continue;
|
||||
int prev_iter = iter;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, false, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, print_it, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
iter++;
|
||||
if (iter > prev_iter)
|
||||
{
|
||||
|
@ -2025,7 +2025,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
}
|
||||
else
|
||||
cvg = false;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, false, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, print_it, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
if (!result)
|
||||
{
|
||||
mexPrintf(" in Solve Forward complete, convergence not achieved in block %d\n", Block_Count+1);
|
||||
|
@ -2077,7 +2077,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
if (cvg)
|
||||
continue;
|
||||
int prev_iter = iter;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, false, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, print_it, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
iter++;
|
||||
if (iter > prev_iter)
|
||||
{
|
||||
|
@ -2124,7 +2124,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
}
|
||||
else
|
||||
cvg = false;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, false, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, print_it, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2182,7 +2182,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
if (cvg)
|
||||
continue;
|
||||
int prev_iter = iter;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, false, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, print_it, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
iter++;
|
||||
if (iter > prev_iter)
|
||||
{
|
||||
|
@ -2226,7 +2226,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
}
|
||||
else
|
||||
cvg = false;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, false, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, 0, 0, 0, size, print_it, cvg, iter, true, stack_solve_algo, solve_algo);
|
||||
if (!result)
|
||||
{
|
||||
mexPrintf(" in Solve Backward complete, convergence not achieved in block %d\n", Block_Count+1);
|
||||
|
@ -2278,7 +2278,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
if (cvg)
|
||||
continue;
|
||||
int prev_iter = iter;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, false, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, print_it, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
iter++;
|
||||
if (iter > prev_iter)
|
||||
{
|
||||
|
@ -2321,7 +2321,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
}
|
||||
else
|
||||
cvg = false;
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, false, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
Simulate_Newton_One_Boundary(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, print_it, cvg, iter, false, stack_solve_algo, solve_algo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2398,7 +2398,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
cvg = (max_res < solve_tolf);
|
||||
u_count = u_count_saved;
|
||||
int prev_iter = iter;
|
||||
Simulate_Newton_Two_Boundaries(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, periods, true, cvg, iter, minimal_solving_periods, stack_solve_algo, endo_name_length, P_endo_names);
|
||||
Simulate_Newton_Two_Boundaries(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, periods, print_it, cvg, iter, minimal_solving_periods, stack_solve_algo, endo_name_length, P_endo_names);
|
||||
iter++;
|
||||
if (iter > prev_iter)
|
||||
{
|
||||
|
@ -2440,7 +2440,7 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
}
|
||||
}
|
||||
cvg = false;
|
||||
Simulate_Newton_Two_Boundaries(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, periods, true, cvg, iter, minimal_solving_periods, stack_solve_algo, endo_name_length, P_endo_names);
|
||||
Simulate_Newton_Two_Boundaries(Block_Count, symbol_table_endo_nbr, it_, y_kmin, y_kmax, size, periods, print_it, cvg, iter, minimal_solving_periods, stack_solve_algo, endo_name_length, P_endo_names);
|
||||
}
|
||||
mxFree(r);
|
||||
mxFree(y_save);
|
||||
|
@ -2499,7 +2499,7 @@ Interpreter::print_a_block(const int size, const int type, string bin_basename,
|
|||
}
|
||||
|
||||
bool
|
||||
Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_state, bool evaluate, int block, int &nb_blocks)
|
||||
Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_state, bool evaluate, int block, int &nb_blocks, bool print_it)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
|
@ -2587,10 +2587,10 @@ Interpreter::compute_blocks(string file_name, string bin_basename, bool steady_s
|
|||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mexPrintf("endo in block=%d, type=%d, steady_state=%d, Block_Count=%d, fb->get_is_linear()=%d, fb->get_endo_nbr()=%d, fb->get_Max_Lag()=%d, fb->get_Max_Lead()=%d, fb->get_u_count_int()=%d\n",
|
||||
fb->get_size(), fb->get_type(), steady_state, Block_Count, fb->get_is_linear(), fb->get_endo_nbr(), fb->get_Max_Lag(), fb->get_Max_Lead(), fb->get_u_count_int());
|
||||
mexPrintf("endo in block=%d, type=%d, steady_state=%d, print_it=%d, Block_Count=%d, fb->get_is_linear()=%d, fb->get_endo_nbr()=%d, fb->get_Max_Lag()=%d, fb->get_Max_Lead()=%d, fb->get_u_count_int()=%d\n",
|
||||
fb->get_size(), fb->get_type(), steady_state, print_it, Block_Count, fb->get_is_linear(), fb->get_endo_nbr(), fb->get_Max_Lag(), fb->get_Max_Lead(), fb->get_u_count_int());
|
||||
#endif
|
||||
result = simulate_a_block(fb->get_size(), fb->get_type(), file_name, bin_basename, true, steady_state, Block_Count,
|
||||
result = simulate_a_block(fb->get_size(), fb->get_type(), file_name, bin_basename, true, steady_state, print_it,Block_Count,
|
||||
fb->get_is_linear(), fb->get_endo_nbr(), fb->get_Max_Lag(), fb->get_Max_Lead(), fb->get_u_count_int());
|
||||
if (result == ERROR_ON_EXIT)
|
||||
return ERROR_ON_EXIT;
|
||||
|
|
|
@ -56,7 +56,7 @@ protected:
|
|||
void compute_block_time(int Per_u_, bool evaluate, int block_num, int size, bool steady_state);
|
||||
void evaluate_a_block(const int size, const int type, string bin_basename, bool steady_state, int block_num,
|
||||
const bool is_linear = false, const int symbol_table_endo_nbr = 0, const int Block_List_Max_Lag = 0, const int Block_List_Max_Lead = 0, const int u_count_int = 0, int block = -1);
|
||||
int simulate_a_block(const int size, const int type, string file_name, string bin_basename, bool Gaussian_Elimination, bool steady_state, int block_num,
|
||||
int simulate_a_block(const int size, const int type, string file_name, string bin_basename, bool Gaussian_Elimination, bool steady_state, bool print_it, int block_num,
|
||||
const bool is_linear = false, const int symbol_table_endo_nbr = 0, const int Block_List_Max_Lag = 0, const int Block_List_Max_Lead = 0, const int u_count_int = 0);
|
||||
void print_a_block(const int size, const int type, string bin_basename, bool steady_state, int block_num,
|
||||
const bool is_linear, const int symbol_table_endo_nbr, const int Block_List_Max_Lag,
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
int nb_row_xd_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg, int maxit_arg_, double solve_tolf_arg, int size_o_direction_arg,
|
||||
double slowc_arg, int y_decal_arg, double markowitz_c_arg, string &filename_arg, int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
|
||||
bool global_temporary_terms_arg, bool print_arg, bool print_error_arg, mxArray *GlobalTemporaryTerms_arg);
|
||||
bool compute_blocks(string file_name, string bin_basename, bool steady_state, bool evaluate, int block, int &nb_blocks);
|
||||
bool compute_blocks(string file_name, string bin_basename, bool steady_state, bool evaluate, int block, int &nb_blocks, bool print_it);
|
||||
inline mxArray *
|
||||
get_jacob(int block_num)
|
||||
{
|
||||
|
|
|
@ -3097,8 +3097,11 @@ SparseMatrix::Simulate_Newton_Two_Boundaries(int blck, int y_size, int it_, int
|
|||
mxArray *b_m = NULL, *A_m = NULL, *x0_m = NULL;
|
||||
if (iter > 0)
|
||||
{
|
||||
mexPrintf("Sim : %f ms\n", (1000.0*(double (clock())-double (time00)))/double (CLOCKS_PER_SEC));
|
||||
mexEvalString("drawnow;");
|
||||
if (print_it)
|
||||
{
|
||||
mexPrintf("Sim : %f ms\n", (1000.0*(double (clock())-double (time00)))/double (CLOCKS_PER_SEC));
|
||||
mexEvalString("drawnow;");
|
||||
}
|
||||
time00 = clock();
|
||||
}
|
||||
if (isnan(res1) || isinf(res1) || (res2 > 12*g0 && iter > 0))
|
||||
|
|
|
@ -216,7 +216,7 @@ main(int nrhs, const char *prhs[])
|
|||
double *yd = NULL, *xd = NULL;
|
||||
int count_array_argument = 0;
|
||||
bool global_temporary_terms = false;
|
||||
bool print = false, print_error = true;
|
||||
bool print = false, print_error = true, print_it = false;
|
||||
double *steady_yd = NULL, *steady_xd = NULL;
|
||||
|
||||
try
|
||||
|
@ -286,6 +286,10 @@ main(int nrhs, const char *prhs[])
|
|||
nb_row_xd = row_x;
|
||||
}
|
||||
}
|
||||
mxArray *ep = mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "ep"));
|
||||
int verbose= int(*mxGetPr((mxGetFieldByNumber(ep, 0, mxGetFieldNumber(ep, "verbosity")))));
|
||||
if (verbose)
|
||||
print_it = true;
|
||||
int maxit_ = int (floor(*(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "maxit_"))))));
|
||||
double slowc = double (*(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "slowc")))));
|
||||
double markowitz_c = double (*(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "markowitz")))));
|
||||
|
@ -298,7 +302,6 @@ main(int nrhs, const char *prhs[])
|
|||
solve_algo = int (*(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "solve_algo")))));
|
||||
solve_tolf = *(mxGetPr(mxGetFieldByNumber(options_, 0, mxGetFieldNumber(options_, "solve_tolf"))));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
solve_algo = stack_solve_algo;
|
||||
|
@ -344,7 +347,7 @@ main(int nrhs, const char *prhs[])
|
|||
|
||||
try
|
||||
{
|
||||
result = interprete.compute_blocks(f, f, steady_state, evaluate, block, nb_blocks);
|
||||
result = interprete.compute_blocks(f, f, steady_state, evaluate, block, nb_blocks,print_it);
|
||||
}
|
||||
catch (GeneralExceptionHandling &feh)
|
||||
{
|
||||
|
@ -352,7 +355,7 @@ main(int nrhs, const char *prhs[])
|
|||
}
|
||||
|
||||
clock_t t1 = clock();
|
||||
if (!steady_state && !evaluate && no_error)
|
||||
if (!steady_state && !evaluate && no_error && print)
|
||||
mexPrintf("Simulation Time=%f milliseconds\n", 1000.0*(double (t1)-double (t0))/double (CLOCKS_PER_SEC));
|
||||
#ifndef DEBUG_EX
|
||||
bool dont_store_a_structure = false;
|
||||
|
|
Loading…
Reference in New Issue