{'fraction_non_alphanumeric': 0.027260586063319978, 'fraction_numerical': 0.0068740670908948075, 'mean_word_length': 4.8459242250287025, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Guided Policy Search using Sequential Convex Programming for Initialization of Trajectory Optimization Algorithms

Nonlinear trajectory optimization algorithms have been developed to handle optimal control problems with nonlinear dynamics and nonconvex constraints in trajectory planning. The performance and computational efficiency of many trajectory optimization methods are sensitive to the initial guess, i.e., the trajectory guess needed by the recursive trajectory optimization algorithm. Motivated by this observation, we tackle the initialization problem for trajectory optimization via policy optimization. To optimize a policy, we propose a guided policy search method that has two key components: i) Trajectory update; ii) Policy update. The trajectory update involves offline solutions of a large number of trajectory optimization problems from different initial states via Sequential Convex Programming (SCP). Here we take a single SCP step to generate the trajectory iterate for each problem. In conjunction with these iterates, we also generate additional trajectories around each iterate via a feedback control law. Then all these trajectories are used by a stochastic gradient descent algorithm to update the neural network policy, i.e., the policy update step. As a result, the trained policy makes it possible to generate trajectory candidates that are close to the optimality and feasibility and that provide excellent initial guesses for the trajectory optimization methods. We validate the proposed method via a real-world 6-degree-of-freedom powered descent guidance problem for a reusable rocket.


I. INTRODUCTION
Trajectory optimization methods have been developed to solve nonconvex trajectory generation problems, e.g., optimal control problems with nonlinear dynamics and nonconvex constraints. Many different algorithms for trajectory optimization have been developed, such as sequential convex programming (SCP) [1], differential dynamics programming (DDP) [2], and Pontryagin's maximum principle (PMP) [3]. With these developed methods, numerous studies have applied trajectory optimization to various applications including control of mobile robots [4], autonomous robotic manipulation [5], and powered descent guidance for spacecraft and reusable rockets [1].
A key input of many trajectory optimization algorithms including SCP and DDP is an initial trajectory guess, which is used to start the iterative process [6]. This initial trajectory guess is observed to impact the number of iterations for the optimization to converge, and hence it can be critical for real-time applications. Thus, designing a reliable and efficient initial trajectory guess can be beneficial for the fast convergence of trajectory optimization. The prior methods for the initial guess, such as a straight-line interpolation, however, are based on engineering heuristics motivated by the user's experiences. For a more systematic method, we propose a policy optimization-based machine learning approach for trajectory optimization initialization. The policy optimization aims to acquire a neural network policy that can give the optimal control action as a function of the state. If we can obtain a proper neural network policy through policy optimization, we can then generate trajectory candidates that serve as excellent initial guesses for the trajectory optimization methods by integrating the system dynamics with control inputs from the optimal policy.
One way to optimize and acquire the policy is to employ model-free reinforcement learning (RL). In recent years, much attention has been drawn to the model-free RL because of its applicability and performance for various complex problems. For example, [7] deployed the actor-critic based policy gradient RL method for a zero-effort-miss/zeroeffort-velocity feedback guidance problem. The proximal policy optimization RL method was used for the satellite rendezvous missions in [8]. One disadvantage of applying model-free RL is sample inefficiency. As model-free RL methods do not utilize the system models, many data samples are required to train a policy. Another disadvantage is that it is still not straightforward to impose the state and input constraints necessary for safety-critical systems like space vehicles and self-driving cars.
Another way to optimize a policy is to use imitation learning [9] in which trajectory optimization methods play a role in giving samples, and the neural net policy is trained to these samples through supervised learning. The PMP method was used by [10] to generate trajectory samples to train a neural network policy via supervised learning. This method was validated on the soft-landing problem with a 3-degreeof-freedom (DoF) rocket. Real-time trajectory generation for asteroid landings was conducted by imitation learning in [11]. The downside of imitation learning is that the errors in supervised learning can be compounded along the trajectory over a time horizon. Then, this accumulated error can result in poor propagated trajectories over a long time horizon especially for higher-dimensional systems.
Motivated by the shortcoming of imitation learning, interactive optimization approaches, also known as guided policy search, have recently been studied in [12], [13]. These methods formulate the entire policy optimization problem as two separated optimizations: one is to obtain solutions from different initial conditions with the trajectory optimization routine, and the other is to train the neural net policy using supervised learning with sample trajectories generated in the previous step. Unlike imitation learning, the trajectory optimization in the first step has an additional constraint that enforces the updated trajectory to be close enough to the trajectory from the policy. Imposing this constraint can help the single neural network policy to reproduce all trajectories with the long-time horizon performance.
In this paper, we propose a guided policy search algorithm that leverages convex optimization. We repeatedly solve two optimization sub-problems: the first step aims to solve a convex approximation of the nonlinear optimal control problem with an additional penalty on control input deviation from the policy. In this step, we formulate the sub-problem as a convex optimization problem, which is motivated by the sub-problem in a penalized trust region (PTR) algorithm which is one of SCP methods. Then, we generate additional samples around the solution of the convex sub-problem using a feedback gain obtained by a time-varying linear quadratic regulator (LQR). The second step is to train the neural net policy using supervised learning with the generated samples. Then, the two optimizations with the sample generation are repeatedly solved until the policy converges. We validate our method on the minimum-fuel powered descent guidance for a reusable rocket. The simulation results show that the policy can generate trajectory candidates which lead to the fast and reliable convergence of the PTR method.

