# Dynamic Optimization Using Local Collocation Methods and Improved Multiresolution Technique
## 4 Numerical Examples
### Williams-Otto Semi-Batch Reactor Control Problem  
In this example, the proposed method was applied to the control of a more complex semi-batch reactor problem, i.e., the Williams-Otto semi-batch reactor. The problem is a benchmark problem which has been extensively studied in literatures [5; 14; 17; 20; 42]. The dynamic optimization problem is stated as: find the optimal control \(\mathbf{u}(\tau)=[T_{W}(\tau),F_{B,in}(\tau)]^{\mathrm{T}}\), where \(T_{W}(\tau)\) is the cooling water inlet temperature and \(F_{B,in}(\tau)\) is the feed flow rate of a reactant that maximizes the objective  
\[J=\Phi(\tau_{f}=1). \tag{25}\]  
The state dynamic equations are  
Figure 6: State solutions for a drug displacement problem (without path constraint): (**a**) \(x_{1}(t)\); (**b**) \(x_{2}(t)\). Figure 7: Control and state solutions for a drug displacement problem (with path constraints): (**a**) \(u(t)\); (**b**) \(x_{1}(t)\). The time histories of the two constrained state variables, i.e., the reactor temperature \(T_{R}(t)\) and the reactor volume \(V(t)\), are displayed in Figure 10, where the circle markers are the discrete solutions and the solid lines are the results obtained by integrating the state dynamics along the optimal control solutions using the classical fourth-order RK method. It is seen that the discrete solutions and the integration results are in good agreement. Furthermore, both the state variables strictly satisfy their constraints. These results demonstrate the effectiveness of the method. For comparison, we also solved this example by ignoring the mesh refinement algorithm MRA-III, which is responsible for removing the redundant mesh points generated by MRA-I and MRA-II in the constant control regions. In this case, the method became similar to the MRTs described in [25; 26; 27], except that the methods of [25; 26] must start with \(2^{j}+1\) mesh points and the method of [27] must start with a mesh size twice larger than that of the coarsest mesh. The technique terminated after eight iterations and the optimal control solutions are given in Figure 11. The objective function value is 4768.313475. It is seen that both the control solutions and the objective function are nearly the same as those obtained when MRA-III is not ignored, but there are considerable redundant mesh points in the constant control regions. The technique selected 162 points from the maximum of 2561 points at the finest mesh \(V_{7,N}\). The mesh size is 1.6 times larger than that obtained when MRA-III is not ignored. The total CPU time for this example is 21.5 s. Again, this example demonstrates the advantages of the proposed method. Figure 8: Control solutions for the Williams-Otto semi-batch reactor problem using the proposed method: (**a**) Feed flow rate \(F_{\text{B,in}}(t)\); (**b**) cooling water temperature \(T_{W}(t)\). Figure 9: Mesh refinement history for the Williams-Otto semi-batch reactor problem. Additionally, the method of this paper was compared with the _hp_-adaptive pseudospectral method [35], which adjusts both the width and the number of mesh points in each segment by analyzing the state curvature. The optimality and feasibility tolerances for SNOPT were identical to those used in our method. The _hp_-adaptive method was executed using the open-source optimal control software GPOPS II 1.0 [43]. The _hp_-adaptive method terminated after 13 iterations and used 309 mesh points at the final iteration. The control solutions are shown in Figure 12. The obtained objective function value was \(-4768.313425\). It is seen in Figure 12 that the control solutions are similar to the results obtained from our method. However, the _hp_-adaptive method required 1.6 times more mesh iterations and generated a 3.06-fold larger mesh size when compared with our method. The CPU time required by the _hp_-adaptive method was 21.1 s, although GPOPS II used a quite efficient method to explore the NLP sparsity and calculate the NLP derivatives [44].