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

Move ivpsolve.adaptive and ivpsolve.control* to ivpsolvers because they are solver components #798

Merged
merged 2 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions docs/benchmarks/hires/run_hires.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def param_to_solution(tol):
ts1 = ivpsolvers.correction_ts1(ssm=ssm)
strategy = ivpsolvers.strategy_filter(ssm=ssm)
solver = ivpsolvers.solver_dynamic(strategy, prior=ibm, correction=ts1, ssm=ssm)
control = ivpsolve.control_proportional_integral(clip=True)
adaptive_solver = ivpsolve.adaptive(
control = ivpsolvers.control_proportional_integral(clip=True)
adaptive_solver = ivpsolvers.adaptive(
solver, atol=1e-2 * tol, rtol=tol, control=control, ssm=ssm
)

Expand Down
4 changes: 2 additions & 2 deletions docs/benchmarks/lotkavolterra/run_lotkavolterra.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def param_to_solution(tol):
strategy = ivpsolvers.strategy_filter(ssm=ssm)
corr = correction(ssm=ssm)
solver = ivpsolvers.solver_mle(strategy, prior=ibm, correction=corr, ssm=ssm)
control = ivpsolve.control_proportional_integral()
adaptive_solver = ivpsolve.adaptive(
control = ivpsolvers.control_proportional_integral()
adaptive_solver = ivpsolvers.adaptive(
solver, atol=1e-2 * tol, rtol=tol, control=control, ssm=ssm
)

Expand Down
4 changes: 2 additions & 2 deletions docs/benchmarks/pleiades/run_pleiades.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def param_to_solution(tol):
solver = ivpsolvers.solver_dynamic(
strategy, prior=ibm, correction=ts0_or_ts1, ssm=ssm
)
control = ivpsolve.control_proportional_integral()
adaptive_solver = ivpsolve.adaptive(
control = ivpsolvers.control_proportional_integral()
adaptive_solver = ivpsolvers.adaptive(
solver, atol=1e-3 * tol, rtol=tol, control=control, ssm=ssm
)

Expand Down
4 changes: 2 additions & 2 deletions docs/benchmarks/vanderpol/run_vanderpol.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def param_to_solution(tol):
solver = ivpsolvers.solver_dynamic(
strategy, prior=ibm, correction=ts0_or_ts1, ssm=ssm
)
control = ivpsolve.control_proportional_integral(clip=True)
adaptive_solver = ivpsolve.adaptive(
control = ivpsolvers.control_proportional_integral(clip=True)
adaptive_solver = ivpsolvers.adaptive(
solver, atol=1e-3 * tol, rtol=tol, control=control, ssm=ssm
)

Expand Down
2 changes: 1 addition & 1 deletion docs/examples_misc/use_equinox_bounded_while_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def vf(y, *, t): # noqa: ARG001

strategy = ivpsolvers.strategy_fixedpoint(ssm=ssm)
solver = ivpsolvers.solver(strategy, prior=ibm, correction=ts0, ssm=ssm)
adaptive_solver = ivpsolve.adaptive(solver, ssm=ssm)
adaptive_solver = ivpsolvers.adaptive(solver, ssm=ssm)
init = solver.initial_condition()

def simulate(init_val):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def solve_adaptive(theta, *, save_at):
ts0 = ivpsolvers.correction_ts0(ssm=ssm)
strategy = ivpsolvers.strategy_filter(ssm=ssm)
solver = ivpsolvers.solver(strategy, prior=ibm, correction=ts0, ssm=ssm)
adaptive_solver = ivpsolve.adaptive(solver, ssm=ssm)
adaptive_solver = ivpsolvers.adaptive(solver, ssm=ssm)

init = solver.initial_condition()
return ivpsolve.solve_adaptive_save_at(
Expand Down
2 changes: 1 addition & 1 deletion docs/examples_quickstart/easy_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def vf(y, *, t): # noqa: ARG001

# Build a solver
solver = ivpsolvers.solver_mle(strategy, prior=ibm, correction=ts0, ssm=ssm)
adaptive_solver = ivpsolve.adaptive(solver, ssm=ssm)
adaptive_solver = ivpsolvers.adaptive(solver, ssm=ssm)
# -


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def vector_field(y, t): # noqa: ARG001
ts1 = ivpsolvers.correction_ts1(ssm=ssm)
strategy = ivpsolvers.strategy_fixedpoint(ssm=ssm)
solver = ivpsolvers.solver(strategy, prior=ibm, correction=ts1, ssm=ssm)
adaptive_solver = ivpsolve.adaptive(solver, atol=1e-1, rtol=1e-2, ssm=ssm)
adaptive_solver = ivpsolvers.adaptive(solver, atol=1e-1, rtol=1e-2, ssm=ssm)

dt0 = ivpsolve.dt0(lambda y: vector_field(y, t=t0), (u0,))

Expand Down
4 changes: 2 additions & 2 deletions docs/examples_solver_config/posterior_uncertainties.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def vf(*ys, t): # noqa: ARG001
ts0 = ivpsolvers.correction_ts0(ssm=ssm)
strategy = ivpsolvers.strategy_filter(ssm=ssm)
solver = ivpsolvers.solver_mle(strategy, prior=ibm, correction=ts0, ssm=ssm)
adaptive_solver = ivpsolve.adaptive(solver, atol=1e-2, rtol=1e-2, ssm=ssm)
adaptive_solver = ivpsolvers.adaptive(solver, atol=1e-2, rtol=1e-2, ssm=ssm)

ts = jnp.linspace(t0, t0 + 2.0, endpoint=True, num=500)

Expand Down Expand Up @@ -118,7 +118,7 @@ def vf(*ys, t): # noqa: ARG001
ts0 = ivpsolvers.correction_ts0(ssm=ssm)
strategy = ivpsolvers.strategy_fixedpoint(ssm=ssm)
solver = ivpsolvers.solver_mle(strategy, prior=ibm, correction=ts0, ssm=ssm)
adaptive_solver = ivpsolve.adaptive(solver, atol=1e-2, rtol=1e-2, ssm=ssm)
adaptive_solver = ivpsolvers.adaptive(solver, atol=1e-2, rtol=1e-2, ssm=ssm)

ts = jnp.linspace(t0, t0 + 2.0, endpoint=True, num=500)

Expand Down
4 changes: 2 additions & 2 deletions docs/examples_solver_config/second_order_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def vf_1(y, t): # noqa: ARG001
ts0 = ivpsolvers.correction_ts0(ssm=ssm)
strategy = ivpsolvers.strategy_filter(ssm=ssm)
solver_1st = ivpsolvers.solver_mle(strategy, prior=ibm, correction=ts0, ssm=ssm)
adaptive_solver_1st = ivpsolve.adaptive(solver_1st, atol=1e-5, rtol=1e-5, ssm=ssm)
adaptive_solver_1st = ivpsolvers.adaptive(solver_1st, atol=1e-5, rtol=1e-5, ssm=ssm)


# -
Expand Down Expand Up @@ -88,7 +88,7 @@ def vf_2(y, dy, t): # noqa: ARG001
ts0 = ivpsolvers.correction_ts0(ode_order=2, ssm=ssm)
strategy = ivpsolvers.strategy_filter(ssm=ssm)
solver_2nd = ivpsolvers.solver_mle(strategy, prior=ibm, correction=ts0, ssm=ssm)
adaptive_solver_2nd = ivpsolve.adaptive(solver_2nd, atol=1e-5, rtol=1e-5, ssm=ssm)
adaptive_solver_2nd = ivpsolvers.adaptive(solver_2nd, atol=1e-5, rtol=1e-5, ssm=ssm)


init = solver_2nd.initial_condition()
Expand Down
2 changes: 1 addition & 1 deletion docs/examples_solver_config/taylor_coefficients.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def solve(tc):
init = solver.initial_condition()

ts = jnp.linspace(t0, t1, endpoint=True, num=10)
adaptive_solver = ivpsolve.adaptive(solver, atol=1e-2, rtol=1e-2, ssm=ssm)
adaptive_solver = ivpsolvers.adaptive(solver, atol=1e-2, rtol=1e-2, ssm=ssm)
return ivpsolve.solve_adaptive_save_at(
vf, init, save_at=ts, adaptive_solver=adaptive_solver, dt0=0.1, ssm=ssm
)
Expand Down
Loading
Loading