{'fraction_non_alphanumeric': 0.041818845872899926, 'fraction_numerical': 0.01139517896274653, 'mean_word_length': 4.672467371037912, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Efficient Iterative Linear-Quadratic Approximations for Nonlinear Multi-Player General-Sum Differential Games

Many problems in robotics involve multiple decision making agents. To operate efficiently in such settings, a robot must reason about the impact of its decisions on the behavior of other agents. Differential games offer an expressive theoretical framework for formulating these types of multi-agent problems. Unfortunately, most numerical solution techniques scale poorly with state dimension and are rarely used in real-time applications. For this reason, it is common to predict the future decisions of other agents and solve the resulting decoupled, i.e., single-agent, optimal control problem. This decoupling neglects the underlying interactive nature of the problem; however, efficient solution techniques do exist for broad classes of optimal control problems. We take inspiration from one such technique, the iterative linear-quadratic regulator (ILQR), which solves repeated approximations with linear dynamics and quadratic costs. Similarly, our proposed algorithm solves repeated linear-quadratic games. We experimentally benchmark our algorithm in several examples with a variety of initial conditions and show that the resulting strategies exhibit complex interactive behavior. Our results indicate that our algorithm converges reliably and runs in real-time. In a three-player, 14-state simulated intersection problem, our algorithm initially converges in<0.25s. Receding horizon invocations converge in<50 ms in a hardware collision-avoidance test.


I. INTRODUCTION
Many problems in robotics require an understanding of how multiple intelligent agents interact. For example, in the intersection depicted in Fig. 1, two cars and a pedestrian wish to reach their respective goals without colliding or leaving their lanes. Successfully navigating the intersection requires either explicit, or perhaps implicit, coordination amongst the agents. Often, these interactions are decoupled, with each autonomous agent predicting the behavior of others and then planning an appropriate response. This decoupling necessitates strong predictive assumptions on how agents' decisions impact one another. Differential game theory provides a principled formalism for expressing these types of multiagent decision making problems without requiring a priori predictive assumptions.
Unfortunately, most classes of differential games have no analytic solution, and many numerical techniques suffer from Fig. 1: Demonstration of the proposed algorithm for a three-player generalsum game modeling an intersection. Two cars (red and green triangles) navigate the intersection while a pedestrian (blue triangle) traverses a crosswalk. Observe how both cars swerve slightly to avoid one another and provide extra clearance to the pedestrian. the so-called "curse of dimensionality" [1]. Numerical dynamic programming solutions for general nonlinear systems have been studied extensively, though primarily in cases with a priori known objectives and constraints which permit offline computation, such as automated aerial refueling [2]. Approaches such as [3,4] which separate offline game analysis from online operation are promising. Still, scenarios with more than two players remain extremely challenging, and the practical restriction of solving games offline prevents them from being widely used in many applications of interest, such as autonomous driving.
To simplify matters, decision making problems for multiple agents are often decoupled (see, e.g., [5][6][7]). For example, the red car in Fig. 1 may wish to simplify its decision problem by predicting the future motion of the other agents and plan reactively. This simplification reduces the differential game to an optimal control problem, for which there often exist efficient solution techniques. However, the decisions of the other agents will depend upon what the red car chooses to do. By ignoring this dependence, the red car is incapable of discovering strategies which exploit the reactions of others, and moreover, trusting in a nominal prediction-e.g., that the pedestrian will get of the way-may lead to unsafe behavior. A differential game formulation of this problem, by contrast, explicitly accounts for the mutual dependence of all agents' decisions.
We propose a novel local algorithm for recovering interactive strategies in a broad class of differential games. These strategies qualitatively resemble local Nash equilibria, though there are subtle differences. By solving the underlying game we account for the fundamental interactive nature of the problem, and by seeking a local solution we avoid the curse of dimensionality which arises when searching for global Nash equilibria. Our algorithm builds upon the iterative linear-quadratic regulator (ILQR) [8], a local method used in smooth optimal control problems [9][10][11]. ILQR repeatedly refines an initial control strategy by efficiently solving approximations with linear dynamics and quadratic costs. Like linear-quadratic (LQ) optimal control problems, LQ games also afford an efficient closed form solution [12]. Our algorithm exploits this analytic solution to solve successive LQ approximations, and thereby finds a local solution to the original game in real-time. For example, our algorithm initially solves the three-player 14-state intersection scenario of Fig. 1 in < 0.25 s, and receding horizon problems converge in < 50 ms in a hardware collision-avoidance test.

A. General-sum games
Initially formulated in [13,14], general-sum differential games generalize zero-sum games to model situations in which players have competing-but not necessarily opposite-objectives. Like zero-sum games, general-sum games are characterized by Hamilton-Jacobi equations [13] in which all players' Hamiltonians are coupled with one other. Both zero-sum and general-sum games, and especially games with many players, are generally difficult to solve numerically. However, efficient methods do exist for solving games with linear dynamics and quadratic costs, e.g. [12,15]. Dockner et al. [16] also characterize classes of games which admit tractable open loop, rather than feedback, solutions.

B. Approximation techniques
While general-sum games may be analyzed by solving coupled Hamilton-Jacobi equations [13], doing so requires both exponential time and computational memory. A number of more tractable approximate solution techniques have been proposed for zero-sum games, many of which require linear system dynamics, e.g. [17][18][19][20], or decomposable dynamics [21]. Approximate dynamic programming techniques such as [22] are not restricted to linear dynamics or zero-sum settings. Still, scalability to online, real-time operation remains a challenge.
Iterative best response algorithms form another class of approximate methods for solving general-sum games. Here, in each iteration every player solves (or approximately solves) the optimal control problem that results from holding other players' strategies fixed. This reduction to a sequence of optimal control problems is attractive; however, it can also be computationally inefficient. Still recent work demonstrates the effectiveness of iterative best response in lane changes [4] and multi-vehicle racing [23].
Another similarly-motivated class of approximations involves changing the information structure of the game. For example, Chen et al. [24] solve a multi-player reach-avoid game by pre-specifying an ordering amongst the players and allowing earlier players to communicate their intended strategies to later players. Zhou et al. [25] and Liu et al. [26] operate in a similar setting, but solve for open-loop conservative strategies.
At each iteration, ILQR simulates the full nonlinear system trajectory, computes a discrete-time linear dynamics approximation and quadratic cost approximation, and solves a LQR subproblem to generate the next control strategy iterate. While structurally similar to ILQR, our approach solves a LQ game at each iteration instead of a LQR problem. This core idea is related to the sequential linear-quadratic method of [29,30], which is restricted to the two-player zero-sum context. In this paper, we show that LQ approximations can be applied in N -player, general-sum games. In addition, we experimentally characterize the quality of solutions in several case studies and demonstrate real-time operation.

III. PROBLEM FORMULATION
We consider a N -player finite horizon general-sum differential game characterized by nonlinear system dynamicṡ where x ∈ R n is the state of the system, and . . , N } is the control input of player i, and u 1:N ≡ (u 1 , u 2 , . . . , u N ). Each player has a cost function J i defined as an integral of running costs g i . J i is understood to depend implicitly upon the state trajectory x(·), which itself depends upon initial state x(0) and control signals u 1:N (·): We shall presume that f is continuous in t and continuously differentiable in {x, u i } uniformly in t. We shall also require g i to be twice differentiable in {x, u i }, ∀t.
Ideally, we would like to find time-varying state feedback control strategies γ * i ∈ Γ i for each player i which constitute a global Nash equilibrium for the game defined by (1) and (2). Here, the strategy space Γ i for player i is the set of measurable functions γ i : [0, T ] × R n → R mi mapping time and state to player i's control input. Note that, in this formulation, player i only observes the state of the system at each time and is unaware of other players' control strategies. With a slight abuse of notation J i (γ 1 ; . . . ; γ N ) ≡ J i γ 1 (·, x(·)), . . . , γ N (·, x(·)) , the global Nash equilibrium is defined as the set of strategies {γ i } for which the following inequalities hold (see, e.g., [12,Chapter 6]): In (3), the inequalities must hold for all Informally, a set of feedback strategies (γ * 1 , . . . , γ * N ) is a global Nash equilibrium if no player has a unilateral incentive to deviate from their current strategy.
Since finding a global Nash equilibrium is generally computationally intractable, recent work in adversarial learning [31] and motion planning [23,32] consider local Nash equilibria instead. Further, [23,32] simplify the information structure of the game and consider open loop, rather than feedback, strategies. Local Nash equilibria are characterized similarly to (3), except that the inequalities may only hold in a local neighborhood within the strategy space [33,Definition 1]. In this paper, we shall seek a related type of equilibrium, which we describe more precisely in Section IV-B. Intuitively, we seek strategies which satisfy the global Nash conditions (3) for the limit of a sequence of local approximations to the game. Our experimental results indicate that it does yield highly interactive strategies in a variety of differential games.

