1#ifndef CGMRES__INTEGRATOR_HPP_
2#define CGMRES__INTEGRATOR_HPP_
17template <
typename OCP,
typename StateVectorType,
typename ControlInputVectorType>
23 ocp.eval_f(t, x, u, x1);
39template <
typename OCP,
typename StateVectorType,
typename ControlInputVectorType>
49 ocp.eval_f(t, x, u, k1);
50 x1 = x + 0.5 * dt * k1;
51 ocp.eval_f(t+0.5*dt, x1, u, k2);
52 x1 = x + dt * 0.5 * (std::sqrt(2.0)-1.0) * k1 + dt*(1.0-(1.0/std::sqrt(2.0))) * k2;
53 ocp.eval_f(t+0.5*dt, x1, u, k3);
54 x1 = x - dt * 0.5 * std::sqrt(2.0) * k2 + dt * (1.0+(1.0/std::sqrt(2.0))) * k3;
55 ocp.eval_f(t+dt, x1, u, k4);
56 x1 = x + (dt/6.0) * (k1+(2.0-std::sqrt(2.0))*k2 + (2.0+std::sqrt(2.0))*k3+k4);
Definition: continuation_gmres.hpp:11
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorX
Alias of Eigen::VectorXd (dynamic-size vector).
Definition: types.hpp:39
VectorX RK4(const OCP &ocp, const Scalar t, const Scalar dt, const MatrixBase< StateVectorType > &x, const MatrixBase< ControlInputVectorType > &u)
Computes the next state by the 4th-order Runge-Kutta method.
Definition: integrator.hpp:40
VectorX ForwardEuler(const OCP &ocp, const Scalar t, const Scalar dt, const MatrixBase< StateVectorType > &x, const MatrixBase< ControlInputVectorType > &u)
Computes the next state by the forward Euler.
Definition: integrator.hpp:18
double Scalar
Alias of double.
Definition: types.hpp:11
Eigen::MatrixBase< MatrixType > MatrixBase
Alias of Eigen::MatrixBase.
Definition: types.hpp:29