A decomposition algorithm for the optimisation of hybrid dynamic processes