Functional equations in the theory of dynamic programming III