I want to find the optimal simple rule of a new keynesian model with bounded rationality and switching. It is a baseline model with backwardlooking expectations now.
As I understand this kind of system is only feasible in matlab. If I’m wrong please correct me. I couldn´t find anything about bounded rationality in Dynare.

So, I have programed the system in Matlab and used the discrete choice theory to state the fraction of economic agents using a certain heuristic.

My question is now: How to find the optimal simple rule for this system in Matlab.
In case of Rational Expectations I used the OSR command but now its not possible anymore.

My first thought was to find an algorithm which finds the optimal value of the gamma’s…

Expectations are no longer formed rationally but are based on simple heuristics.
Agents can chosse from various heuristics: Targeters, Static exp, Extrapolators - for output and Inflation. Based on past expectation error an attractivity vaule is assigned to each heuristic. And with the discret choice theory the fraction of agents who use one of the heuristcs is defined.
That’s why I have this expectations in my model.

You are making a mistake here. What is relevant in the end is the model solution, not the system defining the solution. Even with RE, the solution later is a VARMA process and therefore purely backward looking.