Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing a function to be called multiple times with different inputs #627

Draft
wants to merge 49 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ed280a6
Modified 1D approx test to show get_argument bug
nicholaskl97 Sep 2, 2022
1c0f0d0
Updated get_argument for eval with multiple inputs
nicholaskl97 Oct 27, 2022
63e0ddc
Forced get_argument when strategy != Quadrature
nicholaskl97 Oct 27, 2022
4e7b1b8
Test file for fixing get_argument
nicholaskl97 Oct 27, 2022
8a612dc
Test file for debugging symbolic_discretize
nicholaskl97 Oct 27, 2022
83e2475
transform_expression uses indvars now
nicholaskl97 Dec 31, 2022
13df657
Some test files
nicholaskl97 Dec 31, 2022
b17f92b
Merge branch 'master' into get_argument-fix
nicholaskl97 Dec 31, 2022
e885f45
Reverted get_argument to original state
nicholaskl97 Dec 31, 2022
74a2749
Removed temporary debug files
nicholaskl97 Dec 31, 2022
d0df2a3
Updated _vcat to accept multiple arguments
nicholaskl97 Jan 1, 2023
41a75f6
get_argument returns all args no just first per eq
nicholaskl97 Jan 12, 2023
c5d9960
Added implicit 1D and another 2D test case
nicholaskl97 Jan 12, 2023
64b56de
generate gridtrain trainsets based of pde vars
nicholaskl97 Jan 12, 2023
55fa847
added OptimJL and OptimOptimisers
nicholaskl97 Jan 12, 2023
b7e3d7a
get_bounds works with new transform_expression
nicholaskl97 Jan 12, 2023
fb199e4
Added test of ODE with hard constraint ic
nicholaskl97 Jan 12, 2023
2572dbf
_vcat now fills out scalar inputs to match batches
nicholaskl97 Jan 24, 2023
3e36fbe
cord now only has variables that show up in the eq
nicholaskl97 Jan 26, 2023
d115eae
GridTraining train_sets now work on the GPU
nicholaskl97 Feb 7, 2023
abb85a8
_vcat maintains Array types when filling
nicholaskl97 Feb 7, 2023
c7d3dc5
Formatting change
nicholaskl97 Feb 7, 2023
d9da546
StochasticTraining now actually uses bcs_points
nicholaskl97 Feb 17, 2023
18338d3
get_bounds uses bcs_points
nicholaskl97 Feb 17, 2023
cee31db
get_bounds uses get_variables
nicholaskl97 Feb 17, 2023
ea1c3b0
Merge branch 'master' into master
nicholaskl97 Feb 17, 2023
be3abf1
Increased test number of points
nicholaskl97 Feb 20, 2023
308454c
get_bounds is now okay with eqs with no variables
nicholaskl97 Feb 20, 2023
09b6cf6
symbolic_utilities doesn't need LinearAlgebra
nicholaskl97 Feb 20, 2023
6e4206b
Merge remote-tracking branch 'origin/master' into get_argument-fix
nicholaskl97 Feb 21, 2023
55d142a
Can now handle Ix(u(x,1)) and not just Ix(u(x,y))
nicholaskl97 Feb 21, 2023
a9b6b47
import ComponentArrays used in training_strategies
nicholaskl97 Feb 21, 2023
f815469
Added import ComponentArrays statements
nicholaskl97 Feb 22, 2023
5889a1b
Revert "Added import ComponentArrays statements"
nicholaskl97 Feb 22, 2023
424a7ef
Revert "import ComponentArrays used in training_strategies"
nicholaskl97 Feb 22, 2023
d581889
Revert "added OptimJL and OptimOptimisers"
nicholaskl97 Feb 22, 2023
edcb1a7
Replaced Lux.ComponentArray with using Co...Arrays
nicholaskl97 Feb 22, 2023
b07ae13
Formatted with JuliaFormtter
nicholaskl97 Feb 23, 2023
7a1e0b5
Docstrings were counting against code coverage
nicholaskl97 Mar 7, 2023
7f527c7
Improperly used docstrings changed to comments
nicholaskl97 Mar 8, 2023
530d50e
Added comments for _vcat
nicholaskl97 Mar 8, 2023
48c8b04
Merge remote-tracking branch 'origin/master' into get_argument-fix
nicholaskl97 Mar 8, 2023
e4f1536
Updated docstring for build_symbolic_loss_function
nicholaskl97 Mar 9, 2023
238b315
Reductions needed inits for cases like u(0)=0
nicholaskl97 Mar 10, 2023
44f3a28
Formatted with JuliaFormatter
nicholaskl97 Mar 10, 2023
fc7d36c
Added a new integral test
nicholaskl97 Apr 3, 2023
550ab40
Merge remote-tracking branch 'origin/master' into get_argument-fix
nicholaskl97 Apr 3, 2023
4dcf2a8
Merge remote-tracking branch 'origin/master'
nicholaskl97 May 29, 2023
00f07fc
Merge remote-tracking branch 'origin/master'
nicholaskl97 Jul 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/symbolic_utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -460,21 +460,21 @@ function get_argument(eqs, _indvars::Array, _depvars::Array)
get_argument(eqs, dict_indvars, dict_depvars)
end
function get_argument(eqs, dict_indvars, dict_depvars)
"""Equations, as expressions"""
"Equations, as expressions"
nicholaskl97 marked this conversation as resolved.
Show resolved Hide resolved
exprs = toexpr.(eqs)
nicholaskl97 marked this conversation as resolved.
Show resolved Hide resolved
"""Instances of each dependent variable that appears in the expression, by dependent variable, by equation"""
"Instances of each dependent variable that appears in the expression, by dependent variable, by equation"
vars = map(exprs) do expr # For each equation,...
"""Arrays of instances of each dependent variable, by dependent variable"""
"Arrays of instances of each dependent variable, by dependent variable"
_vars = map(depvar -> find_thing_in_expr(expr, depvar), collect(keys(dict_depvars)))
"""Arrays of instances of each dependent variable that appears in the expression, by dependent variable"""
"Arrays of instances of each dependent variable that appears in the expression, by dependent variable"
f_vars = filter(x -> !isempty(x), _vars)
end
# vars = [depvar for expr in vars for depvar in expr ]
args_ = map(vars) do _vars
"""Arguments of all instances of dependent variable, by instance, by dependent variable"""
"Arguments of all instances of dependent variable, by instance, by dependent variable"
ind_args_ = map.(var -> var.args[2:end], _vars)
syms = Set{Symbol}()
"""All arguments in any instance of a dependent variable"""
"All arguments in any instance of a dependent variable"
nicholaskl97 marked this conversation as resolved.
Show resolved Hide resolved
all_ind_args = vcat((ind_args_...)...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduce(vcat,...)


# Add any independent variables from expression dependent variable calls
Expand Down
4 changes: 2 additions & 2 deletions test/NNPDE_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ domains = [x ∈ Interval(0.0, 1.0)]
chain = [[Lux.Chain(Lux.Dense(1, 12, Lux.tanh), Lux.Dense(12, 12, Lux.tanh),
Lux.Dense(12, 1)) for _ in 1:3]
[Lux.Chain(Lux.Dense(1, 4, Lux.tanh), Lux.Dense(4, 1)) for _ in 1:2]]
quasirandom_strategy = NeuralPDE.QuasiRandomTraining(130; #points
quasirandom_strategy = NeuralPDE.QuasiRandomTraining(200; #points
sampling_alg = LatinHypercubeSample())

discretization = NeuralPDE.PhysicsInformedNN(chain, quasirandom_strategy)
Expand All @@ -372,7 +372,7 @@ cb_ = function (p, l)
return false
end

res = solve(prob, OptimizationOptimJL.BFGS(); maxiters = 1000)
res = solve(prob, OptimizationOptimJL.BFGS(); maxiters = 1500)
phi = discretization.phi[1]

analytic_sol_func(x) = (π * x * (-x + (π^2) * (2 * x - 3) + 1) - sin(π * x)) / (π^3)
Expand Down