In this work we will introduce a hierarchical framework that can be used to optimize an ultrafiltration process that is used for the purification of surface water. Within the suggested framework modelling and optimization of chemical cleaning of membranes were performed. This paper will discuss the proposed model, the quantitative criteria that can be used to select a proper cleaning agent and lastly the optimization procedure on the basis of the dynamic model. Systematic optimization showed that two optimal scenarios for cleaning can be formulated, one in which cleaning time is reduced significantly with respect to a conventional cleaning procedure, and a second one where cleaning time and cleaning agent consumption as well are reduced sig...