This thesis deals with dynamic optimization of batch processes, i.e. processes that are characterized by a finite time of operation and the frequent repetition of batches. The objective is to maximize the quantity of the desired product at final time while satisfying constraints during the batch (path constraints) and at final time (terminal constraints). The classical approach is to apply, in an open-loop fashion, input profiles that have been determined off-line using optimization. In practical applications, however, a conservative stand has to be taken since uncertainty is present, which may lead to constraint violations or non-optimal operation. Measurement-based optimization helps reduce this conservatism by using measurements to compensate for the effect of uncertainty. In order to achieve optimal operation, it has been proposed to track the necessary conditions of optimality (NCO). For the terminal cost optimization of batch processes, the NCO consist in four parts : Path constraints and path sensitivity conditions that have to be met during the batch, as well as terminal constraints and terminal sensitivity conditions that have to be met at final time. The intuitive approach is to handle the path conditions during the batch by using on-line measurements, and to implement the terminal conditions on a run-to-run basis since measurements of the terminal conditions are available off-line. However, run-to-run adaptation methods have two important disadvantages : i) Several runs are necessary to obtain optimal operation, and ii) within-run perturbations cannot be compensated. In this thesis, it is shown via a variational analysis of the NCO that meeting the constraint parts of the NCO is more important than meeting the sensitivity parts. Therefore, methods for steering the system toward the terminal constraints by using on-line measurements are examined in order to give priority to meeting the constraint-seeking conditions. This work proposes to track run-time references that lead to the constraints at final time. Thus, a two-time-scale methodology is proposed, where the task of meeting the active terminal constraints is addressed on-line using trajectory tracking, whilst pushing the sensitivities to zero is implemented on a run-to-run basis. Moreover, the use of Iterative Learning Control (ILC) to improve tracking is studied. Reference tracking is often accomplished with linear controllers of the PID type since they are widely accepted in industry and easy to implement. However, as batch processes operate over a wide region and are often highly nonlinear systems, tracking errors are inevitable. A possibility to reduce tracking errors is to use time-varying feedforward inputs. The feedforward inputs can be generated by using a process model, but the presence of model uncertainty can limit the performance. Instead of a process model, ILC uses error information from previous batches for computing the feedforward inputs iteratively. Since batch pr