I am attempting to solve the Ramsey policy of a rent-seeking policymaker in a DSGE model with heterogenous households and firms. Upon solving with Dynare 4.5.7, I get the warning and error messages saying:

warning: division by zero
…
error: Ramsey: The steady state file computation for the Ramsey problem resulted in NaNs at the initial values of the instruments.

II have attached the codes. Please could you help go through it to point out the source(s) of this error? csae3.mod (2.7 KB)

After battIing with providing the accurate conditional steady-state of the Ramsey problem, I resorted to running a Linear Quadratic Ramsey code which resulted in the non-zero steady-state values below:
STEADY-STATE RESULTS:

R -0.0783676
W_r 2.51745
W_nr 0.31774
N_r 0.715531
N_nr -0.0353552
RN 2.58452
Y_r -0.30829
Y_nr 0.236298
G 0.728033
AG 1.05565
Pii_rstar -0.0783676
Pii_nrstar -0.0783676
A 0
L -2.677
Pii -0.0783676
Y 0.0783676
b 0.0626941
or 0

Approximated value of planner objective function
- with initial Lagrange multipliers set to 0: 6.6089
- with initial Lagrange multipliers set to steady state: 6.8

Does this make sense since I should be getting steady state values of 0 in a linear model?

Secondly, I ran another Linear Ramsey code where I obtained steady state values of 0. Does this imply that the steady state is non-distorted?

In a linear model, you cannot tell whether the steady state is distorted or not. That is the reason why you generally cannot work with linear models for optimal policy.

It is strange that in a pure linear quadratic case you get non-zero steady states

I must have obtained non-zero steady states in the linear-quadratic model because there were Nans in the resid. Going forward, I’ll complement my analysis with the OSR routine.