Having one class TransitionModel for both discrete and continuous simulation is messed up, because one has to have two methods (discrete and continuous) for dynamics functions, for Jacobians and for simulations. This creates confusion when subclassing TransitionModel for the user: should I implement dyn_fcn_cont in addition to dyn_fcn? Not to mention the same holds for Jacobians and simulation functions. And the class has to support discrete and continuous SDE simulation - not good!
Solution
Create subclasses of TransitionModel for discrete and continuous simulation, such as DiscreteTimeTransitionModel and ContinousTimeTransitionModel, and move the dynamics specification and the simulation routines there. The common functionality, such as setting of initial condition random variable and noise random variable, can remain in the parent class TransitionModel.
Classes and their method could look something like this:
Problem
Having one class
TransitionModel
for both discrete and continuous simulation is messed up, because one has to have two methods (discrete and continuous) for dynamics functions, for Jacobians and for simulations. This creates confusion when subclassingTransitionModel
for the user: should I implementdyn_fcn_cont
in addition todyn_fcn
? Not to mention the same holds for Jacobians and simulation functions. And the class has to support discrete and continuous SDE simulation - not good!Solution
Create subclasses of
TransitionModel
for discrete and continuous simulation, such asDiscreteTimeTransitionModel
andContinousTimeTransitionModel
, and move the dynamics specification and the simulation routines there. The common functionality, such as setting of initial condition random variable and noise random variable, can remain in the parent classTransitionModel
.Classes and their method could look something like this:
TransitionModel
__init__(init_rv, noise_rv, noise_gain=None)
dyn_eval(xq, time, dx=False)