IV. ITERATIVE LINEAR-QUADRATIC GAMES
We approach the N -player general-sum game with dynamics (1) and costs (2) from the perspective of classical LQ games. It is well known that Nash equilibrium strategies for finite-horizon LQ games satisfy coupled Riccati differential equations. These coupled Riccati equations may be derived by substituting linear dynamics and quadratic running costs into the generalized HJ equations [14] and analyzing the first order necessary conditions of optimality for each player [12,Chapter 6]. These coupled differential equations may be solved approximately in discrete-time using dynamic programming [12]. We will leverage the existence and computational efficiency of this discrete-time LQ solution to solve successive approximations to the original nonlinear nonquadratic game.

A. Iterative LQ game algorithm
Our iterative LQ game approach proceeds in stages, as summarized in Algorithm 1. We begin with an initial state x(0) and initial feedback control strategies {γ 0 i } for each player i, and integrate the system forward (line 3 of Algorithm 1) to obtain the current trajectory iterate ξ k ≡ {x(t),û 1:N (t)} t∈[0,T ] . Next (line 4) we obtain a Jacobian linearization of the dynamics f about trajectory ξ k . At each time t ∈ [0, T ] and for arbitrary states x(t) and controls u i (t) we define deviations from this trajectory . Thus equipped, we compute a continuous-time linear system approximation about ξ k : where A(t) is the Jacobian Dxf t,x(t),û 1: We also obtain a quadratic approximation to the running cost g i for each player i (see line 5 of Algorithm 1) is the gradient Dxg i , r ij is Dû j g i , and matrices Q i and R ij are Hessians D 2 xx g i and D 2 ujûj g i , respectively. We neglect mixed partials D 2 ujû k g i and D 2 xûj g i as they rarely appear in cost structures of practical interest, although they could be incorporated if needed.
Thus, we have constructed a finite-horizon continuoustime LQ game, which may be solved via coupled Riccati differential equations [12,34]. This results in a new set of candidate feedback strategies {γ k i } which constitute a feedback (global) Nash equilibrium of the LQ game [12]. In fact, these feedback strategies are affine maps of the form: with gains P k i (t) ∈ R mi×n and affine terms α k i (t) ∈ R mi . However, we find that choosing γ k i =γ k i often causes Algorithm 1 to diverge because the trajectory resulting from {γ i } is far enough from the current trajectory iterate ξ k that the dynamics linearizations (Algorithm 1, line 4) and cost quadraticizations (line 5) no longer hold. As in ILQR [35], to improve convergence, we take only a small step in the "direction" ofγ k i . 1 More precisely, for some choice of step size η ∈ (0, 1], we set which corresponds to line 8 in Algorithm 1. Note that at t = 0, δx(0) = 0 and γ k i 0, x(0) =û i (0) − ηα k i (0). Thus, taking η = 0, we have γ k i t, x(t) =û i (t) (which may be verified recursively). That is, when η = 0 we recover the open-loop controls from the previous iterate, and hence x(t) =x(t). Taking η = 1, we recover the LQ solution in (6). Similar logic implies the following lemma.
Lemma 1: Suppose that trajectory ξ * is a fixed point of Algorithm 1, with η = 0. Then, the converged affine terms {α * i (t)} must all be identically zero for all time.
In ILQR, it is important to perform a line-search over step size η to ensure a sufficient decrease in cost at every iteration, and thereby improve convergence (e.g., [35]). In the context of a noncooperative game, however, line-searching to decrease "cost" does not make sense, as costs {J i } may conflict. For this reason, like other local methods in games (e.g., [23]), our approach is not guaranteed to converge from arbitrary initializations. In practice, however, we find that our algorithm typically converges for a fixed, small step size (e.g. η = 0.01). Heuristically decaying step size with each iteration k or line-searching until ξ k − ξ k−1 is smaller than a threshold are also promising alternatives. Further investigation of line-search methods in games is a rich topic of future research.
Note: Although we have presented our algorithm in continuous-time, in practice, we solve the coupled Riccati equations analytically in discrete-time via dynamic programming. Please refer to [12, Corollary 6.1] for a full derivation. To discretize time at resolution ∆t, we employ Runge-Kutta integration of nonlinear dynamics (1) with a zero-order hold for control input over each time interval ∆t.

