I’m looking at the “Enforcing physical constraints via universal differential-algebraic equations” example (Enforcing Physical Constraints via Universal Differential-Algebraic Equations · DiffEqFlux.jl), which trains a neural ordinary differential equation to solve a stiff ODE with constraints. The model is defined as follows:
model_stiff_ndae = NeuralODEMM(nn_dudt2, (u, p, t) -> [u + u + u - 1], tspan, M, Rodas5(autodiff=false), saveat = 0.1)
As best I can tell, the mass matrix
M = [1. 0 0 // 0 1. 0 // 0 0 0] and the constraint equation
(u, p, t) -> [u + u + u - 1] convey the same information: that the state variables of the ODE must always sum to 1. Why are both supplied in this example?