In this paper we study a subset of hybrid systems and present a generalized method for their optimization. We outline Hybrid Cost Automata (HCA), an extension to Hybrid Automata, where discrete and continuous cost expressions are added. The class of hybrid systems with known spatial paths is defined in the context of HCA. This type of system is common in industry where for example AGVs transport goods from one location to another, or manipulators move between joint coordinates. The optimization is performed using Dynamic Programming as a preprocessing step, whereafter Mixed Integer Nonlinear Programming is used for scheduling. A case study of a four robot cell is presented with energy consumption used as a minimization criterion.