PINN with two boundary conditions


I am working on a physically informed neural network solution of ODE with two boundary conditions. In a standard initial value problem, let’s say y(x) - y’(x) = 0 with y(0) = 1, I would use approximation in a form

y(x) = 1.0 + x*NN(x)

where NN(x) is a neural network. However, I need to solve a differential equation on the X \in [x_low,x_high] interval with one boundary condition on x_low and second x_high. Any idea, how to “hard-code” the boundary condition into the approximator, or do I had to enforce these boundary conditions through the loss function term?


y(x) = y(x_low)*(x-x_high) + y(x_high)*(x-x_low) + (x-x_low)*(x-x_high)*NN(x)

or just use NeuralPDE.jl and add two terms to the loss for y(x_low) - known value and y(x_high) - konwn value.

@ChrisRackauckas Thank you!