We are trying to replace MPC (Model Predictive Control) control with Neural Network (NN). We generated enough data from MPC control of a MIMO (Multiple Inputs Multiple Outputs) system to be able to train our NN. As an input to NN, we used Reference (R), Previous Input (u_qp), and Outputs (y). As an output of NN, we consider inputs to the system. We are intending to use this NN as a regulator in a closed loop.
When we train NN using the standard loss function (MSE) we ran into a problem during simulation. As we can see in the picture below, our NN is telling input (valve opening) to open at -1%. NN has no information that boundaries for valve opening are <0%-100%>. We can simply scale output to solve this problem but that can cause problems in the future. We need to train our NN to respect boundaries for Input.
To do that we modify the loss function to penalize output that crosses boundaries. We add a Relaxed Logarithmic Barrier to our current loss function. We call NN with this modification of loss function NN with barrier. We use weights of previously trained NN to further training. Because the Relaxed Logarithmic Barrier penalize crossing the boundaries NN is trained to not cross them. In the picture below we can see input, generated by NN with barrier in simulation, that does not cross the boundaries in comparison to Standard NN that crosses the boundary of 0%.