Hierarchical and decentralized control for batch and repetitive manufacturing