---
abstract: |
    [**Abstract**]{} [ ]{}Based on Pontryagin Maximum Principle (PMP), this paper establishes a generalized PMP aiming at control system with with extra input/output terms. The paper details the adaptive target and gives a proof of the generalized theorem. Transformation and application of this specific method is showed and thereafter an example explained its feasibility.

    [**Keyword**]{} [ ]{}Pontryagin Maximum Principle; port-Hamiltonian Systems
author:
- |
    [ Yuanzun Zhao]{}\
    [Department of Mathematics]{}\
    [Peking University, Beijing 100871, China]{}\
    [email: lukesweet@163.com]{}
title: '**Generalized Pontryagin Maximum Principle in port-Hamiltonian Systems and Application** '
---

[**Introduction**]{}
====================

Optimal control, a crucial component of modern control theory, has already been generalized to many kinds of control systems. One of the most used method to deal with optimal control problems is Pontryagin Maximum Principle(PMP)[@qy1]. The core idea of PMP is to embed the target control system into a Hamiltonian system and transform the optimal requirement into a boundary condition[@qy2]. However, not all the problems can be solved through PMP.

Towards control problems with extra terms in the control equation or extra algebraic expression, which cannot be easily solved by classic PMP, it’s effective to embed the systems into port-Hamiltonian. The embedding method, analogous to handling of PMP[@An1], is called Pontryagin Maximum Principle for Port-Hamiltonian Systems and will be detailed in the following. All the conclusions is based on the port-Hamiltonian systems theory and is proved of its reliability and maturity.[@pa1]

[**Acknowledgement:**]{} I would like to thank Mr. Zhangju Liu for his useful advice and great encouragement.

[**port-Pontryagin Maximum Principle and Application**]{}
=========================================================

[**Generalized Optimal Control Problems in port-Hamiltonian Systems**]{}
------------------------------------------------------------------------

Consider the special control system described as follows: $$\dot{q}=F_u (q)+B(q)f',$$ $$e=A^{T}(q)(\dot q-B(q)f')$$ $q\in M,    u=u(t)\in U$, $f'=f'(t),e=e(t)$ is a continuous function in $N$, with initial conditions $$q(0)=q_0,$$ Given cost function $¦Õ:M\times U\times T^{*}N \rightarrow  \mathbb{R}$, the problem is to find a pair of control $u=\tilde{u}$ and input that minimizes $$J=\int_0^{t_1} \varphi(q(t),u(t),e(t)) dt.$$

This is a typical control problem in port-Hamiltonian system, with $B(q)f$ as a port of any kind. Notice that $f$ is a continuous input(different from $u$), that is, it cannot be simply viewed as a part of control. The basic idea dealing with control problems of this kind is dividing it into two parts: finding out the optimal $u$ for fixed $f$, and then finding out the optimal continuous $f$.

To solve the former part, we need to establish a generalized PMP aimed at the port. It’s required to embed the control system in a port-Hamiltonian system, just like PMP embedding control systems in Hamiltonian systems. While the latter part requires transformation and application of PMP.

The two parts are respectively discussed as follows.

[**Generalization to PMP in port-Hamiltonian system** ]{}
---------------------------------------------------------