B. Characterizing fixed points
Suppose Algorithm 1 converges to a fixed point (γ * 1 , . . . , γ * N ). These strategies are the global Nash equilibrium of a local LQ approximation of the original game about the limiting operating point ξ * . While it is tempting to presume that such fixed points are also local Nash equilibria of the original game, this is not always true because converged strategies are only optimal for a LQ approximation of the game at every time rather than the original game. This approximation neglects higher order coupling effects between each player's running cost g i and other players' inputs u j , j = i. These coupling effects arise in the game setting but not in the optimal control setting, where ILQR converges to local minima.

C. Computational complexity and runtime
The per-iteration computational complexity of our approach is comparable to that of ILQR, and scales modestly with the number of players, N . Specifically, at each iteration, we first linearize system dynamics about ξ k . Presuming that the state dimension n is larger than the control dimension m i for each player, linearization requires computing O(n 2 ) partial derivatives at each time step (which also holds for ILQR). We also quadraticize costs, which requires O(N n 2 ) partial derivatives at each time step (compared to O(n 2 ) for ILQR). Finally, solving the coupled Riccati equations of the resulting LQ game at each time step has complexity O(N 3 n 3 ), which may be verified by inspecting [12, Corollary 6.1] (for ILQR, this complexity is O(n 3 )).
Total algorithmic complexity depends upon the number of iterations, which we currently have no theory to bound. However, empirical results are extremely promising. For the three-player 14-state game described in Section V-B, each iteration takes < 8 ms and the entire game can be solved from a zero initialization (P 0 i (·) = 0, α 0 i (·) = 0) in < 0.25 s. Moreover, receding horizon invocations in a hardware collision-avoidance test can be solved in < 50 ms (Section V-C). All computation times are reported for singlethreaded operation on a 2017 MacBook Pro with a 2.8 GHz Intel Core i7 CPU. For reference, the iterative best response scheme of [32] reports solving a receding horizon two-player zero-sum racing game at 2 Hz, and the method of [30] reportedly takes several minutes to converge for a different two-player zero-sum example. The dynamics and costs in both cases differ from those in Section V (or are not clearly reported); nonetheless, the runtime of our approach compares favorably.

