A polynomial method for finding the maximum element of the solution set of systems of (max,min)-linear systems of equations with variables on both sides of the equations (published in Kybernetika, volume 46 (2010), Number 3, pp. 405-414) is generalized to distributive lattices and used to propose an iterative method for solving optimization problems, the set of feasible solutions of which is described by such systems. The objective function of the problems is the maximum of several functions, each of which can be a product of monotone or unimodular functions.