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

Generic Dosing Mechanism #1454

Open
betanalpha opened this issue May 21, 2015 · 0 comments
Open

Generic Dosing Mechanism #1454

betanalpha opened this issue May 21, 2015 · 0 comments
Labels
Milestone

Comments

@betanalpha
Copy link
Contributor

For many practical pharmacometric models the integrate_ode function is pretty limiting as it only solves the ODE system at given times but cannot modify the system at those times. A more generic function would require events, which pair an event time and some used-defined function that modifies the state of the ODE at that time, for example

void event_action(real[] states, real[] params, real[] x).

These events would then be collected into a dynamically-sized vector of events,

event_table events;
event_table.add(1, increment_1);
...
event_table.add(493, multiply_2);

which would be passed into a new integrate function,

integrate_ode_with_events(ode, y0, t0, ts, events, theta, x_r, x_i).

This new function then concatenates the vector of observation times and the
event times, removes duplicates, and orders the unique times. The solver is
run to each time, with the resulting state saved if an observation if necessary
and then input to the event functor if necessary.

Thoughts? This would require introducing a type with a method which would
be new to the language. Maybe just having an add_event function with an
event_table and function as arguments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants