Solving the problem of finding the optimal steady state of an economic model