Development of a mathematical model for the dynamic optimization of batch reactors, and MINLP synthesis of plug-flow reactors in complex networks