A. Related works
The scheme of the proposed method is related to the previous research in the guided policy search methods, but there are technical differences. The works of [12], [14] utilized the DDP method and [13] worked with Newton's method. On the other hand, we employ a convex approximation of the original nonconvex problem instead of solving the nonconvex optimal control problem in each iteration. There are two advantages of this approach. First, solving the convex approximation instead of solving the nonconvex trajectory optimization problem is more computationally tractable. Since this trajectory optimization is repeated as the first step in each iteration, solving the nonconvex problem is too costly. More importantly, leveraging convex optimization makes it straightforward to impose state and input constraints while most earlier works did not impose the constraints. For instance, the work in [15] imposed the state constraints by using an augmented Lagrangian formulation, but the constraint exists for the training phase, and the final policy does not activate the constraint. The work in the imitation learning [14] considered both inequality and equality constraints, but the inequality constraint are implemented as a penalty via a barrier function, not as a hard constraint.

B. Contributions
We can summarize our main contributions as follows: • The proposed method makes it straightforward to impose state and input constraints in the framework of guided policy search by leveraging convex optimization.
• The trained policy by the proposed method can provide a better initial guess in comparison to the conventional initial guesses used for trajectory optimization. • The proposed approach is validated via minimum-fuel 6-DoF powered descent guidance problem for reusable rockets, which is a real-world aerospace application.

C. Outlines
The rest of this paper is organized as follows: We present the problem formulation and the proposed method in section II. In section III, we describe the details of the 6-DoF powered descent guidance for a reusable rocket. In section IV, we show numerical results with our proposed method. Concluding remarks are provided in V.

A. Problem formulation
In this paper, we consider a deterministic continuous-time policy optimization problem of the following form: where the subscript i indexes each trajectory starting from the initial conditions x i init and ending at the final state x i final . The user-specified parameter N is the number of trajectories and t f is the fixed final time. The vector x(·) ∈ R nx is the state and u(·) ∈ R nu is the control input. The function f : R × R nx × R nu → R nx represents the (nonlinear) system dynamics. The constraints for the optimization are given in (3) and (4). The convex sets X (t) and U(t) are state constraints and input constraint sets, respectively. We define a function s : R × R nx × R nu → R ns to illustrate nonconvex constraints. The function π θ : R nx → R nu represents a policy parameterized by a neural network, and θ is the vector of weights for the neural network. We assume that the input from the policy is piecewise constant between the sampling times as in (7), which is the form of zeroth order hold [16].
The policy optimization aims to optimize the neural net policy that approximately reproduce trajectories produced by trajectory optimization subject to different initial conditions. After optimizing the policy, we can obtain a new trajectory with the trained policy by propagating the following system dynamics

B. Penalized trust region
Before diving into the proposed method, we review the PTR method which is a key component in this research. The PTR method, which is a type of SCP, aims to solve (nonconvex) continuous-time optimal control problems that can be formulated as follows: To solve the above optimization, the PTR iteratively solves a convex sub-problem. Every sub-problem's solution provides a new reference trajectory to the algorithm. After linearizing and discretizing around this reference, the convex sub-problem can be formulated as follows: where (11) is the first-order approximation of the original nonconvex constraint in (4), and A i k , B i k , z i k represent the linearized model of the nonlinear dynamics given in (2) around a reference trajectory denoted byx i k ,ū i k . Besides the original cost J, we have two additional penalties in (8): virtual control and trust region [6]. Virtual control serves to recover from cases where the linearized sub-problem becomes infeasible. Trust regions maintain the optimization in the vicinity of the reference trajectory, where the linearization is most accurate. They can be formulated as follows: where ν i k is the virtual control variable. Then, the PTR algorithm terminates when the following two stopping criteria are satisfied: where ǫ ν and ǫ tr are user-specified tolerance parameters that are typically small numbers. More details about the PTR algorithm can be found in [17], [1].

C. Guided policy search via SCP
The policy optimization given in (1)-(6) is solved in the proposed guided policy search algorithm. To optimize the policy, we repeatedly solve two optimization steps: a trajectory update step and a policy update step. In the trajectory update step, we solve the convex sub-problem that approximates the original nonconvex problem. Next, we generate trajectory samples using the solution of the subproblem and feedback gain matrix that we obtain using a linear time-varying LQR. With the trajectory samples, we train a neural net policy by supervised learning. The trajectory and policy update steps are repeated in sequence until the policy converges. The block diagram for the proposed approach is given in Fig. 1.
The convex sub-problem for the trajectory update step is formulated as follows: The formulation of the sub-problem is similar to that of the PTR given in (8)- (12). The only difference is a penalty term J trp (u) for a trust region in (16).
While the trust region (13) in the PTR is for the difference with the reference trajectory, the new trust region in (16) represents the deviation of the control input from the output of the policy. This trust region with the policy ensures that the solution from the convex sub-problem does not deviate too far from the trajectory made by the policy π θ . After solving the trajectory update step, we can get the updated trajectories as . The next step is to generate sample trajectories using the trajectory resulting from the trajectory update step. In [12], the authors suggested the way of generating samples around the given trajectory using a time-varying feedback gain K(k). By giving additional samples, we can increase the amount of data and make the neural network be more robust to the small perturbation in the trajectory. Following a similar approach, first, we obtain the feedback gain by a linear time-varying LQR solution with the linearized model given in (9). Then, we choose S new initial states x i,s init around the original ones x i init by adding Gaussian noise, and generate S new trajectories with the linearized model. This can be formulated as follows: If the states include quaternions, the noise is added to roll, pitch, and yaw angles that are converted from the quaternions, and then these angles are transformed again into the quaternions.
One of the disadvantages of the above approach is that the linearized trajectory samples might violate the original constraints of the sub-problem. To mitigate this issue, we gradually decrease the magnitude of variance σ 2 i in each iteration to minimize the constraint violation. A promising future direction to handle the constraint violation is to employ funnel synthesis approaches in which the feedback gain is calculated with the consideration of the constraints [18].
Finally, we apply supervised learning with the generated samples to train the policy represented by a neural network in the policy update step. We optimize the objective function given in (18) using stochastic gradient descent (SGD) over state and input pairs in the trajectory samples.
The overall approach is summarized in Algorithm 1: optimize parameters of the policy θ (18) 8: end while The parameters θ of the neural net policy are initialized by the Xavier initialization method proposed in [19]. In the first iteration, the reference trajectory is obtained by the straight-line interpolation [6]. Since having the penalty with the randomly initialized neural net policy in the first iteration can slow down the entire process, the convex subproblem in (15) uses the trust region penalty with the input u from the reference trajectory instead of the input from the policy π θ (x) in (16). Then, the convex sub-problem's solution provides a new reference trajectory for the next iteration, and the trust region penalty with the policy is employed from the second iteration.
The proposed algorithm determines its stopping criteria with validation data. The validation data is the set of trajectories generated from new initial states that are not identical with the states x i init used in the training. After training the policy in every iteration, we evaluate the average cost J of trajectories starting from these new initial states in the validation data. If the difference between the average cost of the current iteration and that of the last iteration is less than a user-specified tolerance ǫ J , the method terminates the process. Note that the trajectories in the validation set are used purely for evaluating the policy performance and not for the learning phase.

