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

Default to using fully_determined when possible in initialization #2909

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
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
18 changes: 12 additions & 6 deletions src/systems/diffeqs/abstractodesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ function process_DEProblem(constructor, sys::AbstractODESystem, u0map, parammap;
warn_initialize_determined = true,
build_initializeprob = true,
initialization_eqs = [],
fully_determined = false,
fully_determined = nothing,
check_units = true,
kwargs...)
eqs = equations(sys)
Expand Down Expand Up @@ -1380,7 +1380,7 @@ InitializationProblem{iip}(sys::AbstractODESystem, u0map, tspan,
simplify = false,
linenumbers = true, parallel = SerialForm(),
initialization_eqs = [],
fully_determined = false,
fully_determined = nothing,
kwargs...) where {iip}
```

Expand Down Expand Up @@ -1439,11 +1439,17 @@ function InitializationProblem{iip, specialize}(sys::AbstractODESystem,
if isempty(u0map) && get_initializesystem(sys) !== nothing
isys = get_initializesystem(sys; initialization_eqs, check_units)
elseif isempty(u0map) && get_initializesystem(sys) === nothing
isys = structural_simplify(
generate_initializesystem(sys; initialization_eqs, check_units); fully_determined)
isys = generate_initializesystem(sys; initialization_eqs, check_units)
_fully_determined = fully_determined === nothing ?
length(equations(isys)) == length(unknowns(isys)) :
fully_determined
isys = structural_simplify(isys; _fully_determined)
else
isys = structural_simplify(
generate_initializesystem(sys; u0map, initialization_eqs, check_units); fully_determined)
isys = generate_initializesystem(sys; u0map, initialization_eqs, check_units)
_fully_determined = fully_determined === nothing ?
length(equations(isys)) == length(unknowns(isys)) :
fully_determined
isys = structural_simplify(isys; _fully_determined)
end

uninit = setdiff(unknowns(sys), [unknowns(isys); getfield.(observed(isys), :lhs)])
Expand Down
Loading