Skip to content

Variable Bounds in OrdinaryDiffEq and Logging updates - #4872

Open
Shreyas-Ekanathan wants to merge 1 commit into
SciML:masterfrom
Shreyas-Ekanathan:variable_bounds_checks
Open

Variable Bounds in OrdinaryDiffEq and Logging updates#4872
Shreyas-Ekanathan wants to merge 1 commit into
SciML:masterfrom
Shreyas-Ekanathan:variable_bounds_checks

Conversation

@Shreyas-Ekanathan

Copy link
Copy Markdown
Contributor

Hooks MTK's variable bounds into OrdinaryDiffEq's isoutofdomain and reports any variable bound failures in the logging messages.

Example result:

@variables x(t) [bounds = (0.0, 10.0)]
@variables y(t) [bounds = (-1.0, 5.0)]
@mtkbuild sys = ODESystem([D(x) ~ 1.0, D(y) ~ -1.0], t)
prob = ODEProblem(sys, [x => 0.0, y => 0.0], (0.0, 3.0); enforce_bounds = true) #new kwarg
sol = solve(prob, Tsit5())

┌ Warning: Verbosity toggle: dt_epsilon 
│  At t=1.0, dt was forced below floating point epsilon 2.220446049250313e-16. Aborting. There is either an error in your model specification or the true solution is unstable (or it cannot be represented in Float64 precision).
│ 
│ Diagnostics:
│ 
│ Is Out of Domain: Gates results of integrator steps:
│   isoutofdomain predicate returned true for the proposed state, causing failure of the step
│ 
│ Declared variable bounds violated:y(t) fell below its lower bound -1.0 by 2.22e-16
└ @ SciMLBase ~/Documents/GitHub/SciMLBase.jl/src/integrator_interface.jl:1015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant