Batch process entails a bottle neck in the majority of plants. This means that an optimal synchronization with the rest of the process lines is mandatory in order to increase the productivity. To obtain the best possible schedule, instead of a feasible solution, the problems usually are implemented using mathematical programming, however the batch processes are considered independent one from each other to facilitate the coding and resolution. In this work the authors present a new formulation that allows an optimal schedule of batch processes which length depend on the synchronization of the startup of those processes. This solution is implemented to use as a real time optimization tool with a rolling horizon method. The distribution of shared resources among the devices is also keep into account.