Minimization within stoch_simul


I am trying to solve a pretty standard DSGE model in Dynare with one twist: there are only finitely many firms, whose number is pinned down by a free entry condition. Specifically, the firms have to pay a fixed cost to operate, and since each firm’s profits are falling with the overall number of firms in the market the number of firms is pinned down. For now I am not restricting the number of firms to be an integer, so the problem is continuous.

My problem is as follows: I would like to have two types of firms, say, highly productive (H) and unproductive (L), which differ in their variable costs (set exogenously). The combination of the two types is not unique in equilibrium: I could have 50 H and 50 L firms, or 51 H and 49 L firms, or 52 H and 48 L, etc. I have already chosen a specific steady state with 50 H and 50 L firms, so that is all set. But for the adjustment path after a productivity shock, the multiplicity of possible paths remains. I would like to tell Dynare which path to choose. Specifically, I would like to choose the adjustment path which minimizes the difference in the number of each type of firm from each period to the next. So I would like to minimize

(H_t - H_{t-1})^2 + (L_t - L_{t-1})^2

subject to the free entry constraints for the two types of firms. Is there a way to get Dynare to do this, i.e., to choose this specific IRF out of all the possible paths? In Matlab I would simply do a constrained optimization in each period, but I am not sure this can be done within Dynare, since this is part of the stochastic simulation?

Thank you very much for your help!

If there is multiplicity, does that mean the Blanchard-Kahn conditions are not satisfied?

Yes, that’s right. That’s why I need another restriction to pin down the unique equilibrium. But that restriction is not an equation but a constrained minimization problem that does not have a closed-form solution.

But then I don’t understand how you can use stoch_simul for that. If the BK conditions are not satisfied, then the optimizer will not be able to compute a trajectory for the parameter vector in order to evaluate the objective function.