V. EXAMPLES
In this section, we demonstrate our algorithm experimentally in three-player noncooperative settings, both in software simulation and hardware. 2

A. Monte Carlo study
We begin by presenting a Monte Carlo study of the convergence properties of Algorithm 1. As we shall see, the solution to which Algorithm 1 converges depends upon the initial strategy of each player, γ 0 i . For clarity, we study this sensitivity in a game with simplified cost structure so that differences in solution are more easily attributable to coupling between players.
Concretely, we consider a three-player "hallway navigation" game with time horizon 10 s and discretization 0.1 s. Here, three people wish to interchange positions in a narrow hallway while maintaining at least 1 m clearance between one another. We model each player i's motion as: where p i := (p x,i , p y,i ) denotes player i's position, θ i heading angle, v i speed, and input u i := (ω i , a i ) yaw rate and longitudinal acceleration. Concatenating all players' states into a global state vector x := (p x,i , p y,i , θ i , v i ) 3 i=1 , the game has 12 state dimensions and six input dimensions.
We encode this problem with running costs g i (2) expressed as weighted sums of the following: Here, 1{·} is the indicator function, i.e., it takes the value 1 if the given condition holds, and 0 otherwise. d hall and d prox denote threshold distances from hallway center and between players, which we set to 0.75 and 1 m, respectively. The goal cost is active only for the last t goal seconds, and the goal position is given by p goal,i for each player i. Control inputs are penalized quadratically, with R ii a diagonal matrix. The hallway is too narrow for all players to cross simultaneously without incurring a large proximity cost; hence, this proximity cost induces strong coupling between players' strategies.   Fig. 2(E). From each of these initializations, we run Algorithm 1 for 100 iterations and cluster the resulting trajectories by Euclidean distance. As shown in Fig. 2(A1, B1, C1), these clusters correspond to plausible modes of interaction; in each case, one or more players incur slightly higher cost to make room for the others to pass. Beside each of these clusters in Fig. 2(A2, B2, C2), we also report the mean and standard deviation of each player's cost at each solver iteration. As shown in Fig. 2(F), state trajectories converge within an ∞ tolerance of 0.01 in well under 100 iterations.
In these 500 random samples, only 6 did not converge and had to be resampled, and 5 converged to trajectories which were outliers from the clusters depicted in Fig. 2(A-C). These outliers are shown in Fig. 2(D). We observe that, in these 5 cases, the players come within 0.5 m of one another.