We now consider embedding the optimal control problem in the following port-Hamiltonian system: $$\left\{
\begin{aligned}
&\frac{\partial q}{\partial t}=\frac{\partial H_u}{\partial p}+B(q)f'\\
&\frac{\partial p}{\partial t}=-\frac{\partial H_u}{\partial q}+A(q)f\\
&e'=B^{T}(q)\frac{\partial H_u}{\partial q}\\
&e=A^{T}(q)\frac{\partial H_u}{\partial p}
\end{aligned}
\right.$$ whereas $M\subset \mathbb{R}^n$ is a configuration space, $U\subset \mathbb{R}^l$ is admissible control set, $N\subset \mathbb{R}^k$ is admissible input set. $q\in M$ is the state of system, and $u(t)\in U$ is a preinstalled control, $A(q), B(q)$ is $n\times k$ transform matrixes depending on state $q$.

With Hamiltonian defined as $h_{u,f}(\lambda)=\langle \lambda,f_u (\lambda) \rangle, \lambda\in T^{*}M$, thereupon we have the following geometric statement of port-PMP: \[section\]

Given an admissible control $u=\tilde{u}(t),f=\tilde{f}(t)$, if (2.2),(2.3) have a solution $\tilde{q}(t)=q_{\tilde{u}(t),\tilde{f}(t)}(t)$, if\
$$\tilde{q}(t_1)\in \partial A_{q_0}(t_1),$$ here $A_{q_0}(t_1)$ indicates the attainable set from point $q_0$ in $t_1$ time, whatever $u(t)$,\
with $f(t)=\tilde f(t)$ fixed.\
Then there exists a Lipschitzian curve $\lambda_t\in T_{\tilde{q}(t)}^* M,t\in [0,t_1]$ in the cotangent bundle, such that\
$$\lambda_t\not\equiv0,$$ $$\frac{\partial \lambda}{\partial t}=-\frac{\partial h_u}{\partial q}+A(q)f,$$ $$h_{\tilde{u}(t),\tilde{f}(t)}(\lambda_t)+\int_0^{t} e(\tilde{u},\tau)f(\tau)+e'(\tilde{u},\tau)f'(\tau)d\tau$$ $$=\max_{u\in U}\{h_{u(t),\tilde{f}(t)}(\lambda_t)+\int_0^{t} e(u,\tau)f(\tau)+e'(u,\tau)f'(\tau)d\tau\}$$ for almost all $t\in [0,t_1]$

To prove the conclusion, a vector field depending on two parameters needs to introduced first:\
$$g_{\tau,u}={P_\tau^{t_1}}_*(F_{u(\tau)}-F_{\tilde u(\tau)}), \tau \in [0,t_1],u\in U$$

According to [@An1], $$q_u(t_1)=q_1\circ \vec{exp} \int_0^{t_1} g_\tau,u(\tau) dx$$

Thus we have the following lemmas:

\[Lem1\]Let $\Gamma \in[0,t_1]$ be the set of Lebesgue points of the control $\tilde{u} (\cdot)$. If $$T_{q_1}M=cone\{g_{\tau,u} (q_1)|\tau \in T ,u\in U\}$$ Then $$q_1\in intA_{q_0}(t_1)=A_{q_0}(t_1)\backslash \partial A_{q_0}(t_1)$$

The proof is in [@An1].

Now in the port-Hamiltonian System, we define a new flow $g^{P}$ $$g_{\tau,u,f}={P_\tau^{t_1}}_*((F_{u(\tau)}+B(q(t))f'(t))-(F_{\tilde u(\tau)}+B(q(t))f'(t)), \tau \in [0,t_1],u\in U$$

\[Lem2\]Let $\Gamma \in[0,t_1]$ be the set of Lebesgue points of the control and input $\tilde{u} (\cdot),\tilde{f} (\cdot)$. If $$T_{q_1}M=cone\{g_{\tau,u,f} (q_1)|\tau \in T ,u\in U\, f\in Q\}$$ Then $$q_1\in intA_{q_0}(t_1)=A_{q_0}(t_1)\backslash \partial A_{q_0}(t_1)$$

Define $\hat u=(u,f)$, $\hat u\in L^k\times C^{(1)l}\subset L^{k+l}$. Apply Lemma \[Lem1\] to $\hat u$ and we directly get the conclusion.

Now return to proof of the theorem. Let the endpoint of trajectory $q_1$ satisfies $q_1=\tilde{q}(t_1)\in \partial A_{q_0}(t_1)$. By Lemma \[Lem2\], if this condition holds, origin point $o_{q_1}\in T_{q_1}M$ belongs to $\partial cone\{g_{\tau,u,f} (q_1)|\tau \in T ,u\in U, f\in N\}$, so this set has a hyperplane of support at the origin: $$\exists \lambda^{E*}_{t_1}\in T_{q_1}^*M, \lambda^{E*}_{t_1}\not=0,$$ satisfies: $$\langle \lambda^{E*}_{t_1},g_{t,u,f}(q_1)\rangle\leq 0, \forall t\in[0,t_1],u\in U$$ Let $\lambda_{t_1}^*=\lambda^{E*}_{t_1}+\int_0^{t_1} A(q(t))f(t)dt$

thus it satisfies: $$\langle \lambda_{t_1}^*+\int_0^{t_1} A(q(t))f(t)dt,g_{t,u,f}(q_1)\rangle\leq 0, \forall t\in[0,t_1],u\in U$$ that is $$\langle \lambda_{t_1}^{E*},P_{t*}^{t_1}(F_u(q_1)+\int_0^{t}B(q)f'd\tau)\rangle\leq \langle \lambda_{t_1}^{E*},P_{t*}^{t_1}(F_{\tilde{u}}(q_1)+\int_0^{t} B(q)f'd\tau)\rangle$$ further, $$\langle P_{t}^{t_1*}(\lambda_{t_1}^{E*}),F_u(q_1)+\int_0^{t}B(q)f'd\tau\rangle\leq \langle P_{t}^{t_1*}(\lambda_{t_1}^{E*}),F_{\tilde{u}}(q_1)+\int_0^{t}B(q)f'd\tau\rangle$$

Then flow $P_t^{t_1}$ defines Lipschitzian curve $\lambda_{t}^*$ in $ T_{q(t)}^*M$: $$\lambda_{t}^*\triangleq P_t^{t_1*}\lambda_{t_1}^*+\int_0^{t}A(q(\tau))f(\tau)d\tau\in T_{\tilde{q}(t)}^*M$$

In terms of this covector curve, the inequation above reads: $$\langle \lambda_{t}^*-\int_0^{t} A(q)fd\tau, F_u(q_1)+\int_0^{t}B(q)f'd\tau\rangle\leq \langle \lambda_{t}^*-\int_0^{t} A(q)fd\tau, F_{\tilde{u}}(q_1)+\int_0^{t}B(q)f'd\tau\rangle$$ that is, $$\langle \lambda_{t}^*,F_u(q_t)\rangle+\int_0^{t}e'(u,\tau)f'(\tau)+e(u,\tau)f(\tau)d\tau\leq \langle \lambda_{t}^*,F_{\tilde{u}}(q_t)\rangle+\int_0^{t}e'(\tilde{u},\tau)f'(\tau)+e(\tilde{u},\tau)f(\tau)d\tau$$ which exactly equals to Hamiltonian maximum conditions: $$\begin{aligned}
&&h_{\tilde{u}(t),\tilde{f}(t)}(\lambda_t)+\int_0^{t} e(\tilde{u},\tau)f(\tau)+e'(\tilde{u},\tau)f'(\tau)d\tau,\\
&&=\max_{u\in U}\{h_{u(t),\tilde{f}(t)}(\lambda_t)+\int_0^{t} e(u,\tau)f(\tau)+e'(u,\tau)f'(\tau)d\tau\}\end{aligned}$$

Besides, since the curve is fixed once the terminal point is fixed, the following equation holds: $$\lambda_{t}^*\triangleq P_t^{t_1*}\lambda_{t_1}^{E*}+\int_0^{t}A(q(\tau))f(\tau)d\tau=\lambda_{t_1}^*\circ (\vec{exp}\int_t^{t_1}-\frac{\partial h_{u,f}}{\partial q}+A(q(x))fdx)^*-\int_t^{t_1}A(q(\tau))f(\tau)d\tau$$ that is, $$\frac{\partial \lambda_t^*}{\partial t}=-\frac{\partial h_{u,f}}{\partial q}+A(q)f\\$$

Thus, the existence of extremal curve is proved.

[**Application of PMP for port-Hamiltonian System and Transformation of Control**]{}
====================================================================================

[**Application of PMP for port-Hamiltonian System**]{}
------------------------------------------------------

PMP for port-Hamiltonian System is adaptive to control systems with either extra input or output. Input $B(q)f'$ in (2.1) corresponds to storage port and output $e$ in (2.2) can be either dissipation port or another storage. Analogously to application of PMP to classic control optimal problems, we introduce an extremal parameter $\nu$.

Consider the following optimal control problem: $$\begin{aligned}
&&\dot{q}=f_u(q), q\in M, u\in U\\
&&q(0)=q_0\in M\\
&&t_1 fixed\end{aligned}$$ and the cost function is defined as $$\hat{J}=\int_0^{t_1}\hat{\varphi}(q(t),u(t),e(t))dt,$$

We extend this control system as follows: $$\hat{q}=\left(
\begin{array}{c}
J_{q_0}(u)\\
q
\end{array}
\right)$$ and extend the corresponding vector field: $$\hat{f}_u(q)=\left(
\begin{array}{c}
\varphi(q,u)\\
f_u(q)
\end{array}
\right)$$

Thus we get a new control system: $$\begin{aligned}
&&\dot{\hat{q}}=\dot{f}_u(q), q\in M, u\in U\\
&&\dot{q}(0)=\dot{q}_0=\left(
\begin{array}{c}
0\\
q_0
\end{array}
\right)\\
&&t_1 fixed\end{aligned}$$ where $\hat{q}_0$ is a (n+1)-dimension random vector.

Notice that if $\tilde{u}$ is optimal control, then the following condition holds: $$h_{\tilde{u}(t)}(\lambda_t^*)=\max_{u\in U} \{h_{u(t)}(\lambda_t^*)$$ Then the terminal point satisfies: $$\tilde{\hat{q}}(t_1)\in \partial A_{\hat{q}_0} (t_1),$$ Therefore, PMP for port-Hamiltonian Systems can be applied to find the extremal curve.

[**Introduction of extremal parameter**]{}
------------------------------------------

When use PMP\* to solve optimal control problems, we need transform it into Hamiltonian equations through the Hamiltonian. However, directly using the previous Hamiltonian does not extinguish maximum from minimum of cost function. To make up the defect, we introduce new parameters $\nu$ and a new control $w$. Define $y=J_{q_0}(u)$, and consider the following system: $$\begin{aligned}
&&\dot y=\varphi(q,u)+w\\
&&\dot q= f_u(q)\end{aligned}$$

Then the extremal stochastic curve in origin system corresponding to the control $w(t)\equiv0$. As a result, it comes to the boundary of attainable set at $t_1$. Apply PMP to it.\
Define new Hamiltonian as follows: $$\hat{h}_{(w,u)}(\nu,\lambda^*)=\langle \lambda^*,f_u\rangle +\nu(\varphi+w)$$

The corresponding Hamiltonian system is $$\left\{
\begin{aligned}
&\frac{\partial \nu}{\partial t}=\frac{\partial \hat h}{\partial y}=0\\
&\frac{\partial y}{\partial t}=\varphi+w\\
&\dot\lambda_t^*=\vec h_{\tilde{u}(t)}(\lambda_t)
\end{aligned}
\right.$$

The first equation stands for $v\equiv constant$.

In terms of this system, Hamiltonian Maximum condition is: $$(\langle \lambda_t^*,f_{\tilde{u}(t)}\rangle+\nu\varphi(\tilde{q}(t),\tilde{u}(t)))=\max_{u\in U,w\geq0} (\langle \lambda_t^*,f_{u(t)}\rangle+\nu\varphi(\tilde{q}(t),u(t)))+\nu w$$ Since the maximum of original system is attained, there must be $\nu\leq 0$, thus we can set $\nu=0$ in the right hand of maximum condition: $$(\langle \lambda_t^*,f_{\tilde{u}(t)}\rangle+\nu\varphi(\tilde{q}(t),\tilde{u}(t)))=\max_{u\in U,w\geq0} (\langle \lambda_t^*,f_{u(t)}\rangle+\nu\varphi(\tilde{q}(t),u(t)))$$ So we prove the following conclusion:

If $u=\tilde u (t)$ is the optimal control for problem (3.9)-(3.11), that is, $\tilde u(t)$ minimizes $J(u)$. Define generalized Hamiltonian family: $h_{u,f}^\nu(\lambda)=\langle \lambda,f_u (\lambda) \rangle+\int_0^{t} e(\tau)f(\tau)+e'(\tau)f'(\tau)d\tau+\nu\varphi(q(t),u(t),e(t)), \lambda\in T^{*}M$£¬then there exists a stochastic Lipschitzian curve $\lambda_t\in T_{\tilde{q}(t)}^* M,t\in [0,t_1]$, and a number $\nu\in \mathbb{R}$ such that\
$$\begin{aligned}
&&\lambda_t\not\equiv0,\\
&&\frac{\partial \lambda}{\partial t}=-\frac{\partial H_u}{\partial q}+A(q)f,\\
&&h\nu_{\tilde{u}(t),\tilde{f}(t)}(\lambda_t)=\max_{u\in U}\{h^\nu_{u(t),\tilde{f}(t)}(\lambda_t)\},\\
&&\nu\leq0,\end{aligned}$$ for almost all $t\in [0,t_1]$

since pair $(\lambda_t^*,\nu)$ can be multiplied by any positive number, only abnormal case $\nu=0$ and normal case $\nu=-1$ need to be considered. Besides, when solving maximum problems, $\nu\leq 0$ becomes $\nu\geq 0$, that is, analogously abnormal cases $\nu=0$ and normal case $\nu=1$.

[**Example**]{}
===============

To demonstrate the method more specifically, we consider its application to classic Cheapest Stop Problem.

The original problem can be described as follows: A train moves on the railway. We start braking the train at certain initial location and speed. The goal is to stop it with minimum expenditure of energy, which is assumed proportional to the integral of squared acceleration.

Its mathematic statements is $$\begin{aligned}
&&\ddot x=u, \\
&&x(0)=x_0\\
&&\dot x(0)=v_0\\
&&t_1 fixed, x(t_1)=x_1, \dot x(0)=0,\end{aligned}$$ find $u=\tilde u$ minimizing $J(u)=\int_0^{t_1}u^2dt$.

Now consider that an auxiliary stopping device is introduced. The device is a slope that can be slowly uplifted at the entrance of station, simultaneously saving energy in gravitational form. The saved energy can be partially reused. Our new goal is to stop the train with minimum expenditure of cost, that is, energy used in stopping plus brake abrasion, minus energy that can be reused. The reuse ratio is defined as $R_u$, while the lifting of slope is measured by a continuous variable $f$. As we can see, with $f$ going up, $\dot x$ and $x$ is affected. The braked abrasion is assumed linear to the integral of output $e$.

Its mathematic statement can be organized as follows: $$\begin{aligned}
&&\left\{
\begin{array}{l}
\dot x_1=x_2\\
\dot x_2=u\\
\end{array}
\right.,x=\left(
\begin{array}{c}
x_1\\
x_2
\end{array}
\right)\in R^2, u\in R\\
&&x(0)=x^{(0)}\\
&&t_1 fixed,\\
&&\dot x=\left(\begin{array}{c}
x_2\\
u
\end{array}\right)+B(x)f\\
&&e_1=A(x)\dot x\\
&&e_2=B(x)\dot x\\
&&\hat J(u)=\int_0^{t_1}u^2+(e_1+e_2)fdt\rightarrow min.\end{aligned}$$ The system has two obvious output $e_1$ and $e_2$, thus be applied with PMP for port-Hamiltonian systems. Its generalized Hamiltonian is $$h_{u,f,t}^\nu(\xi^*,x)=\xi^*_1 x_2+\xi^*_2 u+\nu(u^2+(e_1+e_2)f)+\int_0^t(e_1+e_2)fd\tau, \xi^*=\left(
\begin{array}{c}
\xi_1^*\\
\xi_2^*
\end{array}
\right)\in T_{x(t)}^*R^2,$$ Thus it is embedded in a port-Hamiltonian systems: $$\left\{
\begin{aligned}
&\frac{\partial q}{\partial t}=\frac{\partial H_u}{\partial \xi}+B(q)f\\
&\frac{\partial \xi}{\partial t}=-\frac{\partial H_u}{\partial q}+A(q)f\\
&e=A^{T}(q)\frac{\partial H_u}{\partial p}\\
&e'=B^{T}(q)\frac{\partial H_u}{\partial q}
\end{aligned}
\right.$$ First consider abnormal case $\nu=0$: $$h_u^0(\xi^*,x)=\xi^*_1 x_2+\xi^*_2 u.$$ If maximum of $h_u^0(\xi^*,x)$ exists, there must be $E\xi^*_2\equiv0$. This means $\tilde u \equiv0$, which contradicts nontrivial requirement.\
Then consider the normal case $\nu=-1$: $$h_u^{-1}(\xi^*,x)=\xi^*_1 x_2+\xi^*_2 u-(u^2+(e_1+e_2)f).$$ Thus, $$\left\{
\begin{aligned}
\dot\xi_1^*=\frac{\partial\xi_1^*}{\partial t}=\frac{\partial h_u^{-1}}{\partial x_1}=0\\
\dot\xi_2^*=\frac{\partial\xi_2^*}{\partial t}=\frac{\partial h_u^{-1}}{\partial x_2}=\xi_1^*
\end{aligned}
\right.$$ Due to the Hamiltonian maximum generated by U, $$h_u^{-1}(\xi^*,x)=\xi^*_1 x_2+\xi^*_2 u-(u^2+(e_1+e_2)f).$$ $$\frac{\partial h_u^{-1}}{\partial u}=0$$ Thus we get $$\tilde u(t)=\frac{1}{2}\xi_2^*(t)=\alpha t+\beta.$$

The optimal control shall be linear. We can easily find the optimal control when put the conclusion into origin system. The control system with both control $u$ and input $f$ can be now transformed into a classic optimal problem with only continuous control $f$.

[**Conclusion**]{}
==================

The paper is focused on certain kind of extended control problems and give a feasible solution to the problems with output or input terms. Core idea of the solution is to divide the control systems into two parts and find the optimal control for fixed input/output. The theoretic basis of this method is PMP for port-Hamiltonian Systems which is introduced in the second section. The method, in essence, is a generalization of classic PMP since it’s obvious that the theorem regress to PMP when output/input become zero.

Up to now we can only make use of certain kind of port-Hamiltonian systems, specifically the ones with symplectic structure. It’s yet to be researched how general port-Hamiltonian systems can be connected to control problems. Though port theory, as a new subject, has been perfectly developed during the years, there are still blanks in its connection with classic subjects. Beyond doubt, there is great potential in this subject. Port-Hamiltonian theory stand a good chance to make improvement in not only control theory, but other applied fields.

[99]{} R. Bellman. Introduction to the Mathematical Theory of Control Processes. New York: Academic Press, New York, 1967. M. Bardi, I. Capuzzo-Dolcetta. Optimal Control and Viscosity Solutions of Hamilton-Jacobi-Bellman Equations. Boston: Birkhauser, 1997. Andrei A. Agrachev, Yuri L. Sachkov. Control Theory from the Geometric Viewpoint. Heidelberg: Springer, 2004:167. A.van der Schaft and D.Jeltsem. Port-Hamiltonian Systems Theory: An Introductorty Overview. Foundation and Trends in Systems and Control, vol.1, no.2-3, pp.173-378, 2014. T. R. Bielecki, H. Jin, S. R. Pliska, X. Y. Zhou. Continuous time mean variance portfolio selection with bankruptcy prohibition. Math. Finance, 2005, 15: 213-244. D. Cuoco, J. Cvitanic. Optimal consumption choices for a ¡°large¡± investor. Economic Dynamics and Control, 1998, 22: 401-436. A. Bloch. Nonholonomic Mechanics and Control, Interdisciplinary Applied Mathematics. Heidelberg: Springer, 2003. M. Kawski. Combinatorics of nonlinear controllability and noncommuting flows. ICTP Lecture Notes Series, Mathematical control theory, 2002, 8: 222-311. Augner, Bjorn; Jacob, Birgit Stability and stabilization of infinite-dimensional linear port-Hamiltonian systems. Evol. Equ. Control Theory 3 (2014), no. 2, 207-229. Dirksz, Daniel A. Scherpen, Jacquelien M. A. Steinbuch, Maarten A port-Hamiltonian approach to visual servo control of a pick and place system. Asian J. Control 16 (2014), no. 3, 703-713. Macchelli, Alessandro Dirac structures on Hilbert spaces and boundary control of distributed port-Hamiltonian systems. Systems Control Lett. 68 (2014), 43-50. Seslija, Marko; Scherpen, Jacquelien M. A. van der Schaft, Arjan Explicit simplicial discretization of distributed-parameter port-Hamiltonian systems. Automatica J. IFAC 50 (2014), no.2, 369-377.
