# Osr by grid search

hello everyone

I have a problem about grid search for the optimal simple rule(osr)
my model have 24 endogenouse variables and 24 equations
one of equation is below monetary policy rule:

phivariant = landa1phivariant(-1)+landa2pi(-1)+landa3*Y(-1)+epsilon
where : phivariant=money growth , pi= inflation and Y = output
I also have a quadratic loss function of inflation and outputgap

i need to find optimal coefficients of landa1 , landa2 and landa3 that minimized loss function
also i want to use policy rule in alternative time and get impulse responses

can i use grid search for finding this coefficient in dynare?
I know below osr command :

optim_weights;
inflation 1;
y 1;
end;
osr_params gammax0 gammac0 gamma_y_ gamma_inf_;
gammarr = 0;
gammax0 = 0.2;
gammac0 = 1.5;
gamma_y_ = 8;
gamma_inf_ = 3;
osr;

but i don,t know after present parameter , what is value for parameters and how can find it? is it initial value?

also i know how to write a loop over different values for a parameter like :

rhos = 0.8:0.05:1.05;
for i=1:length(rhos);
rho = rhos(i);
stoch_simul(order=1);
if info;
disp('Computation fails for rho = ’ num2str(rho)]);
end;
// results can be saved here
end;

for finding osr by grid search, do we must mix osr command with loop command?
does osr command apply grid search for finding optimal coeficients?
what is the value of parameters after present parameters and how can find it?

I need to find optimal monetary policy by osr in dynare