tracking controller that is trained on a reference generated by an exo-system ${\boldsymbol{f}}_{\text{ref}}$ are presented and discussed in Section \[sectionsimulation\] before the paper is concluded in Section \[conclusion\].

Problem Definition {#problem_def}
==================

Consider a discrete-time linear system $$\begin{aligned}
{\boldsymbol{x}}_{k+1} = {\boldsymbol{A}}{\boldsymbol{x}}_{k} + {\boldsymbol{B}}{\boldsymbol{u}}_{k}, \label{eq:System}\end{aligned}$$ where $k \in \mathbb{N}_0$ is the discrete time step, $\bm{x}_{k} \in \mathbb{R}^{n}$ the state vector and $\bm{u}_k \in \mathbb{R}^{m}$ the input vector. Both the system matrix ${\boldsymbol{A}}\in\mathbb{R}^{n\times n}$ and the input matrix ${\boldsymbol{B}}\in\mathbb{R}^{n\times m}$ are unknown, albeit the system $({\boldsymbol{A}}, {\boldsymbol{B}})$ is assumed to be controllable.

Assume that at each time step k, an arbitrary reference $\tilde{{\boldsymbol{r}}}_i^{(k)}\in\mathbb{R}^n$ is given on a moving horizon of length $N$, where $i$ is the time index starting at $k$. Beyond the horizon $N$, let the reference be ${\boldsymbol{0}}$. Thus, $$\begin{aligned}
\label{eq:ref}
{\boldsymbol{r}}_i^{(k)}=\begin{cases}\tilde{{\boldsymbol{r}}}_i^{(k)}, &\text{for } i=k,\dots,k+N \\ {\boldsymbol{0}}, &\text{for } i=k+N+1,\dots,\infty\end{cases}\end{aligned}$$ follows.

Our aim is to learn to track ${\boldsymbol{r}}_i^{(k)}$ optimally w.r.t. the quadratic cost $$\begin{aligned}
J_k &= \sum \limits_{i=k}^{\infty}\gamma^{i-k}\underbrace{\frac{1}{2}\left({\boldsymbol{e}}_i^\intercal{\boldsymbol{Q}}{\boldsymbol{e}}_i + {\boldsymbol{u}}_i^\intercal{\boldsymbol{R}}{\boldsymbol{u}}_i\right)}_{c\left({\boldsymbol{x}}_i,{\boldsymbol{u}}_i, {\boldsymbol{r}}_i\right)=c_i} \label{eq:Kostena}\end{aligned}$$ that has to be minimized. Note that we write ${\boldsymbol{r}}_i={\boldsymbol{r}}_i^{(k)}$ for brevity of notation in the following as $J_k$ indicates that the reference ${\boldsymbol{r}}_i^{(k)}$ starting at $k$ is used according to . Here, ${\boldsymbol{e}}_i={\boldsymbol{x}}_i-{\boldsymbol{r}}_i$ is the deviation 