The Segmented Decision Rule

In my model, there is an economic agent whose decision rule depends on the magnitude of a shock. Shocks of different scales lead to completely different budget constraints for the agent and thus its decision function is a segmented function. I want to ask how this should be set up in dynare?

Is it a perfect foresight experiment?

yes

Can you elaborate a bit more what the exact problem is?