benmoseley / FBPINNs

Solve forward and inverse problems related to partial differential equations using finite basis physics-informed neural networks (FBPINNs)
MIT License
293 stars 59 forks source link

Force NN to find u within an inter-range #19

Open ciri1998 opened 1 month ago

ciri1998 commented 1 month ago

Good morning, I was wondering if it would be possible to force the NN to find the solution within 0, 1 for u[0] and between 2 and 3 for u[1] for example

benmoseley commented 2 weeks ago

One way might be to use hard constraints - see here for an example: https://github.com/benmoseley/FBPINNs/blob/main/examples/2.%20Using%20hard%20constraints%20-%201D%20harmonic%20oscillator.ipynb For example, if you want to restrict the solution to the range 0-1, you could pass the output of the network through a sigmoid function.