III. APPLICATION TO MINIMUM-FUEL POWERED DESCENT GUIDANCE
The method is validated on the problem of powered descent guidance for a reusable rocket. This section outlines the problem formulation. The readers can find more details in [1].

A. Dynamics and kinematics
The system dynamics for a 6-DoF rocket in an X(East)-Y (North)-Z(Up) inertial coordinate frame is given by: where m(·) ∈ R ++ is the mass of the vehicle, αṁ is the proportionality constant, and T B (·) ∈ R 3 is the thrust vector expressed in the body-fixed frame denoted by F B . The position, velocity, and constant gravitational acceleration vector are given by r I (·) ∈ R 3 , v I (·) ∈ R 3 , and g I ∈ R 3 , respectively. The quaternions are represented by q B/I ∈ S 3 to parameterize the attitude of F B relative to a inertial reference frame F I , and C I/B (t) ∈ SO(3) is the direction cosine matrix to show the attitude transformation from F B to F I . The angular velocity vector is denoted by ω B (t) ∈ R 3 , and J B ∈ S 3 is the moment of inertia. The notations given as [ξ×] ∈ R 3×3 and Ω(ξ) ∈ R 4×4 represent skew-symmetric matrices for some ξ ∈ R 3 .

B. State and input constraints
The rocket is subject to the following state constraints: where m dry is the dry mass and ω max is the maximum angular rate. The maximum glide slope angle is γ gs and H 12 is the indicator for first and second elements that is written as where we use e j to illustrate the unit vector for the j-th axis. The maximum tilt angle of the vehicle is θ max , and q 2 and q 3 are second and third components in the quaternion q B/I . The input constraints for the vehicle are given by: where T min and T max are the minimum and maximum thrust, respectively. The maximum gimbal angle is δ max .

C. Boundary conditions
The state values are subject to initial and terminal boundary constraints, given as follows:

D. Problem statement
With the derived constraints, the minimum-fuel optimal control problem for the 6-DoF rocket soft-landing can be formulated as follows:

IV. SIMULATION RESULTS
This section presents numerical results for the powered descent guidance problem. The simulations aim to answer the following questions: The initial mass m, the third component of the velocity, and other states are fixed as 2.0 (U M ), −1.0 (U L /U T ), and zero, respectively. The initial states in the test set follow a uniform random distribution inside the rectangular region defined by the ranges of initial state values used for the training set. We illustrate the initial states and trajectories by the trained policy for the training, validation, and test sets in Fig. 2.
The results in this section use a neural network with three hidden layers and 50 nodes in each layer to represent the policy. Each layer except the last one has the rectified linear unit layer as an activation function. The batch size of the training is 512. Other parameters for the simulation are given in Table I. The proposed approach reaches its stopping criteria at 5 iterations.

