Prof. Jpfeifer,
Many thanks for your reply.
As you said, only cmaes allow setting bounds for the optimizer, since we have already set the bounds in your posted code
x_opt_name={‘alpha_le’,0,Inf
‘alpha_qky’,0,Inf
‘alpha_ve’,0,Inf
‘alpha_cg’,0,Inf
};
, which is from 0 to infinite, and also have the bounds in
cmaesOptions.LBounds = [-1000;-1000];
cmaesOptions.UBounds = [1000;1000];
which one should be the bounds that cmaes
ues? I am confused about it.
Moreover, if
cmaesOptions.LBounds = [-1000;-1000];
cmaesOptions.UBounds = [1000;1000];
is the bounds that cmaes uses, how should I set parameters to be optimized in front of the optimizer in the mod-file?
When I set the parameter names in x_start
as x_start=[rho_r, rho_pi, rho_y]'
, the code indeed do run. It can do work with a string instead of a number. Please see the attached code. Could you please help me check whether there exist some problems?
When I set the bounds as
cmaesOptions.LBounds = [0;1.1;0];
cmaesOptions.UBounds = [1;5;3];
, I have the error message:
In an assignment A(:slight_smile: = B, the number of elements in A and B must be the same.
Error in dyn_first_order_solver (line 251)
info(2) = temp’*temp;
Error in stochastic_solvers (line 267)
[dr,info] = dyn_first_order_solver(jacobia_,M_,dr,options_,task);
Error in resol (line 144)
[dr,info] = stochastic_solvers(dr,check_flag,M,options,oo);
Error in conditional_welfare_objective (line 17)
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_); %get decision rules
Error in cmaes (line 948)
fitness.raw(k) = feval(fitfun, arxvalid(:,k), varargin{:});
Error in housing (line 346)
[x_opt_hat, fhat, COUNTEVAL, STOPFLAG, OUT, BESTEVER] = cmaes(‘conditional_welfare_objective’,x_start,H0,cmaesOptions,x_opt_name);
Error in dynare (line 223)
evalin(‘base’,fname) ;`
Could you please help me what the problem is? How to fix it?
Here attached the code. I am looking forward to your reply. conditional_welfare_objective.m (1.1 KB)
housing.mod (8.5 KB)