B. Three-player intersection
Next, we consider a more complicated game intended to model traffic at an intersection. As shown in Fig. 3, we consider an intersection with two cars and one pedestrian, all of which must cross paths to reach desired goal locations. We use a time horizon of 5 s with discretization of 0.1 s, and Algorithm 1 terminates in under 0.25 s. We model the pedestrian's dynamics as in (8) and each cars i's dynamics as follows: where the state variables are as before (8) except for front wheel angle φ i . L i is the inter-axle distance, and input u i := (ψ i , a i ) is the front wheel angular rate and longitudinal acceleration, respectively. Together, the state of this game is 14-dimensional. The running cost for each player i are specified as weighted sums of (10)- (12), and the following: lane boundary: Here, d lane denotes the lane half-width, and d (p i ) := min p ∈ p − p i measures player i's distance to lane centerline . Speed v i is penalized quadratically away from a fixed reference v ref,i also outside limits v i and v i . Fig. 3 shows a time-lapse of the converged solution identified by Algorithm 1. These strategies exhibit non-trivial coordination among the players as they compete to reach their goals efficiently while sharing responsibility for collisionavoidance. Such competitive behavior would be difficult for any single agent to recover from a decoupled, optimal control formulation. Observe how, between 0 ≤ t ≤ 0.8 s (left), the green car initially seeks the lane center to minimize its cost, but then turns slightly to avoid the pedestrian (blue). Between 0.8 ≤ t ≤ 1.5 s (center), the red car turns right to pass in front of the green car, and then slows and begins to turn left to give the pedestrian time to cross. Finally (right), the red car turns left to give the pedestrian a wide berth.

