We study physics-informed neural networks (PINNs) as numerical tools for the optimal control of semilinear partial differential equations. We first recall the classical direct and indirect viewpoints for optimal control of PDEs, and then present two PINN formulations: a direct formulation based on minimizing the objective under the state constraint, and an indirect formulation based on the first-order optimality system. For a class of semilinear parabolic equations, we derive the state equation, the adjoint equation, and the stationarity condition in a form consistent with continuous-time Pontryagin-type optimality conditions. We then specialize the framework to an Allen-Cahn control problem and compare three numerical approaches: (i) a discretize-then-optimize adjoint method, (ii) a direct PINN, and (iii) an indirect PINN. Numerical results show that the PINN parameterization has an implicit regularizing effect, in the sense that it tends to produce smoother control profiles. They also indicate that the indirect PINN more faithfully preserves the PDE contraint and optimality structure and yields a more accurate neural approximation than the direct PINN.
Figures & tables
Fig. 1 : Loss histories for the three approaches: adjoint optimization starting from scratch (top), direct PINN (middle), and indirect PINN (bottom). In the adjoint panel, the legend shows the total objective J , the terminal tracking term JT , the control regularization term Ju , and the relative L2 error of the control, relL2(u) . In the direct PINN panel, the legend additionally separates the PDE, boundary-condition (BC), and initial-condition (IC) residual losses, together with JT , Ju , and relL2(u) . In the indirect PINN panel, the legend further includes the residual losses associated with the adjoint equation ( PDEλ ), adjoint boundary condition ( BCλ ), and terminal optimality condition ( T(λ) ), in addition to the state PDE/BC/IC residuals, the total loss, and relL2(u) . For the PINN cases, only the SSBroyden phase is shown after the short Adam warm-up, and the total wall-clock time of each method is indicated in the panel title.
Fig. 2 : Control profiles, shown from top to bottom: adjoint starting from scratch, direct PINN, indirect PINN, and adjoint initialized from the direct PINN solution, which is treated as the reference value for this optimal control problem. The relative L2 errors of control are shown in titles. Note that according to the optimality condition, the terminal solution is y(T)=−βQu(T),βQ=1×10−3 .
Fig. 3 : State trajectories corresponding to the converged controls, shown from top to bottom: adjoint starting from scratch, direct PINN, indirect PINN, and adjoint initialized from the direct PINN solution. For the PINN-based methods, each panel also compares the state predicted directly by the neural network with the state recomputed by the numerical solver using the converged PINN control. The relative L2 error of each time snapshot is marked in the legend.