A. Comparison to imitation learning
The comparisons between our approach and an imitation learning method in terms of cost, constraints, and boundary condition of the trajectories are given in here. The latter approach decouples the PTR trajectory generation phase from the neural network training. Effectively, a standard PTR method generates complete trajectories from the initial states in the training and validation sets. Around each trajectory generated by the PTR method with the training set, we generate 100 samples by following the same procedure with our approach, which is given in (17). In the proposed method, 20 samples are generated, and the number of iterations is 5, so the number of samples around each trajectory is 100, which is equal to that of the imitation learning method. Subsequently, supervised learning is used to independently train a neural network on the samples. In every epoch in training, we evaluate the policy with the objective given in (18) using the state and input pairs in the trajectories starting The trajectory comparison between the proposed approach and the imitation learning method. The figures in the first column represent the trajectories starting from the initial states in the training set. The trajectories in the second column images and in the third column images start from the initial states in the validation set and the test set, respectively. The first and second rows show the same set of trajectories viewed from different angles. It is visible that the proposed approach generates less infeasible trajectories than the imitation learning method in terms of the boundary condition for the position.
from the initial state in the validation set. Then, the network in the epoch that shows the minimum objective value is selected as the final policy for the imitation learning method. We employ the same network structure used in the proposed approach for a fair comparison. Table II compares the two algorithms in terms of cost, constraints, and boundary conditions. The first row represents the average cost of all trajectories. The average maximum constraint violation of trajectories is given in the second row where c k ∈ R 7 is a normalized constraint violation defined as The function (x) + = max(0, x) is an unit ramp function. The last 4 rows show the average boundary condition violations for the position, velocity, attitude, and angular velocity separately. The quaternions are transformed into the Euler angle θ e , and then the violation of attitude is calculated. The results show that the generated trajectories by our approach are less infeasible in terms of the satisfaction of both constraints and boundary conditions. Even though the imitation learning method has less cost than that of our approach, it is expected that a trajectory that does not respect the problem's constraints will achieve a lower cost. We describe the trajectories generated by both our proposed approach and the imitation learning in Fig. 2. We can see that the proposed approach generates less infeasible trajectories in terms of the position boundary condition than the imitation learning method.

B. Initialization performance
Now we test the initialization performance of the proposed approach by the following manner: First, the policy trained by the proposed approach generates trajectories from the initial conditions in the test set. The PTR method then employs these trajectories as an initial guess for trajectory optimization. We choose the PTR method for trajectory optimization since the PTR method has been successfully used in the powered descent guidance applications [1], [17]. We compare the number of iterations and success rate of our method with that of the conventional initialization method that is the straight-line interpolation [6]. The termination parameters ǫ ν and ǫ tr are 10 −6 and 10 −3 , respectively, in (14). Since the performance of the PTR method depends on the choice of parameters w ν and w tr in (13), the experiments are carried out with 18 different combinations of these parameters for every initial states, then we record the minimum number of iterations. In the combinations of parameters, w ν take a value in {10 3 , 10 4 , 10 5 } and w tr take a value among {10 −2 , 10 −1 , 1, 10, 10 1 , 10 2 , 10 3 }. The maximum number of iterations in the PTR method is set as 50 since successful convergence of the PTR method usually requires no more than 50 iterations [17]. If the number of iterations exceeds this maximum, we consider that the optimization has failed to converge. Table III summarizes the initialization performance results. The proposed approach provides an initial guess with which the PTR method is able to converge for every initial state in the test set, while the straight-line interpolation has 7 failure cases. The table shows the mean, median, and standard deviation of the iteration count only for the successful cases. Our method shows much faster convergence performance than that of the straight-line interpolation.

V. CONCLUSIONS
This paper has studied the problem of generating reliable initial guesses for trajectory optimization methods. SCPbased guided policy search was applied to train the neural network that can generate trajectories with different initial conditions. To train the neural net policy, the proposed approach employed an interactive approach between convex optimization with penalized trust region and supervised learning. Numerical evaluations show that the neural network can generate good trajectory initial guesses from different initial conditions. Using these trajectories as the initial trajectory guesses is beneficial for the fast and reliable convergence of trajectory optimization methods.