@@ -77,7 +77,7 @@ res_ = solve(prob_, OptimizationOptimisers.Adam(5e-3); maxiters = 10000, callbac
7777
7878phi_ = PhysicsInformedNN(chain2, strategy; init_params = res_.u).phi
7979
80- xs, ys = [infimum (d.domain):0.01:supremum (d.domain) for d in domains]
80+ xs, ys = [leftendpoint (d.domain):0.01:rightendpoint (d.domain) for d in domains]
8181analytic_sol_func(x, y) = (sinpi(x) * sinpi(y)) / (2pi^2)
8282
8383u_predict = reshape([first(phi([x, y], res.u)) for x in xs for y in ys],
@@ -107,7 +107,8 @@ And then using the method neural_adapter, we retrain the batch of 10 predictions
107107
108108``` @example neural_adapter
109109using NeuralPDE, Lux, ModelingToolkit, Optimization, OptimizationOptimisers
110- using ModelingToolkit: Interval, infimum, supremum
110+ using ModelingToolkit: Interval
111+ using IntervalSets: leftendpoint, rightendpoint
111112
112113@parameters x y
113114@variables u(..)
@@ -137,7 +138,7 @@ af = tanh
137138inner = 10
138139chain = Chain(Dense(2, inner, af), Dense(inner, inner, af), Dense(inner, 1))
139140
140- xs_ = infimum (x_domain):(1 / count_decomp):supremum (x_domain)
141+ xs_ = leftendpoint (x_domain):(1 / count_decomp):rightendpoint (x_domain)
141142xs_domain = [(xs_[i], xs_[i + 1]) for i in 1:(length(xs_) - 1)]
142143domains_map = map(xs_domain) do (xs_dom)
143144 x_domain_ = Interval(xs_dom...)
190191function compose_result(dx)
191192 u_predict_array = Float64[]
192193 diff_u_array = Float64[]
193- ys = infimum (domains[2].domain):dx:supremum (domains[2].domain)
194- xs_ = infimum (x_domain):dx:supremum (x_domain)
194+ ys = leftendpoint (domains[2].domain):dx:rightendpoint (domains[2].domain)
195+ xs_ = leftendpoint (x_domain):dx:rightendpoint (x_domain)
195196 xs = collect(xs_)
196197 function index_of_interval(x_)
197198 for (i, x_domain) in enumerate(xs_domain)
@@ -208,7 +209,7 @@ function compose_result(dx)
208209 append!(u_predict_array, u_predict_sub)
209210 append!(diff_u_array, diff_u_sub)
210211 end
211- xs, ys = [infimum (d.domain):dx:supremum (d.domain) for d in domains]
212+ xs, ys = [leftendpoint (d.domain):dx:rightendpoint (d.domain) for d in domains]
212213 u_predict = reshape(u_predict_array, (length(xs), length(ys)))
213214 diff_u = reshape(diff_u_array, (length(xs), length(ys)))
214215 u_predict, diff_u
@@ -245,7 +246,7 @@ res_ = solve(prob_, OptimizationOptimisers.Adam(5e-3); maxiters = 5000, callback
245246
246247phi_ = PhysicsInformedNN(chain2, strategy; init_params = res_.u).phi
247248
248- xs, ys = [infimum (d.domain):dx:supremum (d.domain) for d in domains]
249+ xs, ys = [leftendpoint (d.domain):dx:rightendpoint (d.domain) for d in domains]
249250u_predict_ = reshape([first(phi_([x, y], res_.u)) for x in xs for y in ys],
250251 (length(xs), length(ys)))
251252u_real = reshape([analytic_sol_func(x, y) for x in xs for y in ys],
0 commit comments