<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>A Neural Network Approach Applied to Multi-Agent Optimal Control</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2021</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10232667</idno>
					<idno type="doi"></idno>
					<title level='j'>European Control Conference</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>D Onken</author><author>L Nurbekyan</author><author>Xingjian Li</author><author>S Wu Fung</author><author>S Osher</author><author>L Ruthotto</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[We propose a neural network approach for solving high-dimensional optimal control problems. In particular, we focus on multi-agent control problems with obstacle and collision avoidance. These problems immediately become high-dimensional, even for moderate phase-space dimensions per agent. Our approach fuses the Pontryagin Maximum Principle and Hamilton-Jacobi-Bellman (HJB) approaches and parameterizes the value function with a neural network. Our approach yields controls in a feedback form for quick calculation and robustness to moderate disturbances to the system. We train our model using the objective function and optimality conditions of the control problem. Therefore, our training algorithm neither involves a data generation phase nor solutions from another algorithm. Our model uses empirically effective HJB penalizers for efficient training. By training on a distribution of initial states, we ensure the controls' optimality is achieved on a large portion of the state-space. Our approach is grid-free and scales efficiently to dimensions where grids become impractical or infeasible. We demonstrate our approach's effectiveness on a 150-dimensional multi-agent problem with obstacles.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>Optimal control (OC) problems are ubiquitous in pure and applied mathematics, physics, computer science, engineering, finance, and elsewhere <ref type="bibr">[1]</ref>, <ref type="bibr">[2]</ref>, <ref type="bibr">[3]</ref>. Thus, theoretical and numerical analyses of OC problems have paramount importance across disciplines. We focus on developing numerical solution methods for general high-dimensional OC problems.</p><p>Two of the most common strategies to solve OC problems are Pontryagin's Maximum Principle (PMP) <ref type="bibr">[4]</ref> and the Hamilton-Jacobi-Bellman (HJB) PDE <ref type="bibr">[5]</ref> (Sec. II).</p><p>PMP is a local solution method because optimal controls correspond to fixed initial states. Necessary conditions render an ODE system for the state and adjoint variables and a maximum principle relating the adjoint variable with the optimal control. This approach is grid-free and thus suitable for highdimensional problems. However, the aforementioned ODE system is often challenging to solve due to its forwardbackward structure <ref type="bibr">[6]</ref>, <ref type="bibr">[7]</ref>. Additionally, the OC problem's non-convexity renders the possibility of multiple non-optimal solutions, and additional considerations are necessary, such as the differentiability of the value function <ref type="bibr">[3,</ref><ref type="bibr">Theorem 7.3.9]</ref>. Unfortunately, these conditions are virtually impossible to enforce or verify numerically. The effects of nonconvexity are especially pronounced in multi-agent collisionavoidance problems [8, I.A]. For OC problems that are convex, high-dimensional solvers can be devised via primaldual convex optimization methods <ref type="bibr">[9]</ref>, <ref type="bibr">[10]</ref>, <ref type="bibr">[11]</ref>, <ref type="bibr">[12]</ref>.</p><p>Because PMP is a local solution method, shocks or sudden changes in the system's initial conditions lead to a new optimization problem. PMP is unattractive for real-time applications because the control-search time is vital.</p><p>Alternatively, the HJB approach aims at solving the OC problem for all initial states at once. More precisely, the value function-also known as the optimal cost-to-go-of an OC problem is a solution of a suitable HJB PDE. After computing the value function, we can recover the optimal control at any state from the value function's gradient. Such controls are said to be in feedback form and are especially useful for real-time applications if calculation-times for the feedback form are short.</p><p>Although effective, HJB equations are challenging to solve numerically, especially when the state's dimension d &#8805; 4. First, in a deterministic setup, HJB is a first-order non-linear equation and generally does not admit smooth solutions. Second, traditional numerical methods for HJB equations, such as ENO/WENO <ref type="bibr">[13]</ref>, rely on grids and therefore suffer from the curse of dimensionality <ref type="bibr">[5]</ref>.</p><p>We propose a machine learning framework to overcome the curse of dimensionality by approximating the value function with a neural network (NN). Our approach is a fusion of PMP and HJB. Combining the PMP and HJB approaches, we express the control cost in terms of the value function and search for an NN approximation that minimizes this cost on a cloud of initial states. Furthermore, we improve the NN training by adding HJB residual penalties (Fig. <ref type="figure">1</ref>), similar to <ref type="bibr">[14]</ref>, [15], <ref type="bibr">[16]</ref>.</p><p>Our approach has several advantages. First, it applies to generic OC problems. Second, we find controls in a feedback form that is crucial for real-time applications. Training the NN on a cloud of initial states ensures the controls' optimality on a large portion of the state-space. Consequently, controls are robust to moderate disturbances or shocks to the system (Fig. <ref type="figure">2</ref>). Third, our method is gridfree and suitable for high-dimensional problems. Finally, our approach incorporates machine learning techniques for solving large scale optimization problems. As a result, we are able to solve 150-dimensional OC problems (Sec. V-D).</p><p>Applications of deep learning techniques to OC problems appear in seminal works <ref type="bibr">[17]</ref>, <ref type="bibr">[18]</ref>, <ref type="bibr">[19]</ref>, where the authors apply backward stochastic differential equations techniques to solve high-dimensional stochastic OC problems. In <ref type="bibr">[20]</ref>, the authors extend these methods by introducing and analyzing different loss functions. These works consider stochastic problems with fixed initial states. We focus on finding solutions to deterministic problems that are robust to shocks.</p><p>In <ref type="bibr">[21]</ref>, the authors first generate optimal controls for a sample of initial states then train an NN to fit this data. The data generation phase is performed by a different algorithm <ref type="bibr">[7]</ref>. A similar approach exists in <ref type="bibr">[8]</ref> with a different data generation algorithm <ref type="bibr">[22]</ref>. In contrast, our approach directly minimizes the cost function without a generation phase.</p><p>Our work is based on the same framework as <ref type="bibr">[23]</ref>, which approximates the feedback control with an NN then optimizes the control cost on a cloud of initial states and provides a theoretical analysis of OC solutions via NN approximations. We extend the framework to finite horizon problems with non-quadratic costs and parameterize the value function instead of the feedback function. This latter approach enables enforcing HJB conditions, which empirically improves numerical performance for solving high-dimensional meanfield games, mean-field control, and normalizing flows <ref type="bibr">[14]</ref>,</p><p>[15], <ref type="bibr">[16]</ref>. We demonstrate similar advantages in the OC problems considered in this work.</p><p>We consider deterministic OC problems with a particular emphasis on centrally controlled multi-agent systems. For n agents in an q-dimensional space we obtain a d = n &#8226; qdimensional OC problem. Thus, even moderate n, q yield problems that are out of reach for traditional HJB solvers.</p><p>We demonstrate the effectiveness of our method by solving a 50-agent control problem in a 3-dimensional space with obstacle and collision avoidance (Fig. <ref type="figure">3</ref>). The overall dimension of this problem is d=150. Additionally, we demonstrate our model's robustness to shocks and the effect of the penalizers on a 4-dimensional corridor problem.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>II. PRELIMINARIES</head><p>Here, we briefly recall relevant OC theory. We refer to [1, Chapters I, II] for a detailed exposition. We are interested in deterministic fixed finite time-horizon problems. Consider the time-horizon [0, T ] and the system's dynamics given by</p><p>Here, z &#8712; R d describes the state of the system, and</p><p>to the application of a control u : [t, T ] &#8594; U for initial time t &#8712; [0, T ] and initial state x. We assume that f, L, G, U are sufficiently regular (see [1, Sec. I.3, I.8-9] for a list of assumptions). Next, assume that the control u yields cost</p><p>where L : [0, T ] &#215; R d &#215; U &#8594; R is the running cost or the Lagrangian, and G : R d &#8594; R is the terminal cost. OC problems seek the control that incurs the minimal cost; i.e.,</p><p>where &#934; is called the value function. A solution u * of (3) is called an optimal control. Accordingly, the z * which corresponds to u * is called an optimal trajectory. Next, the Hamiltonian of the system is given by</p><p>where p is the adjoint state. The following is a standing assumption throughout the paper.</p><p>Standing Assumption 1: Assume that (4) admits a unique continuous closed-form solution u * (t, x, p). Under this assumption and denoting &#8711; as the gradient with respect to the state variables only, one has that</p><p>The PMP <ref type="bibr">[4]</ref> states that for a solution (z * , u * ) of (3) there exist p :</p><p>The HJB PDE, also known as the dynamic programming equation, corresponding to ( <ref type="formula">3</ref>) is given by</p><p>The cornerstone of the HJB approach is that the value function &#934; is the unique viscosity solution of <ref type="bibr">(7)</ref>. Moreover, p in ( <ref type="formula">6</ref>) and &#934; are related by</p><p>Thus, the optimal control u * is given in a feedback form</p><p>and z * evolves according to</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>III. MACHINE LEARNING APPROACH</head><p>We derive a machine learning formulation of (3) by leveraging the advantages of both the PMP and the HJB approaches. In particular, we directly optimize (2) subject to <ref type="bibr">(1)</ref>. Rather than solving for the controls, we first postulate the dependence of (z, u) on &#934; according to ( <ref type="formula">9</ref>), <ref type="bibr">(10)</ref> and parameterize &#934; by an NN. We also add penalizers that punish deviations from <ref type="bibr">(7)</ref>, similar to <ref type="bibr">[14]</ref>, <ref type="bibr">[16]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Main formulation</head><p>Denote the control variable corresponding to initial position x &#8712; R d at time t=0 by u x : [0, T ] &#8594; U . And denote the trajectory corresponding to initial data (0, x) by z x ; i.e.,</p><p>Furthermore, fix a &#961; 0 &#8712; P(R d ) and consider the problem <ref type="bibr">(11)</ref> Note that {u *</p><p>x } solves <ref type="bibr">(11)</ref> if and only if u *</p><p>x is an optimal control for &#961; 0 almost everywhere x &#8712; R d . Thus, solving (3) with initial points x in some domain &#8486; is equivalent to solving <ref type="bibr">(11)</ref> for &#961; 0 &#8712; P(R d ) such that supp(&#961; 0 )=&#8486;. Formulation <ref type="bibr">(11)</ref> is employed in mean-field game and control systems <ref type="bibr">[14]</ref>, <ref type="bibr">[15]</ref> and in stabilization problems <ref type="bibr">[23]</ref>.</p><p>Postulating ( <ref type="formula">9</ref>), <ref type="bibr">(10)</ref>, we arrive at our main formulation</p><p>In each OC problem, we set up and solve <ref type="bibr">(12)</ref>, where f , L, and thus H vary with the problem. The L contains terms that reflect the features of the problem (Sec. III-D).</p><p>We approximate &#934;(&#8226;) by an NN, &#934;(&#8226;; &#952;) (Sec. IV), and turn (12) into a finite-dimensional optimization over the weights &#952;. For brevity, we often omit &#934;'s explicit dependence on &#952;.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Adding HJB penalizers</head><p>We introduce three penalty terms c HJt,x , c HJfin,x , and c HJgrad,x derived from the HJB PDE <ref type="bibr">(7)</ref> as follows:</p><p>The HJ t penalizer arises from the first equation in <ref type="bibr">(7)</ref>, whereas HJ fin and HJ grad are direct results of the finaltime condition in <ref type="bibr">(7)</ref> and its gradient, respectively. Penalizers prove helpful in training NNs for solving problems similar to <ref type="bibr">(12)</ref>  <ref type="bibr">[14]</ref>, [15], <ref type="bibr">[16]</ref>, <ref type="bibr">[24]</ref>. They improve the training convergence (Sec. III-C) without altering the solution of <ref type="bibr">(12)</ref>.</p><p>Adding c HJt,x , c HJfin,x , c HJgrad,x to <ref type="bibr">(12)</ref> and rewriting the time-integral in terms of ODE constraints, we obtain</p><p>subject to</p><p>initialized with z x (0) = x and x (0) = c HJt,x (0) = 0, and</p><p>We note that reformulating the Lagrangian L x (s) uses <ref type="bibr">(5)</ref>.</p><p>The objective function thus contains the accumulated running cost x (T ), the HJB penalty along the trajectories c HJt,x (T ), the final-time HJB penalty c HJfin,x , and </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. The effect of the HJB penalizers</head><p>We experimentally assess the effectiveness of the penalizers c HJt , c HJfin , c HJgrad . To this end, we define six models (various combinations of the three HJB penalizers and one with weight decay) and train each on the corridor problem (Sec. V-B). Using the HJB penalizers results in the quicker model convergence on a hold-out validation set (Fig. <ref type="figure">1</ref>).</p><p>HJ t : We enforce the PDE (7) describing the time derivative of &#934; along the trajectories. Including this penalizer improves regularity and reduces the necessary number of time steps when solving the dynamics <ref type="bibr">[14]</ref>, [15], <ref type="bibr">[16]</ref>, <ref type="bibr">[25]</ref>.</p><p>HJ fin : We enforce the final-time condition of the PDE <ref type="bibr">(7)</ref>. The inclusion of this penalizer helps the network achieve the target <ref type="bibr">[14]</ref>. Experimentally, using HJ fin correlates with a slightly lower G value (Fig. <ref type="figure">1</ref>).</p><p>HJ grad :</p><p>We enforce the tranversality condition &#8711;&#934;(T, z(T ))=&#8711;G(z(T )), &#8704;z, a consequence of the final-time HJB condition <ref type="bibr">(7)</ref>. Numerically, all conditions are enforced on a finite sample set. Therefore, higher-order regularization may help the generalization; i.e., achieving a better match of &#934;(T, &#8226;) and G for samples not used during training (the hold-out validation set). We observe the latter experimentally; using HJ grad instead of HJ fin results in lower G (Fig. <ref type="figure">1</ref>). <ref type="bibr">[21]</ref> similarly enforces &#8711;&#934; values.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Lagrangian for Obstacle and Collision Avoidance</head><p>For multi-agent problems, the Lagrangian consists of three terms: an energy term E : U &#8594; R penalizing how much the agents travel, an obstacle term Q : R d &#8594; R penalizing agents at certain spatial locations (i.e., a terrain function), and an interaction term W : R d &#8594; R penalizing the proximity among agents (i.e, collision avoidance).</p><p>The n agents have initial states x 1 , . . . , x n &#8712; R q . For initial joint-state x = (x 1 , . . . , x n ) &#8712; R d with d = q &#8226; n, we represent the joint-state z x &#8712; R d at time t as</p><p>where z xi &#8712; R q is the ith agent's state. The control follows</p><p>As a result, we define the Lagrangian as</p><p>where we omit the dependence on t for brevity. The scalars &#945; 2 , &#945; 3 calibrate the magnitude (relative to E) of the penalization of the obstacle and interactions, respectively.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IV. IMPLEMENTATION</head><p>We parameterize the value function as</p><p>The inputs s=(x, t) &#8712; R d+1 correspond to space-time, N (s; &#952; N ) : R d+1 &#8594;R m is an NN, and &#952; contains trainable weights: In our experiments, for N , we use a simple two-layer residual neural network (ResNet) <ref type="bibr">[26]</ref> </p><p>for</p><p>We use the element-wise nonlinearity &#963;(x)= log(exp(x) + exp(-x)), the antiderivative of hyperbolic tangent, i.e., &#963; (x)= tanh(x) <ref type="bibr">[14]</ref>, <ref type="bibr">[16]</ref>.</p><p>We solve the ODE-constrained optimization problem ( <ref type="formula">14</ref>) using the discretize-then-optimize approach <ref type="bibr">[27]</ref>, <ref type="bibr">[28]</ref>, where we define a discretization of the ODE, then optimize on that discretization. The model's forward pass uses a Runge-Kutta 4 integrator with n t time steps to approximate the constraints (15). The objective function is then computed, and automatic differentiation <ref type="bibr">[29]</ref> calculates the gradient of the objective function with respect to &#952;. We use ADAM <ref type="bibr">[30]</ref>, a gradient-based stochastic method with momentum, to update the parameters &#952;. We iterate this process a selected number of times. For the learning rate (step size) provided to ADAM, we follow a piece-wise constant decay schedule, e.g., we divide the rate by 10 every 800 iterations (Fig. <ref type="figure">1</ref>).</p><p>The number of time steps n t is selected a priori as a model hyperparameter. Large n t leads to high computation and training time while reducing error; meanwhile, too small n t leads to overfitting to a refinement of the time discretization of the trajectories. To avoid overfitting, we use more time steps for the hold-out validation set. For the corridor problem (Sec. V-B), we use n t =20 for training and n t =50 for validation (Fig. <ref type="figure">2a</ref>). For the swarm problem (Sec. V-D), we use n t =26 for training and n t =80 for validation (Fig. <ref type="figure">3</ref>). Training on a single NVIDIA Quadro RTX 8000 GPU requires about ten minutes for the corridor problem (d=4) and less than one hour for the swarm problem (d=150).</p><p>Other hyperparameters include the width of the ResNet m and the multipliers &#946; 1 , &#946; 2 , &#946; 3 . In contrast, some multipliers are inherent to the OC problem-e.g., &#945; 1 , &#945; 2 , &#945; 3and are used for both the baseline and NN. Our Python implementation with all tuned hyperparameters is available at <ref type="url">https://github.com/donken/NeuralOC</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. NUMERICAL EXPERIMENTS</head><p>We present a comparable baseline approach and solve two multi-agent OC problems of dimensions 4 and 150.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Baseline: Discrete Optimization for a Single Initial State</head><p>We provide a comparable local solution method that solves the OC problem for a fixed initial state z (0) = x 0 . Applying forward Euler to the state equation and a midpoint rule to the integrals, we obtain the discrete optimization problem</p><p>where h=T /n t . We use T =1 and n t =50 and solve (21) using standard nonlinear programming techniques.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Corridor Problem</head><p>We design a four-dimensional problem in which two agents attempt to reach fixed targets on the other side of two hills. Suppose the agents with radius r=0.5 start at</p><p>. Thus, the initial and target joint-states are x 0 =[-2, -2, 2, -2] and y=[2, 2, -2, 2] , respectively. We sample from &#961; 0 , which is a Gaussian centered at x 0 with an identity covariance. These sampled initial positions form the training set X. We sample again to create the validation set.</p><p>The obstacles are defined by the spatio-temporal cost function Q i , which we define in this experiment as the sum of four Gaussians. The energy terms are given by</p><p>and the dynamics are given by f (t, x, u) = u; the controls are the velocities. We model interactions via</p><p>for agents with radius r. For terminal costs, we choose     We select multipliers &#945; 1 =100, &#945; 2 =10, 000, and &#945; 3 =300.</p><p>The baseline and the NN solve the problem with comparable trajectories (Fig. <ref type="figure">2a</ref>) and accuracy (Table <ref type="table">I</ref>). The NN achieves a marginally worse value but slightly better G value (Table <ref type="table">I</ref>). We attribute the G improvement to the finaltime HJB penalizers (Fig. <ref type="figure">1</ref>).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Shocks</head><p>We observe that approximating the value function leads to a shock-robust model. Since the controls are in the feedback form &#8706; s z = -&#8711; p H(s, z, &#8711;&#934;(s, z)), the model can quickly calculate updated trajectories despite shocks to the system. As an example, we consider a shock &#958; &#8712; R d (implemented as a random shift) to the system at time t=0.1 when solving the corridor problem for t &#8712; [0, T ] (Fig. <ref type="figure">2</ref>).</p><p>Our method is designed to handle minor shocks that stay within the space of trajectories of the initial cloud about x 0 . Our model computes a trajectory to y for many initial points. Therefore, for point x &#8712; X, the model provides dynamics f (t, z x (t), u x (t)) before the shock. After the shock, the state picks up and follows the trajectory of some other point x &#8712; X (Fig. <ref type="figure">2b</ref>). Thus, the total trajectory has two portions</p><p>before and after the shock, respectively. A minor shock can thus be categorized as switching from one trajectory to another. (Fig. <ref type="figure">2b</ref>). The NN and baseline results of the control problem along t=[0.1, 1] are similar (Table <ref type="table">I</ref>).</p><p>Interestingly, our model extends outside the training region (Fig. <ref type="figure">2c</ref>). Although the vast majority of NNs cannot extrapolate, our NN still solves the control problem after a major shock, demonstrating some extrapolation capabilities. We note that the NN solves the original problem for x 0 to near optimality. However, after such a large shock, the NN solves the control problem, but sub-optimally. In our example, we compare the NN's solution (Fig. <ref type="figure">2c</ref>) with the baseline's solution for t=[0.1, 1] (Fig. <ref type="figure">2d</ref>). The NN learned a solution where agent 2 passes through the corridor before agent 1. After the major shock, the NN applies these dynamics (Fig. <ref type="figure">2c</ref>), while the baseline finds a more optimal solution (Fig. <ref type="figure">2d</ref>). The NN is roughly 100% suboptimal (Table <ref type="table">I</ref>).</p><p>We attribute the shock robustness to the NN parameterization of the global value function. Experimentally, the shock robustness of our model (Fig. <ref type="figure">2</ref>) does not noticeably differ from a model trained without penalization. Since the NN is trained prior and offline, it handles shocks in real-time. In contrast, methods that solve for a single trajectory-e.g., the baseline-must pause to recompute following a shock.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Swarm Trajectory Planning</head><p>We demonstrate the high-dimensional capabilities of our model by solving a swarm trajectory planning problem in the spirit of <ref type="bibr">[22]</ref>. The swarm problem contains 50 threedimensional agents that fly from initial to target positions while avoiding each other and obstacles. We construct Q i to model rectangular prism obstacles and use <ref type="bibr">(22)</ref>, <ref type="bibr">(23)</ref>, and (24) for energy, interaction, and terminal costs. The NN guides all agents around the obstacles (Fig. <ref type="figure">3</ref>). Naturally, if the time discretization is too coarse (small n t ), the model may simulate collisions solely due to inaccurate integration. In validation, we see that the agents avoid the obstacles and each other by observing values for Q and W are exactly 0.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VI. CONCLUSION AND OUTLOOK</head><p>We formulate and demonstrate an efficient NN approach for solving high-dimensional OC problems. Our method aims at computing the optimal control in feedback form in the relevant subset of the space-time domain. It combines the high-dimensional scalability from PMP and the global nature from HJB approaches. Using a numerical example, we demonstrate that the obtained feedback form generalizes outside the training space, which allows the agents to react to unforeseen events such as shocks. Our future endeavors relate to further experimentation of our method on OC problems with more involved dynamics and blending our method (trained prior) with distributed approaches in deployment.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>ACKNOWLEDGMENT</head><p>We thank Reza Karimi for assisting with figure creation.</p></div></body>
		</text>
</TEI>
