Changeset 16222 for branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs
 Timestamp:
 10/09/18 16:49:05 (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs
r16215 r16222 609 609 610 610 #region interpretation 611 612 // the following uses autodiff to calculate the gradient w.r.t. the parameters forward in time. 613 // this is basically the method described in Gronwall T. Note on the derivatives with respect to a parameter of the solutions of a system of differential equations. Ann. Math. 1919;20:292–296. 614 615 // a comparison of three potential calculation methods for the gradient is given in: 616 // Sengupta, B., Friston, K. J., & Penny, W. D. (2014). Efficient gradient computation for dynamical models. Neuroimage, 98(100), 521–527. http://doi.org/10.1016/j.neuroimage.2014.04.040 617 // "Our comparison establishes that the adjoint method is computationally more efficient for numerical estimation of parametric gradients 618 // for statespace models — both linear and nonlinear, as in the case of a dynamical causal model (DCM)" 619 620 // for a solver with the necessary features see: https://computation.llnl.gov/projects/sundials/cvodes 621 /* 622 * SUNDIALS: SUite of Nonlinear and DIfferential/ALgebraic Equation Solvers 623 * CVODES 624 * CVODES is a solver for stiff and nonstiff ODE systems (initial value problem) given in explicit 625 * form y’ = f(t,y,p) with sensitivity analysis capabilities (both forward and adjoint modes). CVODES 626 * is a superset of CVODE and hence all options available to CVODE (with the exception of the FCVODE 627 * interface module) are also available for CVODES. Both integration methods (AdamsMoulton and BDF) 628 * and the corresponding nonlinear iteration methods, as well as all linear solver and preconditioner 629 * modules, are available for the integration of the original ODEs, the sensitivity systems, or the 630 * adjoint system. Depending on the number of model parameters and the number of functional outputs, 631 * one of two sensitivity methods is more appropriate. The forward sensitivity analysis (FSA) method 632 * is mostly suitable when the gradients of many outputs (for example the entire solution vector) with 633 * respect to relatively few parameters are needed. In this approach, the model is differentiated with 634 * respect to each parameter in turn to yield an additional system of the same size as the original 635 * one, the result of which is the solution sensitivity. The gradient of any output function depending 636 * on the solution can then be directly obtained from these sensitivities by applying the chain rule 637 * of differentiation. The adjoint sensitivity analysis (ASA) method is more practical than the 638 * forward approach when the number of parameters is large and the gradients of only few output 639 * functionals are needed. In this approach, the solution sensitivities need not be computed 640 * explicitly. Instead, for each output functional of interest, an additional system, adjoint to the 641 * original one, is formed and solved. The solution of the adjoint system can then be used to evaluate 642 * the gradient of the output functional with respect to any set of model parameters. The FSA module 643 * in CVODES implements a simultaneous corrector method as well as two flavors of staggered corrector 644 * methods–for the case when sensitivity right hand sides are generated all at once or separated for 645 * each model parameter. The ASA module provides the infrastructure required for the backward 646 * integration in time of systems of differential equations dependent on the solution of the original 647 * ODEs. It employs a checkpointing scheme for efficient interpolation of forward solutions during the 648 * backward integration. 649 */ 611 650 private static IEnumerable<Tuple<double, Vector>[]> Integrate( 612 651 ISymbolicExpressionTree[] trees, IDataset dataset, string[] inputVariables, string[] targetVariables, string[] latentVariables, IEnumerable<IntRange> episodes,
Note: See TracChangeset
for help on using the changeset viewer.