LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::LsodaStepper Class Reference

One internal step at a time: ODEPACK's itask = 2. More...

#include <line/util/lsoda.h>

Public Member Functions

 LsodaStepper (const LsodaRhs &f, const std::vector< double > &y0, double t0, double t1, const LsodaOptions &opt=LsodaOptions())
bool step ()
 Advance one accepted step.
void settle_at_end ()
 Interpolate the state back onto t1 after itask = 2 stepped past it.
double t () const
double t_end () const
const std::vector< double > & y () const
int istate () const
bool failed () const
bool finished () const
std::size_t steps () const
std::size_t f_evals () const

Detailed Description

One internal step at a time: ODEPACK's itask = 2.

WHY THIS EXISTS. lsoda_integrate above reports the state only at the output times it was handed, and the integrator is free to do whatever it likes in between. MATLAB's odeset('NonNegative') is not a property of the output grid, it is a rule the STEP CONTROLLER applies to every accepted step – it charges a negative excursion as error, and it clips the accepted state and resets the divided-difference table. Reproducing that needs the trajectory one accepted step at a time, which is what this exposes; it is the analogue of scipy's LSODA.step(), which the native-Python port drives for the same reason.

THE RESTART IS THE HISTORY RESET. There is no way to reach into the vendored solver's Nordsieck array and rewrite it, and no need to: constructing a fresh stepper from a modified state is exactly what resetting the difference table accomplishes, because a first call (istate = 1) rebuilds the history from the initial state alone. The caller therefore expresses "clip and reset" by discarding the stepper and building another one.

step() may carry t() PAST t1, as itask = 2 always may; settle_at_end interpolates back onto t1 through the same history, which is what itask = 1 does on a continuation call.

Definition at line 286 of file lsoda.h.

Constructor & Destructor Documentation

◆ LsodaStepper()

line::LsodaStepper::LsodaStepper ( const LsodaRhs & f,
const std::vector< double > & y0,
double t0,
double t1,
const LsodaOptions & opt = LsodaOptions() )
inline

Definition at line 288 of file lsoda.h.

References line::InputError::InputError().

Member Function Documentation

◆ f_evals()

std::size_t line::LsodaStepper::f_evals ( ) const
inline

Definition at line 335 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ failed()

bool line::LsodaStepper::failed ( ) const
inline

Definition at line 332 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ finished()

bool line::LsodaStepper::finished ( ) const
inline

Definition at line 333 of file lsoda.h.

◆ istate()

int line::LsodaStepper::istate ( ) const
inline

Definition at line 331 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ settle_at_end()

void line::LsodaStepper::settle_at_end ( )
inline

Interpolate the state back onto t1 after itask = 2 stepped past it.

Definition at line 323 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ step()

bool line::LsodaStepper::step ( )
inline

Advance one accepted step.

False once the horizon is reached or LSODA gave up.

Definition at line 314 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ steps()

std::size_t line::LsodaStepper::steps ( ) const
inline

Definition at line 334 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ t()

double line::LsodaStepper::t ( ) const
inline

Definition at line 328 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ t_end()

double line::LsodaStepper::t_end ( ) const
inline

Definition at line 329 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().

◆ y()

const std::vector< double > & line::LsodaStepper::y ( ) const
inline

Definition at line 330 of file lsoda.h.

Referenced by line::lsoda_integrate_stepwise().


The documentation for this class was generated from the following file: