We study the problem of state transition on a finite time interval with minimal energy supply for linear port-Hamiltonian systems. While the cost functional of minimal energy supply is intrinsic to the port-Hamiltonian structure, the necessary conditions of optimality resulting from Pontryagin's maximum principle may yield singular arcs. The underlying reason is the linear dependence on the control, which makes the problem of determining the optimal control as a function of the state and the adjoint more complicated or even impossible. To resolve this issue, we fully characterize regularity of the (differential-algebraic) optimality system by using the interplay of the cost functional and the dynamics. In case of the optimality DAE being characterized by a regular matrix pencil, we fully determine the control on the singular arc. In case of singular matrix pencils of the optimality system, we propose an approach to compute rank-minimal quadratic perturbations of the objective such that the optimal control problem becomes regular. We illustrate the applicability of our results by a general second-order mechanical system and a discretized boundary-controlled heat equation.

Singular Optimal Control, port-Hamiltonian Systems, Regular Pencil, Hidden Regularity, Minimal Energy, Differential-Algebraic Equation, Index.

§ INTRODUCTION

Since their introduction  in [28] and especially in recent years, port-Hamiltonian systems have been successfully applied in the modeling of a wide variety of physical processes: mechanics [5, 6, 40, 26],  electrical engineering [36, 39], thermodynamics and fluid dynamics [1, 34, 35, 13], economics [25], see also [44, 10, 14] and the recent survey [30].

Recently, also optimal control of port-Hamiltonian systems has been given some attention, see, e.g., [16, 47]. Since port-Hamiltonian modeling is energy-based, the energy supplied to the system is readily available as a mathematical expression in terms of the ports and it is natural from an application point of view to employ it as the objective minimized in optimal control problems (OCPs), cf. [37, 11]. For an application to energy-optimal building control we refer to [38] and entropy-optimal control is considered in [31, 32].

However, the resulting OCP is a singular and standard solution techniques, e.g. construction of Riccati state feedback, are not directly applicable, see e.g. [29, 19]. One could instead employ general techniques for singular optimal control like those studied in
[2, 3]. But these approaches would not exploit
the particular structure of the port-Hamiltonian system and the chosen cost function. Instead we apply and extend techniques developed in [8] to derive, under weaker conditions than regularity of the optimal control problem, a condition that guarantees the existence of an optimal solution with a closed form for the associated optimal control. This weaker condition is related to the regularity of the matrix pencil, which is associated with the necessary optimality condition arising from a Pontryagin maximum principle.
The derivation of this general existence condition using the port-Hamiltonian structure of the OCP is at the center of our work. In the case where this existence condition fails to hold, we  provide a regularization procedure via minimal-rank perturbations of the cost functional such that the pencil associated with the optimality condition becomes regular.

For a fixed time horizon $T>0$, the problem of transferring an initial state $x_S\in\K^n$ of a port-Hamiltonian system under control constraints to a desired state $x_T\in\K^n$ with minimal energy supply can be formulated as

\begin{align}\label{eq:special_port-Hamiltonian_OCP0T}
\begin{split}
\min_{u\in L^1([0,T],\mathbb{K}^m)}\int_{0}^{T} \Re &\left(y(t)^H u(t)\right)\,\mathrm{d}t\\
\mathrm{s.t.}\quad  \tfrac{\mathrm{d}}{\mathrm{d}t}x(t) &= (J-R)Qx(t)+Bu(t) \quad \mathrm{for a.e.}\ t\in [0,T],\\ x(0) &= x_S,\ x(T) = x_T,\\
y(t) &= B^HQ x(t), \quad u(t) \in \mathbb{U} \quad \mathrm{for a.e.}\ t\in [0,T],
\end{split}
\end{align}

where $\mathbb{U} \subset \mathbb{K}^m$, $m\le n$, is a non-empty, convex and compact set, and

\begin{align*}
(J,R,Q,B)\in\PH := \set{(J,R,Q,B)\in\left(\mathbb{K}^{n\times n}\right)^3\times\mathbb{K}^{n\times m}\,\Big\vert\, J = -J^H,\, R = R^H\geq 0,\, Q = Q^H\geq 0}.
\end{align*}

The OCP (<ref>) was studied in [37, 11], see also [31] for a particular infinite-dimensional case. While in these papers it has been shown that, under a reachability condition of the terminal state, an optimal solution of (<ref>) typically exists, one can, a priori, not expect its uniqueness nor that the associated optimal control can be expressed as a state or output feedback in terms of the optimal trajectory and the associated Lagrange multiplier (also called costate or adjoint) in a unique way. To illustrate this issue, we consider the particular case of box constraints, that is,

\begin{align*}
\mathbb{U} = \set{z\in\K^m\,\big\vert\, \Re z_j\in[\ul v_j,\ol v_j],\;\Im z_j\in[\ul w_j,\ol w_j]\text{ for all $j\in\{1,\ldots,m\}$}},
\end{align*}

where $\ul v_j,\ul w_j,\ol v_j,\ol w_j\in\R$ with $\underline{v}_j\leq \overline{v}_j$ and $\underline{w}_j\leq\overline{w}_j$ for all $j\in\set{1,\ldots,m}$. By the Pontryagin maximum principle, see e.g. [23, 33, 22], for an optimal state-control pair $(x,u)\in W^{1,1}([0,T],\mathbb{K}^n)\times L^1([0,T];\mathbb{K}^m)$ there exist $\lambda \in W^{1,1}([0,T],\mathbb{K}^n)$ and a constant $\lambda_0\in\mathbb{K}$ such that $(\lambda(t),\lambda_0)\neq 0$ for all $t\in[0,T]$ and

\begin{align}
\tfrac{\mathrm{d}}{\mathrm{d}t}{\lambda}(t) & = -\big((J-R)Q\big)^H\lambda(t) - \lambda_0 QBu(t),\\
\tfrac{\mathrm{d}}{\mathrm{d}t}{x}(t) & = (J-R)Q x(t) + Bu(t),\\
u(t) & \in \argmin_{\bar{u}\in \mathbb{U}} \,\Re\left(\bar{u}^H B^H\left(\lambda_0 Qx(t) + \lambda(t)\right)\right) \label{eq:intro_optcond_control}
\end{align}

for a.e. $t\in[0,T]$.
Using the switching function $s(t) = B^H(\lambda_0 Qx(t) + \lambda(t))$, the pointwise minimization in (<ref>) yields the following componentwise characterization for almost all $t\in[0,T]$:

\begin{align}\label{eq:charac}
\begin{split}
&\Re s_j(t) > 0 \quad \mbox{implies} \quad \Re u_j(t) = \underline{v}_j \qquad \text{and} \qquad
\Im s_j(t) > 0 \quad \mbox{implies} \quad \Im u_j(t) = \ol{w}_j,\\
&\Re s_j(t) < 0 \quad\mbox{implies}\quad \Re u_j(t) = \overline{v}_j \qquad \text{and} \qquad
\Im s_j(t) < 0 \quad\mbox{implies}\quad \Im u_j(t) = \ul{w}_j.
\end{split}
\end{align}

However, if $\Re s_j(\cdot)$ vanishes on a set with non-zero Lebesgue measure,
then (<ref>) does not provide any information on $\Re u_j(\cdot)$ on that set. The same holds analogously for the imaginary part. If the set is an interval, the interval is called a singular arc, cf. [2, 48].

In <cit.> it was shown that the simple condition $\im B\cap\ker RQ = \{0\}$ allows for the unique characterization of the optimal control on singular arcs in terms of the optimal state $x$ and the adjoint $\lambda$. In Proposition <ref> below, we prove that the condition $\im B\cap\ker RQ = \{0\}$ can be characterized in terms of the Jordan structure associated with the eigenvalue $\infty$ (the Kronecker index) of the differential-algebraic optimality system along singular arcs.

In this paper, we are mainly interested in characterizations

of the optimal control on singular arcs, i.e. intervals on which some components of the switching function vanish.

To illustrate our approach, let us assume the control constraints are inactive on an interval $[t_0,t_1]$, $0\leq t_0< t_1 \leq T$. Consequently, all components of the switching function vanish on $[t_0,t_1]$ due to the contraposition of (<ref>). Then, the pointwise inclusion (<ref>) may be replaced with the algebraic condition $s(t) = 0$ for all $t\in [t_0,t_1]$ such that (<ref>) is a differential-algebraic equation (DAE).
Conversely, this DAE is the optimality system of the unconstrained counterpart of (<ref>), i.e.,

\begin{align}\label{eq:special_port-Hamiltonian_OCP}
\begin{split}
\min_{u\in L^1([t_0,t_1],\mathbb{K}^m)}\int_{t_0}^{t_1} \Re &\left(y(t)^H u(t)\right)\,\mathrm{d}t\\
\mathrm{s.t.}\quad
\tfrac{\mathrm{d}}{\mathrm{d}t}x(t) &= (J-R)Qx(t)+Bu(t)\quad \mbox{for a.e.}\ t\in [t_0,t_1],\\ x(t_0) &= x^0,\ x(t_1) = x^1,\\
y(t) &= B^HQ x(t)\quad \mbox{for a.e.}\ t\in [t_0,t_1],
\end{split}
\end{align}

where $x^0\in\K^n$ and $x^1\in\K^n$ are the states at which the optimal solution of (<ref>) enters, respectively,  leaves the singular arc.

only some (and not all) of the control constraints are inactive. Then, denoting the active and inactive set corresponding to the control constraints by $\mathcal{A}\subset \{1,\ldots,m\}$ and
$\mathcal{I} = \{1,\ldots,m\}\setminus \mathcal{A}$, respectively,
after suitable permutation one can split the control into $u = \begin{bmatrix}u_{\mathcal{I}}^\top,\,u_{\mathcal{A}}^\top\end{bmatrix}^\top$, which yields the dynamics

\begin{align*}
\frac{\mathrm{d}}{\mathrm{dt}} x(t) = (J-R)Qx(t) + B_\mathcal{I}u_\mathcal{I}(t) + B_\mathcal{A}u_{\mathcal{A}}(t).
\end{align*}

Here, $u_{\mathcal{A}}(t)$ is determined by the pointwise
minimization (<ref>) and can, thus, be treated as in inhomogeneity

$f(t) = B_\mathcal{A}u_{\mathcal{A}}(t)$ in the state equation of (<ref>). This splitting has to be adapted whenever the active set $\mathcal{A}$ changes.
However, for simplicity of exposition, we will analyse to the homogeneous case of (<ref>). All our considerations are generalizable to characterize the inactive controls in case of active constraints as the inhomogenities only enter the differential equations in (<ref>).

The approach in [8] studies the optimality conditions associated with (<ref>) obtained by the Pontryagin maximum principle. When this optimality system is regular in the DAE sense, then the optimal control is linearly determined by the optimal state trajectory and associated adjoint. Moreover, criteria on the existence and uniqueness of an optimal control can be deduced, see also [29] for a detailed discussion and numerical methods.

For cases where this regularity is not given, one can resort to regularizations of the OCP
via “small” perturbations of the original cost functional by a “small” quadratic term in the control and obtains the regularized optimal control problem

\begin{equation}\label{eq:perturbed_port-Hamiltonian_OCP}
\begin{aligned}
\min_{u\in L^1([t_0,t_1],\mathbb{K}^m)}\int_{t_0}^{t_1} \big[\Re&(y(t)^H u(t)) + u(t)^H\Q u(t)\big]\,\mathrm{d}t\\
\mathrm{s.t.}\quad  \tfrac{\mathrm{d}}{\mathrm{d}t}x(t) &= (J-R)Qx(t)+Bu(t)\quad \mbox{for a.e.\ }\ t\in [t_0,t_1],\\x(t_0) &= x^0,\ x(t_1) = x^1,\\
y(t) &= B^HQ x(t)\quad \mbox{for a.e.\ }\ t\in [t_0,t_1]
\end{aligned}
\end{equation}

for some $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$. In order to stay “close” to the original problem (<ref>), we aim to choose $\Q$ “minimally” (in the sense that the rank of $\Q$ is minimal) so that the associated optimality DAE is regular.

An alternative type of smallness of the regularization would be to set $S = \alpha I$ with small $\alpha > 0$, which corresponds to a Tikhonov regularization
as is typical in optimal control of partial differential equations [43].

This work is structured as follows. First, we recall the necessary and sufficient optimality conditions obtained from the Pontryagin maximum principle. These conditions are given as a linear DAE in the state, the adjoint, and the control. Solution formulas for this DAE in terms of the Drazin inverse can be applied if the associated pencil is regular. Therefore, we study the properties of this pencil in Section <ref>. Our results are summarized
in Figure <ref>.
In particular, in Subsection <ref>, we provide characterisations of regularity which extend Campbell's results [8] and relate them to the sufficient regularity condition
$\ker R\cap\im B = \set{0}$ proposed in <cit.>. Then, in Subsection <ref>, we use the characterisations of regularity to find a rank-minimal regularization term $\Q$. In Subsection <ref>, it is shown that the condition $\ker R\cap\im B = \set{0}$ characterises the case that the index of the optimality pencil is three.
In Section <ref>, we study existence and uniqueness of an optimal solution under the assumption of a regular optimality pencil. In particular, a state-feedback law is deduced. Lastly, we illustrate the results with some examples.

$\K$     Either $\mathbb{R}$ or $\mathbb{C}$

$\K^{n\times m}$
$n\times m$ matrices with entries in $\K$

$A^H$     Conjugate transpose of a matrix $A\in K^{n\times m}$

$\sigma(A)$     Eigenvalues of $A\in\K^{n\times n}$

$A\geq 0$     Means $x^H Ax\geq 0$ for all $x\in\K^n$

$A>0$     Means $x^H Ax>0$ for all $x\in\K^n\setminus\set{0}$

$\Sigma_{n,m}$     $\left\{(J,R,Q,B)\in\left(\mathbb{K}^{n\times n}\right)^3\times\mathbb{K}^{n\times m}\,\Big\vert\, J = -J^H,\, R = R^H\geq 0,\, Q = Q^H\geq 0\right\}$

$L^1([0,T],\K^n)$     Lebesgue measureable and integrable functions $f:[0,T]\to\K^n$

$\left.f\right|_{W}$     Restriction of the function $f:V\!\to\!\R^n$ to $W\subseteq V$

$\mathcal{C}^k(I,\K^n)$     $k$-times continuously differentiable functions $f:I\to\K^n$

$\mathcal{C}^k([0,T],\K^n)$     $:=\set{f\vert_{[0,T]}\,\big\vert\,\exists\,\varepsilon>0: f\in\mathcal{C}^1(-\varepsilon,T+\varepsilon),\K^n}$

$\mathcal{C}^k([0,T],\K^n)$     $:=\set{f\vert_{[0,T]}\,\big\vert\,\exists\,\varepsilon>0: f\in\mathcal{C}^1(-\varepsilon,T+\varepsilon),\K^n}$

$W^{1,1}([0,T],\K^n)$     Absolutely continuous functions $f:[0,T]\to\K^n$ with derivative $f'\in L^1([0,T],\K^n)$

$V[t]$     Polynomials with entries in the vector space $V$

$V[[t]]$     Formal power series with entries in the vector space $V$

§ NECESSARY OPTIMALITY CONDITION

Before we derive necessary optimality conditions, we transform the objective into a quadratic cost functional without mixed terms. Since the dynamics of (<ref>) have port-Hamiltonian structure with quadratic Hamiltonian energy function $x\mapsto \frac{1}{2} x^HQx$, we have the well-known energy balance equation, see e.g. [44],

\begin{equation}\label{eq:energy_balance}
\begin{aligned}
\frac{1}{2}x(t_1)^HQ x(t_1) - \frac{1}{2}x(t_0)^HQ x(t_0) & = \int_{t_0}^{t_1}\big[\Re y(t)^Hu(t) - x(t)^HQRQx(t)\big]\,\mathrm{d}t
\end{aligned}
\end{equation}

for all tuples $(x,y,u)\in W^{1,1}([t_0,t_1],\mathbb{K}^n)\times W^{1,1}([t_0,t_1],\mathbb{K}^n)\times L^1([t_0,t_1],\mathbb{K}^m)$ satisfying the system

\begin{equation}\label{eq:pH_ISO-system}
\begin{aligned}
\tfrac{\mathrm{d}}{\mathrm{d}t}x(t) & = (J-R)Qx(t)+Bu(t),\\
y(t) & = B^HQ x(t)
\end{aligned}
\end{equation}

for a.e. $t\in[t_0,t_1]$. Thus, again for tuples $(x,y,u)$ satisfying (<ref>), the cost functional of (<ref>) can be rewritten as

\begin{align*}
\int_{t_0}^{t_1} \big[\Re y(t)^H u(t) + u(t)^H\Q u(t)\big]\,\mathrm{d}t = &\ \frac{1}{2}x(t_1)^HQ x(t_1) - \frac{1}{2}x(t_0)^HQx(t_0)\\&\quad + \int_{t_0}^{t_1}\big[x(t)^HQRQx(t) + u(t)^H\Q u(t)\big]\,\mathrm{d}t.
\end{align*}

The OCP (<ref>) includes the initial condition $x(t_0)=x^0$ and the terminal constraint $x(t_1)=x^1$.
Thus, $\frac{1}{2}x(t_1)^HQ x(t_1) - \frac{1}{2}x(t_0)^HQ x(t_0)$ is a constant on the set of feasible trajectories of (<ref>) and can be neglected in the minimization. Therefore, we may equivalently consider the linear-quadratic optimal control problem

\begin{align}\label{eq:ultimate_port-Hamiltonian_OCP}
\begin{split}
\min_{u\in L^1([t_0,t_1],\mathbb{K}^m)}\frac{1}{2}\int_{t_0}^{t_1} \big[&x(t)^HQRQx(t)  + u(t)^H\Q u(t)\big]\,\mathrm{d}t\\
\mathrm{s.t.}\quad  \tfrac{\mathrm{d}}{\mathrm{d}t}x(t) &= (J-R)Qx(t)+Bu(t)\quad \mathrm{for a.e.\ } t\in [t_0,t_1],\\
x(t_0) &= x^0,\ x(t_1) = x^1,
\end{split}
\end{align}

which has the same optimal solutions
as (<ref>).
The stage cost
of (<ref>) is the quadratic function

\begin{align*}
g: \mathbb{K}^n\times\mathbb{K}^{m}\to\mathbb{K},\qquad (x,u)\mapsto \frac{1}{2} \begin{bmatrix}
\end{bmatrix}^H\begin{bmatrix}
QRQ &0\\
0 & \Q
\end{bmatrix}\begin{bmatrix}
\end{bmatrix}.
\end{align*}

Then, the associated optimal control Hamiltonian function

\begin{align*}
H:\mathbb{K}^n\times\mathbb{K}^m\times\mathbb{K}^n\times \mathbb{K}\to\mathbb{K},\quad (x,u,\lambda,\lambda_0) \mapsto \lambda^H(J-R)Qx + \lambda^HBu + \lambda_0 g(x,u).
\end{align*}

By the Pontryagin maximum principle (see e.g. <cit.>), one has the following necessary optimality condition: If $(x,u)\in W^{1,1}([t_0,t_1],\mathbb{K}^n)\times L^1([t_0,t_1],\mathbb{K}^m)$ is an optimal trajectory of (<ref>), then there exists a function $\lambda\in W^{1,1}([t_0,t_1],\mathbb{K}^n)$ and a constant $\lambda_0\in\mathbb{K}$ so that $(\lambda(t),\lambda_0)\neq (0,0)$ for all $t\in [t_0,t_1]$ and the DAE

\begin{align}
-\tfrac{\mathrm{d}}{\mathrm{d}t}{\lambda} & = \big((J-R)Q\big)^H\lambda + \lambda_0 QRQx,\label{eq:zeile_1}\\
\tfrac{\mathrm{d}}{\mathrm{d}t}{x} & = (J-R)Q x + Bu,\label{eq:zeile_2}\\
0 & = -B^H\lambda - \lambda_0 \Q u\label{eq:zeile_3}
\end{align}

with boundary conditions $x(t_0) = x^0$ and $x(t_1) = x^1$ is fulfilled for almost every $t\in[t_0,t_1]$.
We briefly state a result on normalization of the stage-cost adjoint
$\lambda_0$ under a controllability assumption.

If $((J-R)Q,B)$ is controllable, i.e. $\rk\begin{bmatrix} B,(J-R)QB,\ldots,((J-R)Q)^{n-1}B\end{bmatrix} = n$,

then the scalar multiplier in (<ref>) satisfies $\la_0\neq 0$.

We abbreviate $A = (J-R)Q$ and assume that $\la_0=0$. Then, (<ref>) yields $B^H\la=0$ and (<ref>) reads as $\tfrac{\mathrm{d}}{\mathrm{d}t}\la = -A^H\la$, hence $B^HA^H\la(t) = -B^H\tfrac{\mathrm{d}}{\mathrm{d}t}\la(t) = 0$ for almost every $t\in[t_0,t_1]$. From the continuity of $\lambda$, we conclude that $B^HA^H\lambda\equiv 0$ on $[t_0,t_1]$. Inductively, one obtains $B^H(A^k)^H\la\equiv 0$ on $[t_0,t_1]$ for $k=0,1,\ldots,n-1$. By the controllability of $(A,B)$, this implies that $(\la(t),\la_0) = (0,0)$ for all $t\in [t_0,t_1]$. But this contradicts the non-triviality condition $(\lambda(t),\lambda_0)\neq (0,0)$ for all $t\in [t_0,t_1]$ of the Pontryagin maximum principle.

In view of the previous
lemma, in all theoretical discussions below we assume that $\la_0\neq 0$. In this case, dividing (<ref>) and (<ref>) by $\lambda_0$ and rescaling $\lambda$,
we can without loss of generality normalize $\lambda_0 = 1$.

An important result, establishing a one-to-one relationship of the optimality system (<ref>) with $\lambda_0\neq 0$ and the optimal control problem (<ref>) is the following theorem ensuring also sufficiency of the necessary optimality conditions.

Let $(\lambda,x,u)\in \left(W^{1,1}([t_0,t_1],\mathbb{K}^n)\right)^2\times L^2([t_0,t_1],\mathbb{K}^m)$ be a solution of (<ref>) with $\lambda_0=1$ satisfying $x(t_0) = x^0$ and $x(t_1) = x^1$. Then $(x,u)$ is a solution of the optimal control problem (<ref>).

Taking additionally the structural properties of $(J,R,Q,B)\in\PH$ into account, the optimality system (<ref>) is equivalent to the following self-adjoint DAE, see [20, 21]:

\begin{align}\label{eq:the_optimality_DAE}
\frac{\mathrm{d}}{\mathrm{d}t} \underbrace{\begin{bmatrix}
0_{n\times n} & I_n & 0_{n\times m}\\
-I_n & 0_{n\times n} & 0_{n\times m}\\
0_{m\times n} & 0_{m\times n} & 0_{m\times m}
\end{bmatrix}}_{=:\mathcal{E}}\begin{bmatrix}
\lambda\\
\end{bmatrix} = \underbrace{\begin{bmatrix}
0_{n\times n} & (J-R)Q & B\\
((J-R)Q)^H & QRQ & 0_{n\times m}\\
B^H & 0_{m\times n} & \Q
\end{bmatrix}}_{=:\mathcal{A}_\Q}\begin{bmatrix}
\lambda\\x\\u
\end{bmatrix}.
\end{align}

Since we are in the constant coefficient case, we can analyse the properties of (<ref>) via the properties of the optimality pencil $s\mathcal E - \mathcal A_S$, which actually has a special symmetry structure that can be effectively used in numerical methods for solving the boundary value problem,  see [7]. Before we continue with the analysis of the pencil, we first consider an example of a second-order mechanical system.

A large class of systems from elastomechanics (possibly after a suitable finite-element discretization) can be formulated as a second-order control system

\begin{align}\label{mechsys}
M\tfrac{\mathrm{d}^2}{\mathrm{d}t^2}{q} + D\tfrac{\mathrm{d}}{\mathrm{d}t}{q} + Kq = u
\end{align}

with symmetric matrices $M,D,K\in\mathbb{R}^{\ell \times \ell}$, $\ell\in \mathbb{N}$, where the mass matrix $M$ and the stiffness matrix $K$ are positive definite, respectively, and the damping matrix $D$ is positive semi-definite.In the following we consider the fully damped case such that $D$ is positive definite. Performing a first -order formulation by composing the state $x=\sbvec{x_1}{x_2}\in\mathbb{R}^{2\ell}$ from momentum $x_1 = M\dot q$ and position $x_2 = q$, the system (<ref>) can equivalently be written in the form

\begin{align*}
\tfrac{\mathrm{d}}{\mathrm{d}t}{x} =
\Bigg(
\underbrace{
\begin{bmatrix}
0_{\ell\times \ell} & -I_\ell\\
I_\ell & 0_{\ell\times \ell}
\end{bmatrix}}_{J}
\underbrace{
\begin{bmatrix}
D & 0_{\ell\times \ell}\\
0_{\ell\times\ell} & 0_{\ell\times\ell}
\end{bmatrix}}_{R}
\Bigg)
\underbrace{
\begin{bmatrix}
M^{-1} & 0_{\ell\times\ell}\\
0_{\ell\times \ell} & K
\end{bmatrix}}_{Q}x
\underbrace{
\begin{bmatrix}
I_\ell\\ 0_{\ell\times \ell}
\end{bmatrix}}_{B}u,
\end{align*}

see for example [45] for an application in the control of high-rise buildings. We observe that $\ker RQ\cap\im B = \{0\}$ holds; that is, the sufficient condition for regularity derived in [37]  is satisfied. Thus, we can inspect the corresponding optimal control problem (<ref>) without regularization term, i.e. $S=0$. Further, using the Hautus Lemma, see e.g. [41], it is immediate that the pair $((J-R)Q,B)$ is controllable. Hence, we may assume that $\la_0=1$ in (<ref>).

also $\la = \sbvec{\la_1}{\la_2}\in\mathbb{R}^{2\ell}$
analogously to the state, (<ref>) is equivalent to

\begin{align}\label{eq:exmechlam1}
\lambda_1(t)  = 0 \quad \mbox{for all} \ t\in [t_0,t_1].
\end{align}

The adjoint equation (<ref>) reads

\begin{align*}
\frac{\mathrm{d}}{\mathrm{d}t}\begin{bmatrix}
\lambda_1\\
\lambda_2
\end{bmatrix} &=
\begin{bmatrix}
M^{-1} D & -M^{-1}\\
K & 0
\end{bmatrix}
\begin{bmatrix}
\lambda_1\\
\lambda_2
\end{bmatrix}
- \begin{bmatrix}
M^{-1}DM^{-1} & 0 \\
\end{bmatrix}
\begin{bmatrix}
\end{bmatrix}
\end{align*}

and inserting (<ref>) yields

\begin{align*}
\tfrac{\mathrm{d}}{\mathrm{d}t} {\lambda}_2(t) = 0\quad \mbox{for a.e.} \ t\in [t_0,t_1] \qquad \mathrm{and}\qquad \lambda_2(t) = -DM^{-1}x_1(t) \quad \mbox{for all} \ t\in [t_0,t_1].
\end{align*}

From this, we further conclude

\tfrac{\mathrm{d}}{\mathrm{d}t}{x}_1(t)= 0\quad \mbox{for a.e.} \ t\in [t_0,t_1]\quad\text{with} \quad x_1(t)\equiv x_1^0 \qquad\text{and}\qquad x_1(t) = x_1^1 \quad \mbox{for all} \ t\in[t_0,t_1].

This already yields the condition $x_1^0 = x_1^1$ on the entry and exit point of the singular arc and $\lambda_2(t) = -DM^{-1} x_1^0$ for all $t\in[t_0,t_1]$. Inserting this into the second row of the state equation yields $\tfrac{\mathrm{d}}{\mathrm{d}t}{x_2}(t) = M^{-1}x_1^0$ for a.e. $t\in[t_0,t_1]$ and thus

\[
x_2(t) = x_2^0 + (t-t_0)M^{-1}x_1^0\ \quad \mbox{for all}\ t\in [t_0,t_1].
\]

From this we get the additional condition $x_2^1 = x_2^0 + (t_1-t_0)M^{-1}x_1^0$, coupling the entry and exit point with the time at which the solution leaves the singular arc. In particular, if $x^0\neq x^1$, an optimal solution only exists for one particular length $t_1-t_0$ of the singular arc.

Finally, the first row of the state equation implies the formula for the optimal control, which is the feedback law

\begin{align*}
u(t) = DM^{-1}x_1(t) + Kx_2(t) = (D+(t-t_0)K)M^{-1}x_1^0 + Kx_2^0 \qquad \mbox{for all} \ t\in [t_0,t_1],
\end{align*}

where  the last part of the equation is an explicit solution formula in terms of the initial value.

In Example <ref> we observed that, for second-order mechanical systems, the control on the singular arc can be expressed directly via the entry point $x^0$. The aim of this paper is to provide a generalisation of this approach to optimal control problems of the form (<ref>) or, if a regularization is necessary, its regularized counterparts (<ref>), or  (<ref>).

To derive an explicit solution formula, we recall the concept of the Drazin inverse.

[Drazin inverse, see <cit.>]
Let $M\in\mathbb{K}^{n\times n}$. The unique matrix $M^D\in\mathbb{K}^{n\times n}$ with the properties

(i) $M^DM = MM^D$,

(ii) $M^DMM^D = M^D$,

(iii) there exists $\nu\in\mathbb{N}_0: M^DM^{\nu+1} = M^\nu$,

is called the Drazin inverse of $M$.
The minimal $\nu$ satisfying (iii) is called the (Riesz) index of $M$ and coincides with the nilpotency index of $M$, which is the size of the largest Jordan block associated with the eigenvalue zero.

Recall further the well-known solution formula for initial value problems associated with linear time-invariant differential-algebraic systems with commuting coefficients using the Drazin inverse, see e.g. <cit.> for a proof.

Let $I\subseteq\mathbb{R}$ be an interval with $t_0\in I$ and consider the  homogeneous system

\begin{align}\label{eq:general_DAE}
\left(\tfrac{\mathrm{d}}{\mathrm{d}t}E-A\right)z = 0,
\end{align}

with $E,A\in\mathbb{K}^{n\times n}$ satisfying $EA = AE$ and $\ker E \cap \ker A = \set{0}$. A function $z\in\mathcal{C}^1(I,\mathbb{R}^n)$ is a solution of (<ref>)
if, and only if, $z(t_0)\in\mathrm{im}\,E^DE$ and

\begin{align}\label{eq:solution_Drazin_inverse}
z = \exp{E^DA(\cdot-t_0)}%E^DE
\end{align}

Unfortunately, the matrices $\mathcal{E}$ and $\mathcal{A}_\Q$ in the optimality system (<ref>) commute if, and only if, $B = 0$ in which case the optimal control problem (<ref>) becomes trivial, since the boundary value problem either possesses no solution (which is generically the case) or every control is optimal. However, if the pencil $s\mathcal{E}-\mathcal{A}_\Q$ is regular (i.e. $\det (s\mathcal{E}-\mathcal{A}_\Q)\in\mathbb{K}[s]$ is not the zero-polynomial), then there exists $\mu\in\mathbb{K}$ so that $\mu\mathcal{E}-\mathcal{A}_\Q$ is invertible and the coefficient matrices of the transformed pencil $(\mu\mathcal{E}-\mathcal{A}_\Q)^{-1}(s\mathcal{E}-\mathcal{A}_\Q)$ commute as the following elementary result shows.

Let $E,A\in\mathbb{K}^{n\times n}$. Then for every $\mu\in\mathbb{K}$ such that $\mu E-A$ is invertible,

\begin{align*}
[(\mu E-A)^{-1}E][(\mu E-A)^{-1}A] = [(\mu E-A)^{-1}A][(\mu E-A)^{-1}E].
\end{align*}

It is then clear that the interplay of Proposition <ref> and Lemma <ref> leads to a solution formula for (<ref>) if the pencil $s\mathcal E-\mathcal A_S$ is regular, see [18] for a detailed analysis. However, it should be noted that this formula characterises only continuously differentiable solutions, while we initially considered weak solutions in, e.g., (<ref>). On the other hand, we ultimately seek for an optimal control which is a linear feedback of the state or the state and associated adjoint. In this case, the solution of the optimality system (<ref>) is smooth and can be obtained from the solution formula.

§ ANALYSIS OF THE OPTIMALITY PENCIL SE-AS

In this section, we study properties of the pencil associated to the optimality DAE (<ref>). In particular, we consider its regularity, which is strongly connected with the solution formula in terms of the Drazin inverse, the index and rank-minimal choice of the regularization term $\Q$. The main results of this section are summarised in the Figure <ref>.

§.§ Regularity

Conditions that characterize the regularity of the pencil  $s\mathcal E-\mathcal A_S$ via normal and staircase forms are well studied, see [7, 8, 29].

The next proposition contains such conditions in the  special case of port-Hamiltonian systems.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$. Then the following statements are equivalent:

(i) The pencil $s\mathcal{E}-\mathcal{A}_\Q$ is regular.

(ii) There exists $\mu\in\mathbb{K}\setminus(\sigma(-((J-R)Q)^H)\cup\sigma((J-R)Q))$ such that the matrix

\begin{align}\label{eq:Campbell's_qmu}
%\Q_\mu := \Q - \begin{bmatrix}B^H & 0\end{bmatrix} \begin{bmatrix}
%0 & \mu I-(J-R)Q \\
% -\mu I -((J-R)Q)^H & QRQ
%B\\ 0
%\end{bmatrix}\in\mathbb{K}^{m\times m}
\Q_\mu := \Q - \begin{bmatrix}B^H & 0\end{bmatrix}
\begin{bmatrix}
0 & (J-R)Q - \mu I\\
((J-R)Q)^H +\mu I & QRQ
\end{bmatrix}^{-1}\begin{bmatrix}
B\\ 0
\end{bmatrix}\in\mathbb{K}^{m\times m}
\end{align}

is invertible.

(iii) There exists $\omega\in\mathbb{R}$ such that

\begin{align}\label{eq:Campbell's_port-Hamiltonian_condition}
i\omega\notin\sigma((J-R)Q)\quad\text{and}\quad\ker\Q\cap \ker RQ\big((J-R)Q-i\omega I\big)^{-1}B = \set{0}.
\end{align}

(iv) There exists $\omega\in\mathbb{R}$ such that

\begin{align}\label{eq:Campbell's_port-Hamiltonian_condition_ohne_R}
i\omega\notin\sigma(JQ)\quad\text{and}\quad\ker\Q\cap \ker RQ\big(JQ-i\omega I\big)^{-1}B = \set{0}.
\end{align}

(v) There exists $\omega\in\mathbb{R}$ such that

\begin{align}
i\omega\notin\sigma(JQ)\quad\text{and}\quad\ker\Q\cap B^{-1}(JQ-i\omega I)\ker RQ = \set{0},
\end{align}

The equivalence of (i)–(iii) follows directly from Proposition 1 and Theorem 5 from [8], and the equivalence of (iv) and (v) is straightforward. It remains to prove that $s\mathcal{E}-\mathcal{A}_\Q$ is regular if, and only if, (iv) holds. To this end, we first show that for all $z\in\C\backslash\big(\sigma(JQ)\cup\sigma\big((J-R)Q\big)\big)$ we have

\begin{align*}
\big(JQ-z I%s
\big)^{-1}RQ\big((J-R)Q-z I%s
\big)^{-1} = \big((J-R)Q-z I%
\big)^{-1}RQ\big(JQ-z I%s
\big)^{-1}.
\end{align*}

This follows immediately by applying $\big(JQ-z I\big)^{-1}$ from the left and from the right to the equality

\begin{align*}
RQ\big((J-R)Q-z I%s
\big)^{-1}\big(JQ-z I%s
\big) &  = RQ(JQ-RQ-z I%s
)^{-1}(JQ-z I%s
& = RQ(JQ-RQ-z I%s
)^{-1}(JQ-RQ-z I%s
& = RQ+RQ(JQ-RQ-z I%s
& = (JQ-RQ-z I%s
+RQ)(JQ-RQ-z I%s
& = (JQ-z I)(JQ-RQ-z I%s
& = \big(JQ-z I%s
\big)\big((J-R)Q-z I%s
\big)^{-1}RQ.
\end{align*}

Hence, for all $z\in\mathbb{C}\setminus\big(\sigma (JQ)\cup\sigma\big((J-R)Q\big)\big)$,

\begin{align*}
\ker RQ((J-R)Q-z I)^{-1}B &= \ker \big((J-R)Q-z I)\big)^{-1}RQ(JQ-z I)^{-1}B\\
&= \ker RQ(JQ-z I)^{-1}B.
\end{align*}

Now, note that if (<ref>)
holds for some $\omega\in\mathbb R$, then it holds in a neighborhood of this $\omega$. The same is true for (<ref>).
Since the spectrum of a matrix is finite, this proves the claim.

In <cit.> it is proven that regularity of $s\calE - \calA_S$ is also equivalent to the uniqueness of optimal controls for the OCP (<ref>), if they exist.

Typically, the necessary and sufficient conditions for the regularity of the pencil $s\mathcal{E}-\mathcal{A}_\Q$ in Proposition <ref>  are hard to verify in applications, since all of them are existence statements which contain resolvents.

Therefore, we seek to find explicit or resolvent-free conditions.

A necessary condition,

that meets both requirements is the following result inspired by <cit.>.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$. If $s\mathcal{E}-\mathcal{A}_\Q$ is regular, then

\begin{align}\label{eq:equation_5}
\ker \Q\,\cap\,\bigcap_{r = 0}^{n-1} \ker RQ(JQ)^rB = \set{0}.
\end{align}

The converse implication holds for single-input-single-output systems (i.e. the case $m = 1$), but not in general.

If $s\mathcal{E}-\mathcal{A}_\Q$ is regular, then (<ref>) holds for all but finitely many $\omega\in\mathbb{R}$ due to Proposition <ref> (iv), and since the set of all $\mu\in\mathbb{K}$ so that $\mu\mathcal{E}-\mathcal{A}_\Q$ is invertible

is either empty or co-finite.
Thus, there exists some $\Omega>\|JQ\|$ so that for all $\omega\in\mathbb{R}\setminus(-\Omega,\Omega)$ one has that $i\omega\notin\sigma(JQ)$ and $\ker\Q\cap\ker RQ(JQ-i\omega I)^{-1}B = \set{0}$.

Hence, for all $\omega\in\mathbb{R}\setminus(-\Omega,\Omega)$ the Neumann series

\[
(JQ-i\omega I)^{-1} = -\sum_{k = 0}^\infty\left(\frac{-i}{\omega}\right)^{k+1}(JQ)^k
\]

converges absolutely and

\begin{align}\label{eq:Neumann}
RQ(JQ-i\omega I)^{-1}B =
%iRQ\left(\sum_{k = 0}^\infty\frac{1}{\omega^{k+1}}(-iJQ)^k%\right)B =
-\sum_{k = 0}^\infty\left(\frac{-i}{\omega}\right)^{k+1} RQ(JQ)^kB.
\end{align}

Using the  Cayley-Hamilton Theorem, see e.g. <cit.>, we have that for all $r\geq n$ there exist coefficients $a_0^r,\ldots,a_{n-1}^r\in\mathbb{K}$, such that

\[
(JQ)^r = \sum_{j = 0}^{n-1} a_j^r(JQ)^j.
\]

Hence, we conclude that for all $r\geq n$

\begin{align*}
%\forall r\geq n:\quad
\bigcap_{\rho = 0}^{n-1}\ker RQ(JQ)^\rho B\,\subset\, \ker \sum_{\rho = 0}^{n-1} a_\rho^r RQ(JQ)^\rho B = \ker RQ(JQ)^rB.
\end{align*}

This shows that $\ker\Q\cap\bigcap_{r = 0}^{n-1}\ker RQ(JQ)^rB = \ker\Q\cap\bigcap_{r = 0}^{\infty}\ker R(JQ)^rB$. Therefore,  for all $v\in\ker\Q\cap\bigcap_{r = 0}^{n-1}\ker RQ(JQ)^rB$ and for all
$\omega\in\mathbb{R}\setminus(-\Omega,\Omega)$, we have that

\begin{align*}
%\forall \omega\in\mathbb{R}\setminus(-\Omega,%\Omega):\quad
RQ(JQ-i\omega I)^{-1}Bv = -\sum_{k = 0}^\infty RQ(JQ)^kBv\left(\frac{-i}{\omega}\right)^{k+1} = 0
\end{align*}

and hence

$v = 0$.

Consider the case that $m=1$, i.e. $\Q\in\mathbb{K}^{1\times 1}$

and $B\in\K^{n\times 1}$.

If $\Q$ is non-zero, then the pencil $s\mathcal{E}-\mathcal{A}_\Q$ is obviously regular. If $\Q=0$ then

Proposition <ref> (iv) yields that $s\mathcal{E}-\mathcal{A}_\Q$ is regular if, and only if, there exists $\omega\in\mathbb{R}$, with
$i\omega\notin\sigma(JQ)$ and $RQ(JQ-i\omega I)^{-1}B\neq 0$.

Seeking a contradiction, assume that (<ref>) holds and that $RQ(JQ-i\omega I)^{-1}B = 0$ for all $\omega\in\mathbb{R}$ with $i\omega\notin\sigma(JQ)$. In this case, the representation (<ref>) and the identity theorem for power series <cit.> yield that $RQ(JQ)^rB = 0$ for all $r\in\mathbb{N}_0$, which

contradicts our assumption. Therefore $s\mathcal{E}-\mathcal{A}_\Q$ is indeed regular.

The following example shows that the converse implication does not hold in general.

Let $n = m = 2$, $Q = B = I_2$, $\Q = 0_{2\times 2}$ and

\begin{align*}
J = \begin{bmatrix}
0 & -1\\
1 & 0
\end{bmatrix},\qquad R = \begin{bmatrix}
1 & 0\\
0 & 0
\end{bmatrix}.
\end{align*}

Then  for
$\omega\in\mathbb{R}\setminus\set{\pm 1}$
we have

\begin{align*}
\ker RQ(JQ-i\omega I)^{-1} = (J-i\omega I)\ker R = \set{(z,i\omega z)^\top\,\big\vert\,z\in\mathbb{C}}\neq \set{0}.
\end{align*}

Since $\ker\Q = \mathbb{C}^m$, Proposition <ref> (iv) yields that $s\mathcal{E}-\mathcal{A}_\Q$ is singular. On the other hand, we have, for all $\omega,\mu\in\mathbb{R}\setminus\set{\pm 1}$ with $\omega\neq \mu$

\begin{align*}
\ker R(J-i\omega I)^{-1}\cap \ker R(J-i\mu I)^{-1} =
\set{0}.
\end{align*}

Using the Neumann series,

this yields that (<ref>) holds; for details see the upcoming Lemma <ref>. This shows that (<ref>) is, in general, not sufficient for regularity of $s\mathcal{E}-\mathcal{A}_\Q$.

We have seen that the condition (<ref>) is necessary but not sufficient for regularity of $s\mathcal{E}-\mathcal{A}_\Q$. The following lemma reveals the underlying reason for this shortcoming: $s\mathcal{E}-\mathcal{A}_S$ is regular if, and only if, $\ker S\cap \ker RQ(JQ-i\omega I)^{-1}B = \set{0}$ for one fixed $\omega\in\mathbb{R}$, whereas the condition (<ref>) holds if and only if the intersection of the kernel of $RQ(JQ-i\omega I)^{-1}B$ over infinitely many $\omega\in\mathbb{R}$ has trivial intersection with $\ker S$.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$. Then (<ref>) holds if, and only if, there exists $\Omega>0$ such that all $ \omega_1>\omega_0>\Omega$ fulfil the property

\begin{align}\label{eq:Ringstuff}
\ker S\ \cap \bigcap_{\omega_0<\omega<\omega_1}\ker RQ(JQ-i\omega I)^{-1}B = \set{0}.
\end{align}

Let $\phi := \frac{1}{\omega}$. Then, the series (<ref>) is a formal power series $F\in\mathbb{K}^{n\times m}[[\phi]]$ with non-vanishing convergence radius $\rho\geq \frac{1}{\norm{JQ}}$, where we use the convention $\frac{1}{0} = \infty$. Each $v\in\mathbb{K}^m$ induces then the formal power series $F(\cdot)v\in\mathbb{K}^n[[\phi]]$ whose convergence radius is at least $\rho$. By definition of $F$, we then have for all $\phi\in (-\rho,\rho)$ and for all $ v\in\mathbb{K}^m$ that

\begin{align*}
F(\phi)v =  RQ\left(JQ-\frac{i}{\phi} I\right)^{-1}Bv.
\end{align*}

Therefore, the identity theorem for power series <cit.> yields the equivalence

\begin{align*}
v\in\ker \Q\cap\bigcap_{r = 0}^{n-1} \ker RQ(JQ)^rB \iff v\in\ker S~\text{and}~F(\cdot)v\equiv 0.
\end{align*}

The latter is equivalent to

\begin{align*}
v\in \ker S\ \cap \bigcap_{\omega_0<\abs{\omega}<\omega_1}\ker RQ(JQ-i\omega I)^{-1}B
\end{align*}

for all $\omega_0<\omega_1\in (1/\rho,\infty)$.
This shows that (<ref>) and (<ref>) are indeed equivalent.

As we have demonstrated, the inverse-free necessary condition (<ref>) is not sufficient for regularity of $s\mathcal{E}-\mathcal{A}_S$. However,

the next proposition presents an inverse-free necessary and sufficient condition.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$. The pencil $s\mathcal{E}-\mathcal{A}_\Q$ is regular if, and only if, there exists $\omega\in\mathbb{R}$ such that

\begin{align}\label{eq:some_kerR_imB_condition}
i\omega\notin\sigma(JQ)\quad\text{and}\quad B\ker \Q\cap (JQ-i\omega I)\ker RQ = \set{0} = \ker B\cap\ker\Q.
\end{align}

Assume that the pencil $s\mathcal{E}-\mathcal{A}_\Q$ is regular. By Proposition <ref> (iv), there exists some $\omega\in\mathbb{R}$ with $i\omega\notin\sigma(JQ)$ such that $\ker\Q\cap\ker RQ(JQ-i\omega I)^{-1}B = \set{0}$. In particular, this implies that $\ker\Q\cap\ker B = \set{0}$. Let $v\in B\ker \Q\cap (JQ-i\omega I)\ker RQ$. Then, there exists $u\in\ker\Q$ so that $v = Bu$ and $(JQ-i\omega I)^{-1}Bu\in\ker RQ$ or, equivalently, $u\in \ker RQ(JQ-i\omega I)^{-1}B$. Thus, $u = 0$ and hence $v = 0$, so that (<ref>) holds.

Conversely, let $\omega\in\mathbb{R}$ be such that (<ref>) holds for this particular $\omega$. Let $u\in\ker\Q\cap\ker RQ(JQ-i\omega I)^{-1}B$ and set $v:=Bu\in B\ker\Q$. Then $RQ(JQ-i\omega I)^{-1}v = 0$, i.e. $v\in (JQ-i\omega I)\ker RQ$. Hence, we obtain $v = 0$ or, equivalently, $u\in\ker B$. Since $\ker B\cap\ker \Q = \{0\}$, we conclude that $u = 0$ and Proposition <ref> (iv) yields that $s\mathcal{E}-\mathcal{A}_\Q$ is regular.

Condition (<ref>) implies, in particular, that the block matrix $[B,JQ-i\omega I]$ acts injectively on the cartesian product $\ker\Q\times\ker RQ$. This immediately yields a rank criterion for the regularity of $s\mathcal{E}-\mathcal{A}_\Q$.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q = \Q^H\geq 0$. Then the pencil $s\mathcal{E}-\mathcal{A}_\Q$ is regular if, and only if, there exists $\omega\in \mathbb R$ such that

\begin{align}\label{eq:condition_1}
%\exists \omega\in\mathbb{R}:
\dim\big(B\ker \Q + (JQ-i\omega I)\ker RQ\big) = m+n-(\rk \Q + \rk RQ).
\end{align}

Let $Z_\Q\in\mathbb{K}^{m\times (m-\rk \Q)}$ and $Z_R\in\mathbb{K}^{n\times (n-\rk RQ)}$ be matrices with full column rank
such that $\im Z_\Q = \ker \Q$ and $\im Z_R = \ker RQ$
and we have the formula
\[
\dim (B\ker \Q + (JQ-i\omega I)\ker RQ) = \rk[BZ_\Q,(JQ-i\omega I)Z_R].
\]

Let $s\mathcal{E}-\mathcal{A}_\Q$ be regular. In view of Proposition <ref>, this is the case if, and only if, the restriction of $B$ to $\ker \Q$ is injective and $B\ker \Q\cap (JQ-i\omega I)\ker RQ  =\set{0}$ for some $\omega\in\mathbb{R}$ so that $JQ-i\omega I$ is invertible. Hence, for this particular $\omega$ we have $\rk BZ_\Q = \dim B\ker \Q = \dim\ker \Q = m-\rk \Q$ and $\rk (JQ-i\omega I)Z_R = \dim (JQ-i\omega I)\ker RQ = \dim\ker RQ = n-\rk RQ$ and the sum $B\ker \Q + (JQ-i\omega I)\ker RQ$ is a direct sum. Thus, (<ref>) holds, i.e.

\begin{align*}
\dim (B\ker \Q + (JQ-i\omega I)\ker RQ)
& = \dim(B\ker \Q) + \dim((JQ-i\omega I)\ker RQ)\\
& = n+m-(\rk \Q+\rk RQ).
\end{align*}

Conversely, assume that (<ref>) is satisfied. The set of all $\omega\in\mathbb{R}$ such that $\rk[BZ_\Q,(JQ-i\omega I)Z_R]<n+m-(\rk \Q+\rk RQ)$

either coincides with $\mathbb{R}$ or is finite. By condition (<ref>), the former does not hold.

In particular, there is some $\omega\in\mathbb{R}$ so that $i\omega\notin\sigma(JQ)$ such that (<ref>) holds at this $\omega$. Then, we can conclude analogously that (<ref>) holds. From Proposition <ref>, we conclude that the pencil $s\mathcal{E}-\mathcal{A}_\Q$ is regular.

Whereas the previous characterizations of regularity required the choice $i\omega\notin\sigma(JQ)$, condition (<ref>) can be verified without computing the spectrum of $JQ$.

§.§ Rank-minimal regularization of the cost functional

Recall that one of our goals is to choose a positive semidefinite matrix $\Q\in\K^{m\times m}$ of minimal rank,

to achieve

regularity of the optimality system. In the following we

construct a regularization term of minimal rank in the cost functional of (<ref>) such that the resulting pencil in the optimality system is regular.

Let $(J,R,Q,B)\in\PH$ be such that the pencil $s\mathcal{E}-\mathcal{A}_S$ is singular for $S=0$. Let
$\omega\in\mathbb{R}$ with $i\omega\notin\sigma(JQ)$ and consider
the subspace

\begin{align*}
V := B^{-1}(JQ-i\omega I)\ker RQ.
\end{align*}

Let $\Q\in\mathbb{K}^{m\times m}$ with $\Q = \Q^H\geq 0$ and $\ker \Q = V^\bot$ (e.g. the orthogonal projection onto $V$). Then $s\mathcal{E}-\mathcal{A}_\Q$ is a regular pencil. Moreover, if $\omega$ is chosen such that

\begin{align}\label{eq:dim_minimal}
\dim B^{-1}(JQ-i\omega I)\ker RQ = \min\set{\dim B^{-1}(JQ-z I)\ker RQ\,\big\vert\, z\in\mathbb{C}},
\end{align}

which holds for all but finitely many $\omega\in\mathbb{R}$ with $i\omega\notin\sigma(JQ)$, then

\begin{align}\label{eq:rank_minimal}
\rk \Q = \min\set{\rk\widehat{\Q}\,\left\vert\,s\mathcal{E}-\mathcal{A}_{\widehat{\Q}}~\text{regular}\right.}.
\end{align}

Since $V\cap V^\bot = \set{0}$, Proposition <ref> (v) yields that $s\mathcal{E}-\mathcal{A}_\Q$ is regular. Assume now that (<ref>) holds. We show that $\Q$ is rank-minimal in the sense of (<ref>). Let $\widehat{\Q}\in\mathbb{K}^{m\times m}$ with $\rk\widehat{\Q}\leq\rk\Q$ so that $\widehat{\Q} = \widehat{\Q}^H\geq 0$ and $s\mathcal{E}-\mathcal{A}_{\widehat{\Q}}$ is regular. By Proposition <ref> (v), we find some $\omega_0\in\mathbb{R}$ so that $i\omega_0\notin\sigma(JQ)$ and $\ker\widehat{\Q}\cap B^{-1}(JQ-i\omega_0 I)\ker RQ = \set{0}$. Since (<ref>) holds if, and only if,

\begin{align*}
\dim \left(\mathrm{im}\,B + (JQ-i\omega I)\ker RQ\right) = \max\set{\dim\left(\mathrm{im}\,B + (JQ-z I)\ker RQ\right)\,\big\vert\,z\in\mathbb{C}},
\end{align*}

the condition (<ref>) is fulfilled for all but finitely many $\omega\in\mathbb{R}$. Therefore, we may choose $\omega_0$ so that $\dim B^{-1}(JQ-i\omega_0 I)\ker RQ = \dim V$. We conclude that

\begin{align*}
m & \geq \dim \big(\ker\widehat{\Q} + B^{-1}(JQ-i\omega_0 I)\ker RQ\big)\\
& = \dim\ker\widehat{\Q} + \dim B^{-1}(JQ-i\omega_0 I)\ker RQ\\
& \geq \dim\ker\Q+\dim V = \dim V^\bot + \dim V = m.
\end{align*}

Therefore the inequalities are equalities and we conclude $\dim\ker\widehat{\Q} = \dim\ker\Q$ or, equivalently, $\rk\widehat{\Q} = \rk\Q$. Thus, $\Q$ is indeed rank-minimal in the sense of (<ref>).

The following result extends <cit.> to regularized cost functionals and not necessarily invertible matrices $Q$, providing a sufficient condition for regularity of $s\mathcal{E}-\mathcal{A}_\Q$.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q = \Q^H\geq 0$. If

\begin{align}\label{eq:equation_2}
B\ker\Q\cap\ker RQ = \set{0} = \ker B\cap\ker\Q,
\end{align}

then $s\mathcal{E}-\mathcal{A}_\Q$ is regular. The converse is false, in general. Moreover, if (<ref>) holds, then optimal controls for the OCP (<ref>) (if they exist) are unique.

In the following, denote by $M_{S,T}(A)$ the minor of a matrix $A$ with row and column index sets $S$ and $T$, respectively, where $|S|=|T|$.

Let $Z_\Q\in\mathbb{K}^{m\times (m-\rk \Q)}$ and $Z_R\in\mathbb{K}^{n\times (n-\rk RQ)}$ such that $\im Z_Q = \ker \Q$ and $\im Z_R = \ker RQ$. Then assumption (<ref>) yields that $[BZ_\Q,Z_R]$ has full column rank $\tau = n+m-(\rk\Q+\rk RQ)$. Hence, there exists a non-zero minor $M_{S,T}([BZ_\Q,Z_R])$ of $[BZ_\Q,Z_R]$ with $|S|=|T|=\tau$ . By continuity, there exists $\varepsilon>0$ such that $M_{J,K}([BZ_\Q,(irJQ+I)Z_R])$ does not vanish for $r\in (0,\varepsilon)$. Hence,

\[
\tau = \rk [BZ_\Q,(i\tfrac{\varepsilon}2JQ+I)Z_R] = \rk\big[BZ_\Q,(JQ-i\tfrac{2}{\varepsilon}I)Z_R\big] = \dim(B\ker S + (JQ-i\tfrac{2}{\varepsilon}I)\ker RQ),
\]

which is (<ref>) with $\omega = \tfrac{2}{\varepsilon}$.

To show that the converse is, in general, not true, consider $n = 2$ and $m = 1$. Let $\Q = 0$ and let $B = \sbvec 10$, which certainly fulfills $\ker B\cap\ker S = \set{0}$. Further, set

\begin{align*}
J = \begin{bmatrix}
0 & 1\\
-1 & 0
\end{bmatrix},\qquad
R = \begin{bmatrix}
0 & 0\\
0 & 1
\end{bmatrix},
\qquad\text{and}\qquad
Q = I.
\end{align*}

Then, $\ker R = \im B\neq \set{0}$ and (<ref>) is violated. For all $z\in\mathbb{R}$ and $v = v_1\sbvec 10\in\ker R$ we have

\begin{align*}
-v_1\bvec{i\omega}{1} = (J-i\omega I)v\in\im B
\end{align*}

if, and only if, $v = 0$ and hence we conclude that (<ref>) holds. Proposition <ref> yields that $s\mathcal{E}-\mathcal{A}_\Q$ is regular.

The previous result included a condition which is sufficient but not necessary for regularity. In the following we show that it is indeed necessary for regularity with an additional condition on the index.

§.§ Index of the optimality DAE (<ref>)

An important property for the numerical solution of the optimality boundary value problem (<ref>) is the
Kronecker index, i.e. the size of the largest block associated with the eigenvalue $\infty$ in the Kronecker canonical form [12] of the pencil $s\calE  - \calA_S$. The next proposition characterizes condition (<ref>) in the case $S=0$ in terms of the Kronecker index.

Let $(J,R,Q,B)\in\PH$,

and $S = 0_{m\times m}$. Then

\begin{equation}\label{e:spfwm2}
\im B\cap\ker RQ = \{0\} = \ker B
\end{equation}

holds if, and only if, the pencil $s\calE  - \calA_S$ is regular with Kronecker index three.

First of all, since $S=0$ we have that (<ref>) is equivalent to (<ref>). Hence, by Proposition <ref>, the pencil is regular in both logical directions of the proof. Therefore, we may assume that the pencil is regular. By Proposition <ref>, there exists $\omega\in\R$ with $i\omega\notin\sigma(JQ)\cap\sigma(-JQ)$ such that

\im B\cap(JQ-i\omega I)\ker RQ = \im B\cap(JQ+i\omega I)\ker RQ = \{0\} = \ker B.

We now have to prove that $V := \im B\cap\ker RQ = \{0\}$ if, and only if, the pencil is of index three. We set $A := (J-R)Q$.

One easily computes the first four elements of the increasing Wong sequence (see <cit.> or [46]), defined by $\mathcal{W}_0 = \{0\}$ and $\mathcal{W}_{k+1} = \calE^{-1}\calA_S \mathcal{W}_k$ for $k\in\mathbb{N}_0$, as $\mathcal{W}_1 = \{0\}\times\{0\}\times\K^m$, $\mathcal{W}_2 = \{0\}\times\mathrm{im}\, B\times\K^m$,

\begin{align*}
\mathcal{W}_3 & = \left\{\bvec{-QRQv}{Av+w} : v,w\in\mathrm{im}\, B\right\}\times\K^m\\
\mathcal{W}_4 & = \left\{\bvec{-QRQJQv-QRQw}{A^2v+Aw+y} : v\in V,\,w,y\in\mathrm{im}\, B\right\}\times\K^m.
\end{align*}

Note that here $\mathcal E^{-1}$ denotes the preimage of the map defined by $\mathcal E$ and not the inverse of $\mathcal E$.
Hence, $\mathcal{W}_0\neq \mathcal{W}_1$ and $\mathcal{W}_1\neq \mathcal{W}_2$. Moreover, $\mathcal{W}_2\neq \mathcal{W}_3$, since $\mathcal{W}_2 = \mathcal{W}_3$ is equivalent to $\im B\subset\ker RQ$ and $JQ\,\im B\subset\im B$, which leads to

(JQ-i\omega I)\im B\subset\im B\cap (JQ-i\omega I)\ker R = \{0\},

i.e., $B=0$, contradicting $\ker B=\{0\}$. From <cit.>, we conclude that the Kronecker index of the pencil index is at least three, and that the index is  three if, and only if, $\mathcal{W}_3 = \mathcal{W}_4$.

Now, $\mathcal{W}_3=\mathcal{W}_4$ is easily seen to be equivalent to the statement that for each $x\in V$ there exist $v,w\in\im B$ such that $RQJQx = RQv$ and $JQJQx = JQv + w$. Hence, $V=\{0\}$ obviously implies $\mathcal{W}_3 = \mathcal{W}_4$. Conversely, assume that $\mathcal{W}_3 = \mathcal{W}_4$ and let $x\in V$.

Then there exist $v,w\in\im B$ such that $RQJQx = RQv$ and $(JQ)^2x = JQv + w$. Since $RQx=0$ and thus $RQ[(JQ+i\omega I)x - v]=0$, we have

\begin{align*}
(JQ-i\omega I)[(JQ+i\omega I)x - v]
&= ((JQ)^2+\omega^2 I)x - (JQ-i\omega I)v\\
&= w + \omega^2x + i\omega v\in\im B\cap (JQ-i\omega I)\ker RQ = \{0\},
\end{align*}

and hence

(JQ+i\omega I)x = v\in \im B\cap (JQ+i\omega I)\ker RQ = \{0\}.

Thus, $x=0$ follows which  shows that $V = \{0\}$.

We summarize our results and we illustrate further equivalences and implications in Figure <ref>.

.8![node distance = 2cm, auto, paths/.style=->, thick, >=stealth', decoration=markings,
mark=between positions 0 and 1 step 6pt
with  [fill] (0,0) circle [radius=1pt];]

[blocktest] (pert) $s\begin{bmatrix}0& I&0 \\-I&0& 0\\0& 0&0\end{bmatrix} - \begin{bmatrix}0 & (J-R)Q & B\\((J-R)Q)^H & QRQ & 0\\ B^H & 0 & \Q \end{bmatrix}$ is regular;
[block7,below of=pert, node distance=3.5cm] (cent) There exists $\mu\in\mathbb{C}$ such that
$\Q - \begin{bmatrix}B^H & 0\end{bmatrix} \begin{bmatrix}
0 & \mu I-(J-R)Q \\
-\mu I -((J-R)Q)^H & QRQ
\end{bmatrix}^{-1}\begin{bmatrix}
B\\ 0
\end{bmatrix}$ is invertible
[block7,below of=cent, node distance=3.5cm] (hier) There exists $\omega\in\mathbb{R}$ such that
$ i\omega\notin\sigma((J-R)Q)$ and $\ker\Q\,\cap\ker RQ((J-R)Q-i\omega)^{-1}B = \set{0}$;
[block3,below of=hier, node distance=3.5cm] (dort) There exists $\omega\in\mathbb{R}$ such that
$i\omega\notin\sigma(JQ)$ and $\ker \Q\,\cap\ker RQ(JQ-i\omega I)^{-1}B = \set{0}$;
[block7,below of=dort, node distance=3.5cm] (dortter) There exists $\omega\in\mathbb{R}$ such that
$ i\omega\notin\sigma(JQ)$ and $ B \ker \Q \cap (JQ-i\omega I)\ker RQ = \set{0} = \ker B\cap\ker \Q$;
[block3,below of=dortter, node distance=3.5cm] (dortt) There exists $\omega\in\mathbb{R}$ such that
$ i\omega\notin\sigma(JQ)$ and $\ker\Q \cap B^{-1}(JQ-i\omega I)\ker RQ = \set{0}$;
[below of = dortt, node distance = 3.5cm] (centt) ;
[block4, right of = centt, node distance = 4.5cm] (rechts) $\ker \Q\ \cap \bigcap\limits_{r = 0}^n \ker RQ(JQ)^rB = \set{0}$;
[block5, left of = centt, node distance = 4.5cm] (links) $B\ker \Q\cap\ker RQ = \set{0} = \ker B \cap \ker \Q$;

[double,<->] (pert) –  node [] Proposition <ref> (ii) and <cit.>(cent);
[double,<->] (cent) –  node [] Proposition <ref> (iii) and <cit.>(hier);
[double,<->] (hier) –  node [] Proposition <ref> (iv)(dort);
[double,<->] (dort) –  node [] Proposition <ref>(dortter);
[double,<->] (dortter) –  node [] Proposition <ref> (v)(dortt);
[transform canvas = xshift = -0.5cm]
[double,<-] (dortt) – node [] Proposition <ref> (links);

[transform canvas = xshift = +1.5cm]
[double,->] (dortt) – node [] Proposition <ref> (rechts);

[transform canvas = xshift = 0.5cm]
[double,<-] (dortt) – node [anchor=east]  coordinate (m0) (rechts);
[black] ($(m0)+(0.1,0.15)$) – ($(m0)+(-0.1,-0.15)$);

[transform canvas = xshift = -1.5cm]
[double,->] (dortt) – node [anchor=east]  coordinate (m) (links);
[black] ($(m)+(0.1,-0.15)$) – ($(m)+(-0.1,0.15)$);

Equivalent, sufficient and necessary conditions for for regularity of the optimality DAE (<ref>).

§ EXISTENCE OF AN OPTIMAL TRAJECTORY

In our considerations so far, we have only focused on the regularity of the pencil associated with the necessary and sufficient optimality conditions of the port-Hamiltonian optimal control problem (<ref>). Using the general solution formula that we presented in Proposition <ref>, we can derive a solution formula for (<ref>) along the lines of <cit.>.

Recall the Drazin inverse from Definition <ref> and note that $M^DM = MM^D$ coincides with the spectral projection onto the direct sum of the generalized eigenspaces (root subspaces) of $M$ corresponding to its non-zero eigenvalues.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$ be such that $s\mathcal{E}-\mathcal{A}_\Q$ is regular. Choose $\mu\in\mathbb{K}\setminus(\sigma((J-R)Q)\cup \sigma(-((J-R)Q)^H))$ such that $\mu\mathcal{E}-\mathcal{A}_\Q$ is invertible, define $\Q_\mu$ as in (<ref>) and

\begin{align}
E_\mu & := \begin{bmatrix}
0 & (J-R)Q - \mu I \\
((J-R)Q)^H+\mu I & QRQ
\end{bmatrix}^{-1}
% Volker:
%E_\mu & := \begin{bmatrix}
%0 & \mu I-(J-R)Q \\
% -\mu I -((J-R)Q)^H & QRQ
% Jonas:
%\mu-Q(J+R) & QRQ\\
%0 & \mu-(J-R)Q
N_\mu & := \left(E_\mu + E_\mu\begin{bmatrix}
B\\ 0
\end{bmatrix}\Q_\mu^{-1}\begin{bmatrix}B^H &0\end{bmatrix}E_{\mu}\right)\bmat 0{-I}I0,\label{eq:Nmu}\\
M_\mu & := \Q_\mu^{-1}\begin{bmatrix}B^H &0\end{bmatrix}E_\mu\bmat 0{-I}I0.\label{eq:Mmu}
\end{align}

A function $\begin{bmatrix}\lambda^T & x^T & u^T\end{bmatrix}^T\in\mathcal{C}^1([t_0,t_1],\mathbb{K}^{n+n+m})$ is a solution of (<ref>) if, and only if, $\begin{bmatrix}
\la(t_0)\\ x(t_0))
\end{bmatrix}\in\im(N_\mu^DN_\mu)$ and

\begin{equation}\label{eq:unsere_lösungen}
\begin{aligned}
\begin{bmatrix}
\lambda\\x
\end{bmatrix}
& = \exp{-[N_\mu^D(I-\mu N_\mu)](\,\cdot\,-t_0)}
\begin{bmatrix}
\lambda(t_0)\\
\end{bmatrix},\\
u & = M_\mu N_\mu^D\begin{bmatrix}
\lambda\\x
\end{bmatrix}.
\end{aligned}
\end{equation}

In view of the calculations in <cit.> and Proposition <ref>,  $\begin{bmatrix}\lambda^T & x^T & u^T\end{bmatrix}^T$ is a solution of (<ref>) if, and only if, there are $v_\lambda,v_x\in\mathbb{K}^n$ so that

\begin{align}
\begin{split}\label{eq:Campy}
\begin{bmatrix}
\lambda\\x
\end{bmatrix} & = \exp{-[N_\mu^D(I-\mu N_\mu)](\cdot-t_0)}N_\mu^DN_\mu\begin{bmatrix}
\end{bmatrix},\\
u & = M_\mu N_\mu^D\begin{bmatrix}
\lambda\\x
\end{bmatrix}.
\end{split}
\end{align}

Note that $N_\mu^DN_\mu$ is the spectral projection onto the sum of the root subspaces of $N_\mu$ corresponding to the non-zero eigenvalues.
Therefore, every function with $\begin{bmatrix}
\la(t_0)\\ x(t_0))
\end{bmatrix}\in\im(N_\mu^DN_\mu)$

that has the representation (<ref>) is indeed a solution of (<ref>). Conversely, let $\begin{bmatrix}\lambda^T & x^T & u^T\end{bmatrix}^T\in\mathcal{C}^1([t_0,t_1],\mathbb{K}^{n+n+m})$ be a solution of (<ref>) and let $v_\lambda,v_x\in\mathbb{R}$ be such that (<ref>) holds.

Then $\begin{bmatrix}\lambda^T(t_0) \\ x^T(t_0) \end{bmatrix} = N_\mu^DN_\mu\begin{bmatrix} v_\la\\ v_x\end{bmatrix}\in\im(N_\mu^D N_\mu)$, which proves the assertion.

The statement of Proposition <ref> shows that the
subspace $\im(N_\mu^DN_\mu)$ determines the set of admissible initial values for the boundary value problem (<ref>). Since (<ref>) does not depend on the particular choice of $\mu$, the subspace $\im(N_\mu^DN_\mu)$ does not either, which is shown in the following corollary.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$ be such that $s\mathcal{E}-\mathcal{A}_\Q$ is regular. Choose $\mu,\nu\in\mathbb{K}\setminus(\sigma((J-R)Q)\cup \sigma(Q(J+R)))$ such that both $\mu\mathcal{E}-\mathcal{A}_\Q$ and $\nu\mathcal{E}-\mathcal{A}_\Q$ are invertible. Then we have $\im(N_\mu^DN_\mu) = \im(N_\nu^D N_\nu)$.

The following proposition finally characterizes the existence of a solution of the optimality system with prescribed initial and terminal values for the state, cf. <cit.>.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$. Let $\mu\in\mathbb{K}\setminus(\sigma((J-R)Q)\cup \sigma(-(J-RQ)^H))$ be such that $\mu\mathcal{E}-\mathcal{A}_\Q$ is invertible and let $E_1,E_2,E_3,E_4:\mathbb{R}\to\mathbb{K}^{n\times n}$ be such that for all $t\in\mathbb{R}$

\begin{align}\label{eq:drazindecomp}
\exp{-[N_\mu^D(I-\mu N_\mu)](t-t_0)}
= \begin{bmatrix}
E_1(t) & E_2(t)\\
E_3(t) & E_4(t)
\end{bmatrix}.
\end{align}

If $E_3(t_1)$ is invertible, then (<ref>) possesses a solution $\begin{bmatrix}\lambda^T & x^T & u^T\end{bmatrix}^T\in\mathcal{C}^1([t_0,t_1],\mathbb{K}^{n+n+m})$ with $x(t_0) = x^0$ and $x(t_1) = x^1$ if, and only if,

\begin{align}\label{e:x0x1_condi}
\begin{bmatrix}E_3(t_1)^{-1}[x^1 - E_4(t_1)x^0]\\ x^0
\end{bmatrix}\,\in\,\im(N_\mu^DN_\mu).
\end{align}

By Proposition <ref>, the system (<ref>) has a solution $(x,\lambda,u)$ with $x(t_0) = x^0$ if, and only if, $\begin{bmatrix}\lambda^T(t_0) \\ x^T(t_0) \end{bmatrix} = N_\mu^DN_\mu\begin{bmatrix} v_\la\\ v_x\end{bmatrix}\in\im(N_\mu^D N_\mu)$ and (<ref>) holds. If we evaluate the state of such a solution at time $t_1$, we obtain

\begin{align*}
x(t_1) = E_3(t_1)\lambda(t_0) + E_4(t_1)x^0,
\end{align*}

and hence $x(t_1) = x^1$ if, and only if, $\la(t_0) = E_3(t_1)^{-1}[x^1 - E_4(t_1)x^0]$.

The optimal control that we have obtained in Proposition <ref>, cf. (<ref>), is not a state feedback solution, as it depends additionally on the adjoint. However, Proposition <ref> enables us to eliminate this dependence and to define the optimal control as a state feedback.

Let $(J,R,Q,B)\in\PH$ and $\Q\in\mathbb{K}^{m\times m}$ with $\Q^H = \Q\geq 0$. Let $\mu\in\mathbb{K}\setminus(\sigma((J-R)Q)\cup \sigma(-(J-RQ)^H))$ be such that $\mu\mathcal{E}-\mathcal{A}_\Q$ is invertible. Consider the decomposition (<ref>), assume that $E_3^\mu(t_1)$ is invertible and let the condition (<ref>) hold.

Then, the unique optimal control of (<ref>) is given by

\begin{align*}
u(t) = M_\mu N_\mu^D\exp{-[N_\mu^D(I-\mu N_\mu)](t-t_0)}
\begin{bmatrix}
E_3^\mu(t_1)^{-1}[x^1 - E_4^\mu(t_1)x^0]\\
\end{bmatrix}
\end{align*}

for all $t\in [t_0,t_1]$ with $N_\mu$ and $M_\mu$ as defined in (<ref>) and (<ref>).

The formula (<ref>) implies that

\begin{align*}
u = M_\mu N_\mu^D\exp{-[N_\mu^D(I-\mu N_\mu)](\cdot-t_0)}
\begin{bmatrix}
\lambda(t_0)\\
\end{bmatrix}.
\end{align*}

Inserting the formula $\lambda(t_0) = E_3^\mu(t_1)^{-1}[x^1 - E_4^\mu(t_1)x^0]$ derived in the proof of Proposition <ref> yields the assertion.

§ ILLUSTRATING EXAMPLES

In this section, we provide several examples to illustrate the theoretical results of the previous sections.

As shown in Proposition <ref>, more specifically in (<ref>), the flow of the optimality DAE (<ref>) can be calculated by means of the matrix function $H_\mu : \R\to\K^{2n\times 2n}$, defined by

H_\mu(t) := \exp{-[N_\mu^D - \mu N_\mu^DN_\mu](t-t_0)}N_\mu^DN_\mu.

First, we revisit Example <ref> and set $\ell = 1$ and $M = K = 1$, i.e. we consider the matrices

\begin{align*}
J := \begin{bmatrix}
0 & -1\\
1 & 0
\end{bmatrix},\quad R := \begin{bmatrix}
d & 0\\
0 & 0
\end{bmatrix},\quad Q := I_2,\quad B:= \begin{bmatrix}
\end{bmatrix}
\end{align*}

for some damping coefficient $d>0$ and the corresponding minimal energy optimal control problem, cf. (<ref>) with $S=0$:

\begin{align*}
\min\ & d\int_{t_0}^{t_1} x_1^2\,\mathrm{d}t \qquad\mathrm{s.t.}\qquad \tfrac{\mathrm{d}}{\mathrm{d}t}{x} = \begin{bmatrix}
-d & -1\\
1 & 0
\end{bmatrix}x + \begin{bmatrix}
\end{bmatrix}u,\quad x(t_0) = x^0,\ x(t_1) = x^1.
\end{align*}

The associated optimality pencil is then given by

\begin{align*}
s\mathcal{E}-\mathcal{A}_0 = \begin{bmatrix}
s-d & 1 & d & 0 & 0\\
-1 & s & 0 & 0 & 0\\
0 & 0 & s+d & 1 & -1\\
0 & 0 & -1 & s & 0\\
1 & 0 & 0 & 0 & 0
\end{bmatrix}.
\end{align*}

As already noted in Example <ref>, the pencil is regular since the condition $\im B\cap\ker RQ = \{0\}$ is satisfied, cf. Proposition <ref>.

The flow of the associated DAE can be calculated along the lines of Proposition <ref>,

\begin{align*}
H_d:\mathbb{R}\to\mathbb{R}^{4\times 4},\quad t\mapsto \exp{-[N_d^D-dN_d^DN_d](t-t_0)}N_d^DN_d = \frac{1}{d}\begin{bmatrix}
0 & 0 & 0 & 0\\
0 & d & 0 & 0\\
0 & -1 & 0 & 0\\
1 & -t & 0 & d
\end{bmatrix},
\end{align*}

cf. Appendix <ref> for details.
This flow maps an initial state and adjoint state

\begin{align*}
\begin{bmatrix}(\lambda^0)^\top& (x^0)^\top\end{bmatrix}^\top\in\im(N_d^DN_d) = \set{\begin{bmatrix}0 & -dz & z & \zeta\end{bmatrix}^\top\,\big\vert\,z,\zeta\in\mathbb{R}}
\end{align*}

to the trajectories of the adjoint $\lambda$ and the state $x$. Especially, we conclude that each initial value $x^0$ admits a unique $\lambda^0\in\mathbb{R}^2$ so that the optimality system corresponding to $s\mathcal{E}-\mathcal{A}_0$

possesses a solution with initial conditions $\lambda(t_0) = \lambda^0$ and $x(t_0) = x^0$. In particular, an initial condition $\begin{bmatrix}
0 & -dx^0_1 & x^0_1 & x^0_2
\end{bmatrix}$ generates the state trajectory

\begin{align}\label{eq:formulastate}
x(t) & = \begin{bmatrix}
t x_1^0 + x_2^0
\end{bmatrix}.
\end{align}

Therefore, the optimality system yields an optimal solution if, and only if, $x^1_1 = x_1^0$ and $x_2^1 = t_1 x_1^0 + x_2^0$.

Directly applying Proposition <ref>,
we get from (<ref>) the necessary and sufficient condition

\begin{align*}
\begin{bmatrix}
\frac{1}{d}(x_2^1-x_2^0-t_1x^1_1)\\
\end{bmatrix} = \begin{bmatrix}
\frac{1}{d}\begin{bmatrix}
-t_1 & 1\\-1 & 0
\end{bmatrix}\left(x^1-\begin{bmatrix}
0 & 0\\0 & 1
\end{bmatrix}x^0\right)\\
\end{bmatrix}\in\im N_d^DN_d = \set{\begin{bmatrix}0 & -dz
&z & \zeta \end{bmatrix}^T\,\big\vert\, z,\zeta\in\mathbb{R}}
\end{align*}

for the existence of an optimal trajectory that transfers the initial value $x(t_0) = x^0$ to the terminal value $x(t_1) = x^1$.

To calculate the associated optimal control, we refer to Proposition <ref>. Recall that

\begin{align*}
M_d = -\Q_d^{-1}\begin{bmatrix}
B^H &0
\end{bmatrix}E_d = \frac{1}{d^3}\begin{bmatrix}
2d^3+d & -2d^2-1 & -d^3 & d^2\end{bmatrix}.
\end{align*}

Therefore, we get the associated control

\begin{align}\label{eq:formulacontrol}
u(t) & = M_d N_d^D\begin{bmatrix}\lambda(t)\\ x(t)\end{bmatrix} = \frac{1}{d^4}\begin{bmatrix} d^3 &-d^4  &0 &d^4\end{bmatrix}\begin{bmatrix}\lambda(t)\\ x(t)\end{bmatrix} =(t+d) x_1^0+ x_2^0.
\end{align}

The formulas for the optimal state (<ref>) and control (<ref>), and the consistent boundary conditions
coincide with the findings of Example <ref> for this particular scalar case. We stress, however, that in Example <ref> we heavily exploited the structure of the second-order mechanical system, whereas the approach of Proposition <ref> employed here only hinges on the port-Hamiltonian structure of the OCP.

Next we draw upon two academic examples: The first one illustrates that we can choose $\Q = 0$, while the second one shows how to compute the minimal pertubation.

Consider the matrices

\begin{align*}
i & 0\\
0 & 0
\end{bmatrix},\quad R := \begin{bmatrix}
0 & 0\\
0 & 1
\end{bmatrix},\quad Q := \begin{bmatrix}
1 & i\\
-i & 1
\end{bmatrix},\quad B := \begin{bmatrix}
\end{bmatrix}.
\end{align*}

It is clear that $J$ is skew-Hermitian, that $R$ and $Q$ are Hermitian and positive semidefinite.

Using Proposition <ref>, we verify that $s\mathcal{E}-\mathcal{A}_0$ is regular. Let $\omega\in\mathbb{R}\setminus\set{0,1}$. Then we have

\begin{align*}
(JQ-i\omega I)^{-1}\ker RQ & = \begin{bmatrix}
i(1-\omega) & -1\\
0 & -i\omega
\end{bmatrix}^{-1}\set{\begin{bmatrix}z\\ iz\end{bmatrix}\,\big\vert\,z\in\mathbb{C}} = \set{\begin{bmatrix}-iz \\ -\frac{z}{\omega}\end{bmatrix}\,\vert\,z\in\mathbb{C}},
\end{align*}

see Appendix <ref> for the calculation of $\ker RQ$.
Since $B$ has full column rank and $\im B = \mathbb{C}\times\set{0}$, we have $\im B\cap (JQ-i\omega I)^{-1}\ker RQ = \set{0}$ and hence Proposition <ref> yields that $s\mathcal{E}-\mathcal{A}_\Q$ is regular.
In view of Proposition <ref>, for given $t_0\in\mathbb{R}$ the solutions $(x,\lambda,u)$ have the form

\begin{equation}\label{eq:equation_3}
\begin{aligned}
\begin{bmatrix}
\lambda(t)\\x(t)
\end{bmatrix} & = T\begin{bmatrix}
\exp{\frac{1}{2}(i-\sqrt{3+8i})(t-t_0)} & 0 & 0 & 0\\
0 & \exp{\frac{1}{2}(i+\sqrt{3+8i})(t-t_0)} & 0 & 0\\
0 & 0 & \exp{(1-i)(t-t_0)} & 0\\
0 & 0 & 0 & 1
\end{bmatrix}T^{-1}\begin{bmatrix}
\lambda(t_0)\\
\end{bmatrix},\\
u(t) & = -\frac{5}{1-2i} \big(x_1(t)+(2-i)x_2(t)-i\lambda_2(t)\big)
\end{aligned}
\end{equation}

for all $t\in\mathbb{R}$ with $T$ given in Appendix <ref>. Given $x^0,x^1\in\mathbb{C}^2$ and $t_0<t_1\in\mathbb{R}$, we conclude that (<ref>) has a solution $(x,\lambda,u)$ with $x(t_0) = x^0$ and $x(t_1) = x^1$ if, and only if,

\begin{align}\label{eq:equation_4}
x^1 = \frac{1}{(28i-12)}\begin{bmatrix}
(8+10i)\exp{(1-i)(t_1-t_0)}-20+8i & (8+10i)\exp{(1-i)(t_1-t_0)}+20-8i\\
(8+10i)\exp{(1-i)(t_1-t_0)}-8-20i & (8+10i)\exp{(1-i)(t_1-t_0)}+8+20i
\end{bmatrix}x^0.
\end{align}

Therefore, we can use the presented method to find an optimal solution of the associated optimal control problem (<ref>)

if, and only if, the boundary conditions $x^0$ and $x^1$ fulfill (<ref>). To obtain the same result from (<ref>) in Proposition <ref>, we have

\begin{align*}
H_1(t_1) = \exp{A t_1} = T\exp{T^{-1}AT}T^{-1} = T\begin{bmatrix}
\exp{\frac{1}{2}(i-\sqrt{3+8i})(t_1-t_0)} & 0 & 0 & 0\\
0 & \exp{\frac{1}{2}(i+\sqrt{3+8i})(t_1-t_0)} & 0 & 0\\
0 & 0 & \exp{(1-i)(t_1-t_0)} & 0\\
0 & 0 & 0 & 1
\end{bmatrix}T^{-1},
\end{align*}

where we omit the details of the calculation.

Next, we give an example in which the pencil $s\mathcal{E}-\mathcal{A}_0$ is singular, and use Lemma <ref> to find a rank-minimal perturbation $\Q$ so that the perturbed pencil $s\mathcal{E}-\mathcal{A}_\Q$ is regular.

Let $J = i$, $R = 0$, $Q = 1$ and $B = \begin{bmatrix} 1&i\end{bmatrix}\in\mathbb{C}^{1\times 2}$. Then $(J,R,Q,B)\in\PH$. In this case

\begin{align*}
s\mathcal{E}-\mathcal{A}_0 = \begin{bmatrix}
s-i & 0 & 0 & 0\\
0 & s-i & -1 & -i\\
1 & 0 & 0 & 0\\
i & 0 & 0 & 0
\end{bmatrix}.
\end{align*}

is evidently singular. Since $\ker RQ = \mathbb{C}$, we have $B^{-1}(JQ-i\omega I)\ker RQ = \mathbb{C}^2$ and by Lemma <ref> the pencil $\mathcal{E}-\mathcal{A}_\Q$ with $\Q\in\mathbb{K}^{m\times m}$ symmetric and positive semidefinite is regular if, and only if, $\Q$ is positive definite.

Recall that the DAE associated with the pencil $s\mathcal{E}-\mathcal{A}_0$ aims to determine the optimal solutions of the optimal control problem

\begin{equation*}
\begin{aligned}
\min\quad & 0\\
\mathrm{s.t.}\quad & \tfrac{\mathrm{d}}{\mathrm{d}t}x = ix+u_1+iu_2,\qquad x(t_0) = x^0,\ x(t_1) = x^1
\end{aligned}
\end{equation*}

and we see that every solution of the ODE which fulfills the boundary conditions is optimal. If $t_1-t_0$ is no multiple of $2\pi$, then the function

\begin{align*}
x:\mathbb{R}\to\mathbb{C},\quad t\mapsto \exp{i(t-t_0)}x^0 + \frac{\exp{i(t_1-t_0)}x^0-x^1}{i\exp{i(t-t_0)}-i}
\end{align*}

is an optimal solution with constant control. However, our perturbed problem associated with the regular pencil $s\mathcal{E}-\mathcal{A}_\Q$ is the optimal control problem

\begin{align*}
\min\quad & \int_{t_0}^{t_1} u^H\Q u\,\mathrm{d}t\\
\mathrm{s.t.}\quad & \tfrac{\mathrm{d}}{\mathrm{d}t}x = (J-R)Qx+Bu,\qquad x(t_0) = x^0,\ x(t_1) = x^1.
\end{align*}

Consider e.g. $\Q = I_2$. Then for all $\mu\in\mathbb{C}$ we have that
$\mu\mathcal{E}-\mathcal{A}_\Q $
is invertible if, and only if, $\mu\neq i$.
Taking e.g.  $\mu = 2i$, we get

\begin{align*}
(2i\mathcal{E}-\mathcal{A}_I)^{-1} = \begin{bmatrix}
i & 0 & 0 & 0\\
0 & i & -1 & -i\\
1 & 0 & -1 & -1\\
i & 0 & 0 & -1
\end{bmatrix}^{-1} = \begin{bmatrix}
-i & 0 & 0 & 0\\
0 & -i & i & -1\\
-i & 0 & -1 & 0\\
1 & 0 & 0 & -1
\end{bmatrix},
\end{align*}

and hence,

\begin{align*}
N_{2i} = \begin{bmatrix}
-i & 0\\
0 & -i
\end{bmatrix},\quad N_{2i}^D = N_{2i}^{-1} = \begin{bmatrix}
i & 0\\
0 & i
\end{bmatrix},\quad\text{and}\quad M_{2i} = \begin{bmatrix}
-i & 0\\
1 & 0
\end{bmatrix}.
\end{align*}

Then $N_{2i}^D(I-2iN_{2i}) = N_{2i}^D-2i$ and we can calculate, for all $t\in\mathbb{R}$,

\begin{align*}
H_{2i}(t) = \exp{-[N_{2i}^D(I-2iN_{2i})](t-t_0)} = \begin{bmatrix}
\exp{i(t-t_0)} & 0\\
0 & \exp{i(t-t_0)}
\end{bmatrix}.
\end{align*}

By Proposition <ref>, all solutions of the DAE $(\tfrac{\mathrm{d}}{\mathrm{d}t}\mathcal{E}-\mathcal{A}_I)(\lambda,x,u)$ with the initial condition $x(0) = x^0$ are given as

\begin{align*}
\lambda(\cdot) & = \exp{i(\cdot-t_0)}\lambda(0),\\
x(\cdot) & = \exp{i(\cdot-t_0)}x^0,\\
u(\cdot) & = \lambda(\cdot)\begin{bmatrix}
\end{bmatrix}.
\end{align*}

In particular, we have a solution of the optimality DAE that fulfills the boundary values for $x$ if, and only if, $x^1 = \exp{i(t_1-t_0)}x^0$. Note, that Proposition <ref> is not applicable as $E_3(t)=0$ is not invertible in this case.

As last example, we  consider
a boundary controlled heat equation.

We consider the temperature distribution in a domain $\Omega\subset \mathbb{R}^d$, $d\in \{1,2,3\}$ with a Dirichlet boundary control on a part of the boundary $\Gamma_\mathrm{c}\subset \partial \Omega$. The model is given by

\begin{align*}
&& \dot \theta(t,\omega)&= \kappa \Delta \theta(t,\omega),\ &&\omega\in \Omega, \ t\in [0,T],\\
&& \theta(t,\gamma) &= u(t,\gamma),\ &&\gamma \in \Gamma_\mathrm{c},\ t\in [0,T],\\
&& \theta(s,\gamma) &= 0,\ &&\gamma \in \Gamma\setminus \Gamma_\mathrm{c}, t\in [0,T],
\end{align*}

where $\theta (t,\omega)$ is the temperature at time $t\in [0,T]$ at the space point $\omega\in \Omega$ and $\kappa > 0$ is a heat conductivity coefficient.
Discretizing in space by central finite differences, see e.g.
[42], with a regular mesh of mesh size $h> 0$ and $n\in \mathbb{N}$ grid points $\{\omega_0,\ldots,\omega_{n-1}\}$, leads to a control problem

\begin{equation*}
\dot z_h(t)= -R_h z_h(t) + B_h u(t),\  t\in [0,T],
\end{equation*}

where $z_h(t)\in \R^{n}$ consists of the nodal values of the temperature profile, i.e. $(z_h(t))_j = \theta(t,\omega_j)$ for $j\in \{0,\ldots,n-1\}$.  The matrix $R_h\in \R^{n \times n}$ is the finite difference
matrix associated with the negative Laplace operator at all mesh points. The input matrix $B_h \in \R^{n\times m}$, describes the matrix with associated with the $m\in \mathbb{N}$ grid points on the control boundary $\Gamma_\mathrm{c}$. Adding an output equation $y=B_h^T z_h$ yields a port-Hamiltonian system of the form (<ref>) with $R=R_h$, $J=0$, $Q=I$ and $B=B_h$,

where $R = R_h$
is symmetric and positive semidefinite with a kernel of the dimension of the number of grid points on the boundary. However, as the values on the boundary points are fixed, the corresponding rows of $B_h$ are zero, such that $\im B_h\cap \ker R_h = \{0\}$.

We briefly illustrate this for the one-dimensional case with $\Omega = [0,1]$, $\Gamma_\mathrm{c} = \{0\}$ and $\Gamma\setminus \Gamma_\mathrm{c} = \{1\}$  with equidistant grid $0 = \omega_0<\ldots<\omega_{n-1} = 1$.

For $t \in [0,T]$ we obtain the finite-difference approximation at the interior nodes

\begin{align*}
\Delta \theta(t,\omega_j) \approx \frac{\theta(t,\omega_{j+1}) - 2\theta(t,\omega_{j}) + \theta(t,\omega_{j-1})}{h^2}, \qquad  j = 1,\ldots,n-2.
\end{align*}

Moreover, incorporating the boundary conditions $\theta(t,\omega_0) = u(t)$ and $\theta(t,\omega_{n-1}) = 0$, we get

\begin{align*}
\Delta \theta(t,\omega_1) \approx \frac{\theta(t,\omega_{2}) - 2\theta(t,\omega_{1}) + u(t)}{h^2} \quad
\mathrm{and} \quad \Delta \theta(t,\omega_{n-2}) \approx - \frac{2\theta(t,\omega_{n-2}) - \theta(t,\omega_{n-3})}{h^2} \\
\end{align*}

and thus

\begin{align*}
R_h =
\begin{bmatrix}
0 & 0 & 0 & 0 & \cdots & 0\\
0 & 2 & -1 & \ddots & \ddots & \vdots\\
0 & -1 & \ddots & \ddots & \ddots & 0\\
0 & \ddots & \ddots & \ddots & -1 & 0\\
\vdots & \ddots & \ddots & -1 & 2 & 0\\
0 & \cdots & 0 & \phantom{\ddots}\hspace*{-.4cm}0 & 0 & 0
\end{bmatrix}\in \R^{n\times n}, \qquad
% \qquad B_h = \begin{bmatrix}
% 0 & 0 \\
% 1 & \phantom{\ddots}\hspace*{-.4cm}0\\
% 0 & \vdots\\
% \vdots & \phantom{\ddots}\hspace*{-.4cm}0 \\
% 0 & \phantom{\ddots}\hspace*{-.4cm}1 \\
% 0 & \phantom{\ddots}\hspace*{-.4cm}0
% \end{bmatrix}.
B_h = \begin{bmatrix}
\end{bmatrix}\in \R^{n\times 1}.
\end{align*}

Here, clearly $\ker R_h = \operatorname{span}\{e_1,e_{n}\}$ and $\im B_h = \operatorname{span}\{e_2\}$, where $e_j\in \R^{n}$, $j\in \{1,\ldots,n\}$
is the canonical unit vector. Thus, $\im B_h \cap \ker R_h = 0$. Considering the corresponding optimal control problem with minimal energy supply, applying Proposition <ref> yields regularity of the corresponding optimality system and Proposition <ref> implies that the associated DAE has index three. In particular this shows that a regularization term in the cost penalizing the control is not necessary.

§ CONCLUSIONS AND OUTLOOK

The optimality system associated with the problem of steering a port-Hamiltonian system from an initial state to a terminal state on a given time interval with minimal energy supply has been studied. Regularity of this differential-algebraic equation has been characterized exploiting the port-Hamiltonian structure.
Minimal rank quadratic perturbations of the cost functional have been characterized so that the perturbed problem produces a regular optimality system. Assuming regularity, the solution formula for regular linear time-invariant differential-algebraic equations leads to a characterization of optimal solutions. Moreover, we have derived conditions which allow to characterize the optimal control as a state feedback. Last, the results are illustrated by means of examples, including second-order mechanical systems and a discretized heat equation.

Future works consider extensions to control of nonlinear or infinite-dimensional port-Hamiltonian systems, such as beam equations, building upon [31] are subject to future research. In the nonlinear case, first steps were conducted by [15, 27]. In the infinite-dimensional case, we expect that the structure of the descriptor matrix in the optimality DAE can help to generalize the results.

§ DETAILED CALCULATIONS

§.§ Calculations for Example <ref>

We calculate $\Q_\mu$ at $\mu = d$. In view of <cit.>, we have

\begin{align*}
S_d & = -B^\top(d-J-R)^{-1}R(d-J+R)^{-1}B\\
& = -[1,0]\begin{bmatrix}
0 & 1\\-1 & d
\end{bmatrix}^{-1}\begin{bmatrix}
d & 0\\
0 & 0
\end{bmatrix}\begin{bmatrix}
2d & 1\\-1 & d
\end{bmatrix}^{-1}\begin{bmatrix}
\end{bmatrix}  = -\frac{d^3}{2d^2+1},
\end{align*}

and after some tedious, but straightforward calculations

\begin{align*}
E_d = \frac{1}{2d^2+1}\begin{bmatrix}
2d^3+d & -2d^2-1 & -d^3 & d^2\\
2d^2+1 & 0 & -d^2 & d\\
0 & 0 & d & -1\\
0 & 0 & 1 & 2d
\end{bmatrix}, \qquad N_d = \frac{1}{d^3}\begin{bmatrix}
0 & 0 & 0 & 0\\
0 & d^2 & 0 & 0\\
d^2 & -d & 0 & 0\\
d & -1 & 0 & d^2
\end{bmatrix}
\end{align*}

using the definition $N_d =
E_d+E_d\begin{bmatrix}B\\0\end{bmatrix}S_d^{-1}\begin{bmatrix} B^H & 0\end{bmatrix}E_d$.
To calculate the Drazin inverse, we transform $N_d$ in Jordan form

\begin{align*}
S^{-1}N_dS = \begin{bmatrix}
0 & 1 & 0 & 0\\
0 & 0 & 0 & 0\\
0 & 0 & \frac{1}{d} & 1\\
0 & 0 & 0 & \frac{1}{d}
\end{bmatrix} \qquad\text{with}\qquad
S := \begin{bmatrix}
0 & d & 0 & 0\\
0 & 0 & 0 & -d^3\\
1 & 0 & 0 & d^2\\
0 & -1 & 1 & 0
\end{bmatrix}.
\end{align*}

Hence, its Drazin inverse can be calculated as

\begin{align*}
N_d^D & = S\begin{bmatrix}
0 & 0 & 0 & 0\\
0 & 0 & 0 & 0\\
0 & 0 & d & -d^2\\
0 & 0 & 0 & d
\end{bmatrix}S^{-1} = \frac{1}{d}\begin{bmatrix}
0 & 0 & 0 & 0\\
0 & d^2 & 0 & 0\\
0 & -d & 0 & 0\\
d & 1 & 0 & d^2
\end{bmatrix}.
\end{align*}

Thus, we get

\begin{align*}
N_d^D-dN_d^DN_d = \frac{1}{d}\begin{bmatrix}
0 & 0 & 0 & 0\\
0 & 0 & 0 & 0\\
0 & 0 & 0 & 0\\
0 & 1 & 0 & 0
\end{bmatrix}.
\end{align*}

§.§ Calculations for Example <ref>

To verify that $Q = \begin{bmatrix}1 & i\\-i & 1\end{bmatrix}$ is positive semidefinite, we calculate the characteristic polynomial as $\chi_Q(s) = \det(s-Q) = (s-1)^2-1 = s(s-2)$ and hence $\sigma(Q) = \set{0,2}$ so that $Q$ is indeed positive semidefinite. The kernel of $RQ$ can be easily calculated directly from

\begin{align*}
\ker RQ = \ker\begin{bmatrix}
0 & 0\\
-i & 1
\end{bmatrix} = \set{(z,iz)\,\big\vert\, z\in\mathbb{C}}.
\end{align*}

To solve (<ref>), we calculate $\Q_\mu$ for $\mu = 1$. By <cit.>, we have

\begin{align*}
\Q_1 & = -B^H(I-Q(J+R))^{-1}Q(I-(J-R)Q)^{-1}B = \frac{1-2i}{5}\neq 0.
\end{align*}

Further, we have

\begin{align*}
E_1 = \begin{bmatrix}
0 & -1 & \frac{1-2i}{5} & \frac{2+i}{5}\\
i & 1+i & -\frac{2+i}{5} & \frac{1-2i}{5}\\
0 & 0 & \frac{4+2i}{5} & -\frac{2+i}{5}\\
0 & 0 & -\frac{1-2i}{5} & \frac{3-i}{5}
\end{bmatrix} \qquad\text{and}\qquad
N_1^D = N_1^{-1} = \begin{bmatrix}
2+i & -i & 1 & i\\
-1 & 0 & -i & 1\\
0 & 0 & 1-i & 1\\
0 & 0 & -i & 2
\end{bmatrix}.
\end{align*}

Hence, we have $A := N_1^D(I_4- N_1) = N_1^D-I_4$.

The characteristic polynomial of $A$ is given by

\begin{align*}
\chi_A(s) = s(s+i-1)\left(s-\frac{1}{2}(i+\sqrt{3+8i})\right)\left(s-\frac{1}{2}(i-\sqrt{3+8i})\right).
\end{align*}

Thus, $A$ is diagonalizable and a direct calculation verifies that the transformation matrix

\begin{align*}
T & :=\frac{1}{\sqrt{3+8i}(28i-12)}\begin{bmatrix}
2 & 2 & 2 & 0\\
1-i(2+\sqrt{3+8i}) & 1-i(2-\sqrt{3+8i}) & -3-3i & 0\\
0 & 0 & -2-5i & 1\\
0 & 0 & -2-5i & i
\end{bmatrix}
\end{align*}

diagonalizes the matrix $A$ as $T^{-1}AT = \mathrm{diag}(\frac{1}{2}(i-\sqrt{3+8i}), \frac{1}{2}(i+\sqrt{3+8i}), 1-i, 0)$.

§ ACKNOWLEDGEMENT

We are indebted to our colleagues Achim Ilchmann and Timo Reis for several constructive discussions.

§ FUNDING

JK thanks Technische Universität Ilmenau and Freistaat Thüringen for their financial support as part of the Thüringer Graduiertenförderung. VM was supported by German Research Foundation through Priority Program SPP 1984 Hybrid and multimodal energy systems within the project Distributed Dynamic Security Control. FP was funded by the Carl Zeiss Foundation within the project DeepTurb–Deep Learning in and from Turbulence and by the free state of Thuringia within the project THInKI–Thüringer Hochschulinitiative für KI im Studium. KW gratefully acknowledges funding by the German Research Foundation (DFG; grant no. 507037103).

[1]
R. Altmann and P. Schulze, A port-Hamiltonian formulation of the
Navier–Stokes equations for reactive flows, Systems & Control
Letters, 100 (2017), pp. 51–55,

[2]
M. Aronna, Second order analysis of optimal control problems with
singular arcs. Optimality conditions and shooting algorithm., theses,
Ecole Polytechnique X, December 2011.

[3]
D. Bell and D. Jacobson, Singular optimal control problems,
Elsevier, 1975.

[4]
T. Berger, A. Ilchmann, and S. Trenn, The quasi-Weierstraß form
for regular matrix pencils, Lin. Alg. Appl., 436 (2012), pp. 4052–4069.

[5]
A. Brugnoli, D. Alazard, V. Pommier-Budinger, and D. Matignon, Port-Hamiltonian formulation and symplectic discretization of plate models
part i: Mindlin model for thick plates, Applied Mathematical Modelling, 75
(2019), pp. 940–960.

[6]
A. Brugnoli, D. Alazard, V. Pommier-Budinger, and D. Matignon, Port-Hamiltonian formulation and symplectic discretization of plate models
part ii: Kirchhoff model for thin plates, Applied Mathematical Modelling,
75 (2019), pp. 961–981.

[7]
R. Byers, V. Mehrmann, and H. Xu, A structured staircase
algorithm for skew-symmetric/symmetric pencils, Electronic Transactions on
Numerical Analysis, 26 (2007), pp. 1–33.

[8]
S. L. Campbell, Optimal control of autonomous linear processes with
singular matrices in the quadratic cost functional, SIAM Journal on Control
and Optimization, 14 (1976), pp. 1092–1106.

[9]
S. L. Campbell, C. D. Meyer, Jr., and N. J. Rose, Applications of
the Drazin inverse to linear systems of differential equations with
singular constant coefficients, SIAM Journal on Applied Mathematics, 31
(1976), pp. 411–425.

[10]
V. Duindam, A. Macchelli, S. Stramigioli, and H. Bruyninckx, Modeling and control of complex physical systems: the port-Hamiltonian
approach, Springer Berlin, Heidelberg, 2009.

[11]
T. Faulwasser, B. Maschke, F. Philipp, M. Schaller, and K. Worthmann,
Optimal control of port-Hamiltonian descriptor systems with minimal
energy supply, SIAM Journal on Control and Optimization, 60 (2022),
pp. 2132–2158.

[12]
F. R. Gantmacher, The Theory of Matrices volume one, AMS Chelsea
Publishing, Providence, Rhode Island, 3rd ed., 1977.

[13]
H. Hoang, F. Couenne, C. Jallut, and Y. Le Gorrec, The port
Hamiltonian approach to modeling and control of continuous stirred tank
reactors, Journal of Process Control, 21 (2011), pp. 1449–1458.

[14]
B. Jacob and H. J. Zwart, Linear port-Hamiltonian systems on
infinite-dimensional spaces, vol. 223, Birkhäuser Basel, 2012.

[15]
A. Karsai, Manifold turnpikes of nonlinear port-Hamiltonian
descriptor systems under minimal energy supply, arXiv:2301.09094,  (2023).

[16]
L. Kölsch, P. J. Soneira, F. Strehle, and S. Hohmann, Optimal
control of port-Hamiltonian systems: A continuous-time learning approach,
Automatica, 130 (2021), p. 109725.

[17]
S. G. Krantz and H. R. Parks, A Primer of Real Analytic
Functions, Birkhäuser Boston, second ed., 2002.

[18]
P. Kunkel and V. Mehrmann, Differential-Algebraic Equations.
Analysis and Numerical Solution, EMS Publishing House, Zürich, 2006.

[19]
P. Kunkel and V. Mehrmann, Optimal control for linear descriptor
systems with variable coefficients, in Numerical Linear Algebra in Signals,
Systems and Control, Springer New York, 2011, pp. 313–339.

[20]
P. Kunkel and V. Mehrmann, Local and global canonical forms for
differential-algebraic equations with symmetries, Vietnam Journal of
Mathematics, 51 (2023), pp. 177–198.

[21]
P. Kunkel, V. Mehrmann, and L. Scholz, Self-adjoint
differential-algebraic equations, Mathematics of Control, Signals, and
Systems, 26 (2014), pp. 47–76.

[22]
E. Lee and L. Markus, Foundations of Optimal Control Theory, The
SIAM Series in Applied Mathematics, John Wiley & Sons New York, London,
Sydney, 1967.

[23]
D. Liberzon, Calculus of Variations and Optimal Control Theory. A
Concise Introduction, Princeton Univerity Press, Princeton, Oxford, 2012.

[24]
J. Liesen and V. Mehrmann, Linear Algebra, Springer
Undergraduate Mathematics Series, Springer-Verlag, Cham, 2015.

[25]
A. Macchelli, Towards a port-based formulation of macro-economic
systems, Journal of the Franklin Institute, 351 (2014), pp. 5235–5249.

[26]
A. Macchelli, C. Melchiorri, and S. Stramigioli, Port-based modeling
of a flexible link, IEEE Transactions on Robotics, 23 (2007), pp. 650–660.

[27]
B. Maschke, F. Philipp, M. Schaller, K. Worthmann, and T. Faulwasser,
Optimal control of thermodynamic port-Hamiltonian systems,
IFAC-PapersOnLine, 55 (2022), pp. 55–60.

[28]
B. Maschke and A. van der Schaft, Port-controlled Hamiltonian
systems: modelling origins and systemtheoretic properties, in Nonlinear
Control Systems Design, Elsevier, 1992, pp. 359–365.

[29]
V. Mehrmann, The Autonomous Linear Quadratic Control Problem.
Theory and Numerical Solution, vol. 163 of Lecture Notes in Control and
Information Sciences, Berlin etc.: Springer-Verlag, 1991.

[30]
V. Mehrmann and B. Unger, Control of port-Hamiltonian
differential-algebraic systems and applications, Acta Numerica, In press

[31]
F. Philipp, M. Schaller, T. Faulwasser, B. Maschke, and K. Worthmann,
Minimizing the energy supply of infinite-dimensional linear
port-Hamiltonian systems, IFAC-PapersOnLine, 54 (2021), pp. 155–160.

[32]
F. Philipp, M. Schaller, K. Worthmann, T. Faulwasser, and B. Maschke,
Optimal control of port-Hamiltonian systems: energy, entropy, and
exergy, Preprint arXiv:2306.08914,  (2023).

[33]
L. Pontryagin, V. Boltyanskii, R. Gamkrelidze, and E. Mishenko, The
Mathematical Theory of Optimal Processes, Interscience, New York, 1962.

[34]
R. Rashad, F. Califano, F. P. Schuller, and S. Stramigioli, Port-Hamiltonian modeling of ideal fluid flow: Part i. foundations and
kinetic energy, Journal of Geometry and Physics, 164 (2021), p. 104201.

[35]
R. Rashad, F. Califano, F. P. Schuller, and S. Stramigioli, Port-Hamiltonian modeling of ideal fluid flow: Part ii. compressible and
incompressible flow, Journal of Geometry and Physics, 164 (2021), p. 104199.

[36]
T. Reis and T. Stykel, Passivity, port-Hamiltonian formulation and
solution estimates for a coupled magneto-quasistatic system, 2021.
Preprint arXiv:2205.15259.

[37]
M. Schaller, F. Philipp, T. Faulwasser, B. Maschke, and K. Worthmann,
Control of port-Hamiltonian systems with minimal energy supply,
European Journal of Control, 60 (2021), pp. 33–40.

[38]
M. Schaller, A. Zeller, M. Böhm, O. Sawodny, C. Tarín, and
K. Worthmann, Energy-optimal control of adaptive structures, Preprint
arXiv:2306.13331,  (2023).

[39]
M. Schöberl, H. Ennsbrunner, and K. Schlacher, Modelling of
piezoelectric structures–a Hamiltonian approach, Mathematical and
Computer Modelling of Dynamical Systems, 14 (2008), pp. 179–193.

[40]
A. Siuka, M. Schöberl, and K. Schlacher, Port-Hamiltonian
modelling and energy-based control of the timoshenko beam, Acta mechanica,
222 (2011), pp. 69–89.

[41]
E. Sontag, Mathematical control theory: deterministic finite
dimensional systems, vol. 6, Springer New York, 2013.

[42]
J. Strikwerda, Finite difference schemes and partial differential
equations, SIAM, 2004.

[43]
F. Tröltzsch, Optimal control of partial differential equations:
theory, methods, and applications, vol. 112, American Mathematical Soc.,

[44]
A. Van Der Schaft and D. Jeltsema, Port-Hamiltonian systems
theory: An introductory overview, Foundations and Trends in Systems and
Control, 1 (2014), pp. 173–378.

[45]
A. Warsewa, M. Böhm, O. Sawodny, and C. Tarín, A
port-Hamiltonian approach to modeling the structural dynamics of complex
systems, Applied Mathematical Modelling, 89 (2021), pp. 1528–1546.

[46]
K.-T. Wong, The Eigenvalue Problem $\lambda tx + sx$, Journal
of Differential Equations, 16 (1974), pp. 270–280.

[47]
Y. Wu, B. Hamroun, Y. Le Gorrec, and B. Maschke, Reduced order LQG
control design for infinite dimensional port Hamiltonian systems, IEEE
Transactions on Automatic Control, 66 (2020), pp. 865–871.

[48]
M. I. Zelikin and V. F. Borisov, Theory of chattering control: with
applications to astronautics, robotics, economics, and engineering,
Birkhäuser Boston, 2012.