Rolling horizon methods often arise in the world of optimal control, when you want to solve
\begin{aligned}
(P)\qquad\min_{x,u}&\quad\sum_{t=0}^T c_t(x_t, u_t)\\
\text{s.t.}&\quad x_{t+1} = f_t(x_t, u_t) & \forall t=0, \cdots, T\\
&\quad x_t \in X_t, \; u_t\in U_t &\forall t =0, \cdots, T
\end{aligned}
with $t$ denoting the time ($T$ being the final time), $x_t$ the state at time $t$, $u_t$ the control, $c_t$ a cost function penalizing $x_t$ and $u_t$, $X_t$ and $U_t$ the admissible sets and $f_t$ a dynamics function.
The rolling horizon method (for a reference, see e.g. Bertsekas, Dimitri P. Dynamic programming and optimal control) is a method to solve approximately problem $(P)$, in an iterative fashion. Starting from an initial position $x_0$, proceed as follow.
- Fix an horizon $h \in \mathbb{N}$.
- At time $k$, starting from a position $\tilde x_k$, solve the optimization problem
\begin{aligned}
(\tilde P_k)\quad\min_{x,u} &\quad \sum_{t=k}^{k+h} c_t(x_t, u_t)\\
\text{s.t.}&\quad x_{t+1} = f_t(x_t, u_t) &\forall t=k, \cdots, k+h \\
& x_t \in X_t, \; u_t\in U_t & \forall t =k, \cdots, k+h \\
& x_k = \tilde x_k
\end{aligned}
- Once problem $(\tilde P_k)$ solved, recover in the solution the next position $\tilde x_{k+1}$ and the control $\tilde u_k$. Reiterate the procedure at time $k+1$, this time starting from position $\tilde x_{k+1}$.
At the end, your approximate solution is given by the states $\tilde x_0, \cdots, \tilde x_k, \cdots, \tilde x_T$ and the controls $\tilde u_0, \cdots, \tilde u_k, \cdots, \tilde u_T$ you gathered during the previous procedure.
To sum up, you have to solve a collection of non-linear problems $(\tilde P_k)$, in an iterative fashion.
- If the problem $(\tilde P_{k+1})$ is similar as problem $(\tilde P_k)$, you may want to use Knitro so as to warmstart the resolution of $(\tilde P_{k+1})$ with the solution of $(\tilde P_k)$. The ideal would be to instantiate only a single instance of Knitro in memory, and then update this instance inline to reformulate a problem $(\tilde P_k)$ at time $k$. Since the introduction of an incremental API in Knitro 11.0, doing so is not that difficult.
- Interior points algorithms are not that efficient when warm-started. You may want to tune Knitro to use the SQP algorithm (
algorithm=4
in the option).
If you target to solve generic optimal control problems, I recommend you having a look at Casadi, which is a good library to formulate non-linear model predictive control (NMPC) problems and has a wrapper to Knitro.