修复test_mql事件后积分步长控制

This commit is contained in:
huojiarong committed 2026-07-22 02:58:59 +00:00
1 parent a0855018d5
commit 2120901909
12 files changed
+222 -27

No files matched your search

+15 -10
View File
@@ -10,8 +10,9 @@ class SolveIVPConfig:
t_stop: float = 20.0
method: str = "BDF"
rtol: float = 1e-6
atol: float = 1e-8
atol: float = 1e-10
max_step: float = 1e-3
first_step: float | None = None
@dataclass(frozen=True)
@@ -91,12 +92,16 @@ def integrate_ode(
except ImportError:
return _runge_kutta_4(rhs, initial_state, config, t_eval)
return solve_ivp(
fun=rhs,
t_span=(config.t_start, config.t_stop),
y0=initial_state,
method=config.method,
rtol=config.rtol,
atol=config.atol,
t_eval=t_eval,
)
solve_options = {
"fun": rhs,
"t_span": (config.t_start, config.t_stop),
"y0": initial_state,
"method": config.method,
"rtol": config.rtol,
"atol": config.atol,
"max_step": config.max_step,
"t_eval": t_eval,
}
if config.first_step is not None:
solve_options["first_step"] = config.first_step
return solve_ivp(**solve_options)