C. Receding horizon motion planning
Differential games are appropriate in a variety of applications including multi-agent modeling and coordinated planning. Here we present a proof-of-concept for their use in single-agent planning in a dynamic environment. In this setting, a single robot operates amongst multiple other agents whose true objectives are unknown. The robot models these objectives and formulates the interaction as a differential game. Then, crucially, the robot re-solves the differential Fig. 4: Time-lapse of a hardware demonstration of Algorithm 1. We model the interaction of a ground robot (blue triangle) and two humans (purple and red triangles) using a differential game in which each agent wishes to reach a goal location while maintaining sufficient distance from other agents. Our algorithm solves receding horizon instantiations of this game in real-time, and successfully plans and executes interactive collision-avoiding maneuvers. Planned (and predicted) trajectories are shown in blue (robot), purple, and red (humans). game along a receding time horizon to account for possible deviations between the other agents' decisions and those which result from the game solution.
We implement Algorithm 1 in C++ 3 within the Robot Operating System (ROS) framework, and evaluate it in a real-time hardware test onboard a TurtleBot 2 ground robot, in a motion capture room with two human participants. The TurtleBot wishes to cross the room while maintaining > 1 m clearance to the humans, and it models the humans likewise. We model the TurtleBot dynamics as (8) and humans likewise but with constant speed v i , i.e.: We use a similar cost structure as in Section V-B, and initialize Algorithm 1 with all agents' strategies identically zero (i.e., P 0 i (·), α 0 i (·) ≡ 0). We re-solve the game in a 10 s receding horizon with time discretization of 0.1 s, and warmstart each successive receding horizon invocation with the previous solution. Replanning every 0.25 s, Algorithm 1 reliably converges in under 50 ms. We gather state information for all agents using a motion capture system. Fig. 4 shows a time-lapse of a typical interaction.
Initially, in frame (a) Algorithm 1 identifies a set of strategies which steer each agent to their respective goals while maintaining a large separation. Of course, the human participants do not actually follow these precise trajectories; hence later receding horizon invocations converge to slightly different strategies. In fact, between frames (c) and (d) the red participant makes an unanticipated sharp right-hand turn, which forces the (blue) robot to stay to the right of its previous plan and then turn left in order to maintain sufficient separation between itself and both humans. We note that our assumed cost structure models all agents as wishing to avoid collision. Thus, the resulting strategies may be less conservative than those that would arise from a non-gametheoretic motion planning approach. 3 Code available at: github.com/HJReachability/ilqgames

VI. DISCUSSION
We have presented a novel algorithm for finding local solutions in multi-player general-sum differential games. Our approach is closely related to the iterative linear-quadratic regulator (ILQR) [8], and offers a straightforward way for optimal control practitioners to directly account for multiagent interactions via differential games. We performed a Monte Carlo study which demonstrated the reliability of our algorithm and its ability to identify complex interactive strategies for multiple agents. These solutions display the competitive behavior associated with local Nash equilibria, although there are subtle differences. We also showcased our method in a three-player 14-dimensional traffic example, and tested it in real-time operation in a hardware robot navigation scenario, following a receding time horizon.
There are several other approaches to identifying local solutions in differential games, such as iterative best response [23]. We have shown the computational efficiency of our approach. However, quantitatively comparing the solutions identified by different algorithms is challenging due to differences in equilibrium concept, information structure (feedback vs. open loop), and implementation details. Furthermore, in arbitrary general-sum games, different players may prefer different equilibria. Studying the qualitative differences in these equilibria is an important direction of future research.
Although our experiments show that our algorithm converges reliably, we have no a priori theoretical guarantee of convergence from arbitrary initializations. Future work will seek a theoretical explanation of this empirical property.