diff --git a/src/get_functions.jl b/src/get_functions.jl index 070fc70a..41b08a36 100644 --- a/src/get_functions.jl +++ b/src/get_functions.jl @@ -1085,7 +1085,7 @@ function get_irf(๐“‚::โ„ณ; constraints_violated = any(๐“‚.obc_violation_function(zeros(num_shocks*periods_per_shock), p) .> eps(Float32)) if constraints_violated - solved = false + # solved = false for algo โˆˆ [NLopt.:LD_SLSQP, NLopt.:LN_COBYLA] # check whether auglag is more reliable here (as in gives smaller shock size) @@ -1093,7 +1093,9 @@ function get_irf(๐“‚::โ„ณ; opt.min_objective = obc_objective_optim_fun - opt.xtol_rel = eps() + opt.xtol_abs = eps(Float32) + opt.ftol_abs = eps(Float32) + opt.maxeval = 500 # Adding constraints # opt.upper_bounds = fill(eps(), num_shocks*periods_per_shock) @@ -1106,13 +1108,13 @@ function get_irf(๐“‚::โ„ณ; (minf,x,ret) = NLopt.optimize(opt, zeros(num_shocks*periods_per_shock)) - solved = ret โˆˆ Symbol.([ - NLopt.SUCCESS, - NLopt.STOPVAL_REACHED, - NLopt.FTOL_REACHED, - NLopt.XTOL_REACHED, - NLopt.ROUNDOFF_LIMITED, - ]) + # solved = ret โˆˆ Symbol.([ + # NLopt.SUCCESS, + # NLopt.STOPVAL_REACHED, + # NLopt.FTOL_REACHED, + # NLopt.XTOL_REACHED, + # NLopt.ROUNDOFF_LIMITED, + # ]) present_shocks[contains.(string.(๐“‚.timings.exo),"แต’แต‡แถœ")] .= x @@ -1123,7 +1125,7 @@ function get_irf(๐“‚::โ„ณ; end end - solved = solved && !constraints_violated + solved = !constraints_violated else solved = true end diff --git a/src/plotting.jl b/src/plotting.jl index e0945be0..9104c3df 100644 --- a/src/plotting.jl +++ b/src/plotting.jl @@ -507,7 +507,9 @@ function plot_irf(๐“‚::โ„ณ; # check whether auglag is more reliable and efficient here opt.min_objective = obc_objective_optim_fun - opt.xtol_rel = eps() + opt.xtol_abs = eps(Float32) + opt.ftol_abs = eps(Float32) + opt.maxeval = 500 # Adding constraints # opt.upper_bounds = fill(eps(), num_shocks*periods_per_shock) @@ -520,19 +522,19 @@ function plot_irf(๐“‚::โ„ณ; (minf,x,ret) = NLopt.optimize(opt, zeros(num_shocks*periods_per_shock)) - solved = ret โˆˆ Symbol.([ - NLopt.SUCCESS, - NLopt.STOPVAL_REACHED, - NLopt.FTOL_REACHED, - NLopt.XTOL_REACHED, - NLopt.ROUNDOFF_LIMITED, - ]) + # solved = ret โˆˆ Symbol.([ + # NLopt.SUCCESS, + # NLopt.STOPVAL_REACHED, + # NLopt.FTOL_REACHED, + # NLopt.XTOL_REACHED, + # NLopt.ROUNDOFF_LIMITED, + # ]) present_shocks[contains.(string.(๐“‚.timings.exo),"แต’แต‡แถœ")] .= x constraints_violated = any(๐“‚.obc_violation_function(x, p) .> eps(Float32)) - solved = solved && !constraints_violated + solved = !constraints_violated else solved = true end