A problem of successive traversal of sets under constraints in the form of precedence conditions is investigated. In what follows, this problem is called the generalized courier problem. To solve it, the method of dynamic programming is used, which is implemented in a shortened version, taking into account the specific features of the generalized courier problem. The Bellman function is not determined for all positions, which saves PC memory and, in principle, increases the efficiency of the procedure based on the dynamic programming method. Applications can be connected with the transportation problem (sea and air transportation with visiting many destinations and multiple choices of travels from one destination to another).