<<

IT 18 010 Examensarbete 30 hp Augusti 2018

High-Thrust Interplanetary Spacecraft Trajectory Optimization Using Cuda

Viktor Wase

Institutionen för informationsteknologi Department of Information Technology

Abstract High-Thrust Interplanetary Spacecraft Trajectory Optimization Using Cuda Viktor Wase

Teknisk- naturvetenskaplig fakultet UTH-enheten Global optimization applied to the design of high-thrust interplanetary space trajectories is a computationally expensive task. This thesis investigates the feasibility Besöksadress: of combining the Multiple Assist model of spacecraft trajectory with periodic Ångströmlaboratoriet Lägerhyddsvägen 1 Lyapunov . The trajectories are designed by optimization, enabled by the Hus 4, Plan 0 computational power of a high-end graphics processing unit.

Postadress: Box 536 751 21 Uppsala

Telefon: 018 – 471 30 03

Telefax: 018 – 471 30 00

Hemsida: http://www.teknat.uu.se/student

Handledare: Nils Höglund Ämnesgranskare: Stefanos Kaxiras Examinator: Jarmo Rantakokko IT 18 010 Tryckt av: Reprocentralen ITC

Contents

1 Introduction 3 1.1 PaperOverview...... 3 1.2 PaperStructure...... 3

2 Background 3 2.1 GenerativeDesign ...... 3 2.2 Parallelization ...... 4 2.2.1 SIMD ...... 5 2.2.2 CPUvsGPU...... 5 2.2.3 CUDA ...... 5

3 Models of Celestial Dynamics 5 3.1 2-BodyProblem ...... 6 3.1.1 Lambert’s Problem ...... 6 3.1.2 MultipleGravityAssistModel ...... 7 3.1.3 Radius of ...... 9 3.2 Restricted3-BodyProblem ...... 10 3.2.1 Planar Circular Restricted 3-body Problem ...... 10 3.2.2 Points ...... 10 3.2.3 Periodic Lyapunov Orbits ...... 12 3.2.4 Generation of Periodic Lyapunov Orbits ...... 12

4 Purpose and Scope 12

5 Algorithms 13 5.1 Integrators ...... 13 5.1.1 Adaptive time-step Runge-Kutta ...... 13 5.2 Optimizers ...... 14 5.2.1 Particle Swarm Optimization ...... 14 5.2.2 Self-Adaptive Di↵erential Evolution ...... 15 5.2.3 Ant Colony Optimization ...... 15 5.3 RootFinders ...... 17 5.3.1 Newton-Raphson ...... 17 5.3.2 Halley’s Method ...... 17 5.3.3 Ad Hoc Root Finder ...... 18

6 First Attempt 19

7 Details of Implementations 20 7.1 Planetary Positions ...... 20 7.2 Discrete-Continous Optimization ...... 20 7.3 ObjectiveFunction ...... 21 7.4 Implementation of Periodic Lyapunov Generation . . . . . 22 7.4.1 Theory of Optimization ...... 22 7.4.2 Troubleshooting Lyapunov Orbits ...... 23 7.4.3 Implementation ...... 23 7.5 Approximations and Reliability of Results ...... 24

1 8 Experiments 24 8.1 Hardware Setup ...... 24 8.2 Compiler and Flags ...... 24 8.3 Root Finders for Calculation of Closest Approach ...... 25 8.4 PeriodicLyapunovOrbits ...... 25 8.5 Massively Parallel Multiple Gravity Assists ...... 25 8.5.1 Continuous optimization only ...... 25 8.5.2 Discrete/continuous Optimization ...... 26 8.6 Conical Arcs And Lyapunov Orbits Combined ...... 26

9 Results 27 9.1 Root Finders for Calculation of Closest Approach ...... 27 9.2 PeriodicLyapunovOrbits ...... 27 9.3 Massively Parallel Multiple Gravity Assists ...... 27 9.3.1 Continuous optimization ...... 27 9.3.2 Discrete and Continuous Optimization ...... 27 9.4 Conical Arcs And Lyapunov Orbits Combined ...... 27

10 Analysis 32 10.1RootFinders ...... 32 10.2 Periodic Lyapunov Orbits ...... 32 10.3 Massively Parallel Multiple Gravity Assists ...... 32 10.3.1 Continuous optimization ...... 32 10.3.2 Discrete and Continuous Optimization ...... 32 10.4 Conical Arcs And Lyapunov Orbits Combined ...... 32 10.5 Conclusions ...... 32

11 Further Research 33

2 1 Introduction

Humans have been sending space probes into the far reaches of space since the early 60’s with programs such as USA’s Pioneer Program and Soviet’s Sputnik Program and Venera Program. Most notable however is perhaps the Voyager Program from the late 70’s, in which two robotic probes were sent in a trajec- tory that visited most of the outer planets. As of this writing Voyager 1 remains the only human made object to leave our [22], although its twin is expected to enter interstellar space soon as well.

While the physical reach of humans has yet to extend beyond the ’s our robotic probes have gone to a wide variety of celestial objects, each with a di↵erent set of challenges and each providing a di↵erent set of scientific insights; from the complex organic compounds found by Rosetta [5] to the hexagonal shaped storm on ’s north pole [11] to the fact that Pluto is still geolog- ically active [36]. None of these discoveries, or the theories they inspire, would have been possible without the work of the countless men and women designing the complex trajectories of the space probes.

1.1 Paper Overview This study describes the software C.A.S.S.A.N.D.R.A, an acronym for Chaos Assisted Sling Shots And Non-linear Dynamical gRavity Assists. The goal of Cassandra is to automatically generate trajectories that would allow laymen (or at least non-experts in spacecraft trajectory design) to test out the feasibility of high-thrust low-fuel space missions. This is achieved using the power of mas- sively parallel graphics cards.

A high-thrust trajectory simply refers a path through space that can be achieved using a finite number of short (on the timescale of seconds) bursts of the engine.

1.2 Paper Structure This paper has the following structure: section 2 gives a background on design by optimization, a.k.a. Generative Design as well as a primer on parallelization. Section 3 describes di↵erent mathematical models of celestial motion and their advantages and drawbacks. This is of vital importance since part of the novelty of this study arises from the combination of several models. Section 4 discusses which e↵ects are deemed to be out of scope. Section 5 describes all algorithms that are used, separately. Section 6 describes a failed first attempt. Section 7 describes how the algorithms are combined as well as details of implementation. Section 8,9 and 10 describe the experiments, their results and what conclusions that can be drawn, respectively. Section 11 is about possible further research.

2 Background 2.1 Generative Design The use of evolutionary algorithms in space mission design is common practice nowadays [40, 28, 15, 20]. The approach is a new one, it was not even mentioned

3 in Betts’ classical survey from ’98 [4], which instead focused on Nonlinear Pro- gramming and Optimal Control. The rough idea is that the user defines some quantity (such as time of flight, fuel usage, or number of celestial bodies visited) and the Generative Design software designs a trajectory which optimizes this quantity while still making sure that the trajectory is within the parameters of the mission.

There are many advantages to using the approach of Generative Design, but perhaps the most convincing one is that of simplicity; instead of having a team of experts developing the trajectory anyone can let the software generate an ap- proximate trajectory and inspect the required mission parameters to determine if it is possible. A contrast to this is the Voyager program, where the engineers had to plot tens of thousands pork chop plots and use these to decide which trajectories were viable [26].

Another advantage is that computers can come up with designs that humans are unlikely to ever think of, such as the partition door Autodesk developed for Airbus using generative design [3]. It was twice as light as the one developed by humans. Another example is the antenna designed by an evolutionary algo- rithm by NASA [13]. Its shape was highly unintuitive, but it outperformed the antennas designed by humans.

2.2 Parallelization Parallel programming is the practice of running software on multiple computa- tional units at the same time [1]. This is, however, not as simple as it might sound. In order to turn serial code, running on only one core, into parallel code one has to be able to divide the problem into smaller sub-problems, to be distributed over the available cores. This is not always possible. For example if the input data of one of the sub-problems is based on the output data of one of the other sub-problems, then these two need to be done sequentially and are therefore not parallelizable.

Another diculty of parallelization is load balancing of tasks [39] It is rather common for sub-problems to vary in diculty and execution time, which means that the sub-problems should be distributed over the the available cores in such a way that no core is idle. This is of course often impossible, but finding a good load balance reduces running time and is therefore nonetheless important.

However, even if the load balance is perfect, this will not mean that the speedup achieved is perfectly linear; it is restricted by Amdahl’s law [2]. Speedup is de- fined as the the running time of the parallel code divided by the running time of the serial code. It is usually given as a function of the number of cores. Sometimes a small part of the problem is sequential and cannot be parallelized. Denote the fraction of the running time of this part by rs. This means that the fraction that is parallelizable is 1 rs. Hence the speed up of the running time is restricted by 1 s(n)  r +(1 r )/n s s

4 where n is the number of cores. Taking this to its limit gives s 1/rs as 1 ! n , thus placing a theoretical ceiling of r on the speed up. !1 s 2.2.1 SIMD There are di↵erent types of parallel programming. The one used in this thesis is the Single Instruction Multiple Data (SIMD), also known as Single Program Multiple Data (SPMD). This means that even though the cores run in parallel, they have to execute the same operations at the same time [30]. Meaning that they have to do the same thing.

2.2.2 CPU vs GPU The cores of a computer is sometimes referred to as a Computational Processing Unit (CPU). In contrast, the computational unit that handle graphics in a com- puter is called Graphical Processing Unit (GPU). (k¨alla h¨ar)There is a rather vast di↵erence in the hardware of these processing units; the GPU is made up of 100’s to 1000’s cores which are all running in parallel and while there might be several cores in a computer their numbers very rarely surpass 8.

Another di↵erence is that the cores on a GPU are grouped together in such a way that every group of cores is executed in a SIMD fashion.

2.2.3 CUDA CUDA is a parallel computing platform and programming model developed by Nvidia to program Graphical Processing Units (a.k.a. graphics cards or GPUs) [24]. The platform allows high-level coding in C (and to a broadening extend in the newer versions, even C++) with APIs that allow for control of the GPU functionality. The computationally expensive parts of the software is acceler- ated using an Nvidia GPU device and CUDA.

In this study it is always mentioned when an algorithm is o↵-loaded to the GPU.

3 Models of Celestial Dynamics

Humans have developed models describing the movements of the celectial bodies ever since the dawn of the scientific era. It was almost 400 years ago that Kepler developed his three laws based on the observations of Tycho Brahe. And this e↵ort continues to this day, even though Newton’s theory of gravity together with Einstein’s theory of relativity describe the movement of common objects such as , planets, comets and stars rather well. One of the reasons this is still an ongoing field of study is that Newton’s theory of gravity, in all but the simplest of cases, lacks analytic solutions. It is therefore prudent to cover some of the most common approximations of spacecraft and planetary trajectories.

5 3.1 2-Body Problem The problem of finding the trajectories of two celestial bodies that only a↵ect each other is often referred to as the 2-body Problem. It is often the case that the of one of these bodies is orders of magnitude greater than the mass of the other. If this is the case a reasonable assumption to make is to ignore the gravitational e↵ects of the smaller body on the larger one. This is referred to as the Restricted 2-body Problem, and is often a good approximation of star- , star-comet and planet-moon interactions.

The heart and soul of the restricted 2-body problem is Keplerian dynamics, which is based on Kepler’s three laws of planetary motion [35]. These are The orbit of each planet is an ellipse with the occupying one focus. • The line joining the Sun to a planet sweeps out equal areas in equal inter- • vals of time. A planet’s is proportional to the mean distance between the • 3 Sun and the planet, raised to the power of 2 . These laws holds true for any two bodies where one of the is orders of magnitude larger than the other with the caveat that the trajectory of the smaller body is any type of conic section, and not necessarily an ellipse.

The only time the Keplerian 2-body system is used in this study is in the Multiple model.

3.1.1 Lambert’s Problem One of the fundamental problems in astrodynamics is the so called Lambert’s problem [16]. Given two points in space r ~ 1,r~ 2, a time of flight ttof and a central body with a standard gravitational parameter µ, the objective is to find a Keplerian trajectory that intercept both points and have a flight time of ttof . The problem is formalized as d2~r rˆ = µ dt2 ~r 2 | | ~r (t1)=r ~ 1

~r (t2)=r ~ 2 where ~rˆ is a unit-vector in the direction of ~r , and t1 and t2 are the start and end times.

According to Lambert’s Theorem the time of flight of a Keplerian orbit is a function of the semi-major axis a, of the sum of the distances from the focal point of start and end points r1 +r2, and of the chord c which has r ~ 1 and r ~ 2 as its sides[16]. The only variable which is non-trivial to calculate is the semi-major axis a.

It should be noted that the solution might not be unique, since the direction of the orbit might be either clock-wise or counter clock-wise around the body. The orbit might also contain more than one revolution.

6 3.1.2 Multiple Gravity Assist Model The Multiple Gravity Assist (MGA) model is a global optimization approach to spacecraft trajectory design based on patched conic sections [15]. The whole trajectory is separated into legs, where each leg is an instance of Lambert’s problem with the position of some planets as boundary conditions. This means that each leg has a starting planet and a destination planet and a time of flight, with simple Keplerian during the flight.

The power of the MGA model lies in it’s implementation of V ’s. The naive way of describing a V requires 4 parameters: time as well as a 3D vector for size and magnitude. However Oberth’s e↵ect [25] states that the the most ecient way of gaining kinetic energy when falling down a gravitational well is to accelerate in the tangential direction when the spacecraft is closest to the celestial body. This is included into the V ’s of the MGA by assuming that the accelerators only burn when the spacecraft is closest to the planet it is passing.

The magnitude and direction of the V ’s can be deduced from the positions of the planets and the time of flight of the legs. Two consecutive Lambert legs requires three planets P1,P2,P3, which need not be distinct, and three times t1,t2,t3. Each solution to Lambert’s problem generates a velocity at the starting point and end point, and for two consecutive legs there might be a discontinuity between the end point velocity of the first leg and the starting point velocity of the second leg. Unfortunately this discontinuity in velocity does not represent the desired e↵ect of a high thrust burn, since the gravitational pull of the planet has an influence on the velocity as well. A good approximation of the planet induced V is therefore needed.

During a gravitational assist the trajectory of the spacecraft with respect to the planet will be hyperbolic, since it is assumed to have enough energy to leave the planetary system. However, since there is a V thrust when the spacecraft is at its closest to the planet, the outward and inward trajectories will not be the same. The powered flyby is therefore modeled as two patched hyperbolic trajectories.

Call the velocity at infinity of the inward V and the velocity at infinity of the outward hyperbolic trajectory V +. Note1 that both these velocities are planetocentric, and not heliocentric. These1 velocities are approximated as the inward and outward velocities of the Lambert legs (after they are transformed to planetocentric velocities).

The velocity at infinity and the semi-major axis a of a hyperbola are connected by the formula µ v = p 1 a r where µp is the standard gravity parameter of the planet [35]. Hence µ a = p v2 1 Call the closest distance between the spacecraft and the planet rc. This can be

7 Figure 1: Hyperbolic trajectory showing the angle ✓. calculated by r = a(e 1) c where e is the eccentricity of the trajectory [35]. By introducing the angle ✓ as the angle between the y-axis and the velocity at infinity of a east-west hyperbola (See figure 2), e can be defined as [35] 1 e = cos ✓ This gives 1 r = a 1 c cos ✓ ✓ ◆ Solving for ✓ gives

a 1 ✓ = arccos = arccos r a r /a 1 ✓ c ◆ ✓ c ◆

We now that the inward and outward hyperbolic trajectories have the same value for rc, but the semi-major axis and ✓ might di↵er. To avoid confusion they are referred to as ain,aout and ✓in,✓out. Call the angle between the plan- etocentric inward and outward velocities ✓diff .Then

✓diff + ✓in + ✓out =2⇡ ~ ~ The simplest way of finding the angle ✓diff between the vectors V 1 and V+1 is with the formula ~ ~ V 1 V+1 ✓ = arccos · diff ~ ~ V 1 V+1 ! | || | Since the closest approach rc is equal for the inward and outward trajectories we get 1 1 arccos + arccos = r /a 1 r /a 1 ✓ c in ◆ ✓ c out ◆ where is defined as =2⇡ ✓ . diff

8 Planet Radius 5 Mercury 1.65 10 AU · 5 4.09 10 AU · 5 Earth 4.30 10 AU · 5 2.29 10 AU · 4 4.72 10 AU · 4 Saturn 3.93 10 AU · 4 2.71 10 AU · 4 1.66 10 AU · Table 1: The radii of the planets as used in the code.

To find the correct rc a root finder is required. In this case Newton-Raphson was used. However, this does not answer the initial question of the size of the V . The vis-viva equation [35] for a Kepler trajectory is

v2 µ ✏ = 2 r and by using this in combination with the fact that µ ✏ = a for hyperbolic trajectories [35] on can solve for the velocity at the at rc.Ifthisis done for the inward trajectory as well as the outward trajectory the magnitude V is simply the di↵erence, since the direction of the V is assumed to be tangential to the velocity.

2 1 v(rc)=pµp + r a r c thus giving 2 1 2 1 V = pµp + + r a r a r c in r c out These results correspond to the ones given in [15]. 3.1.3 Radius of Planets

The value of the closest approach rc is not only used when calculating the V ; it is also needed to make sure that the spacecraft doesn’t crash into the planet. In order do make such a comparison the radii of the planets are needed. They are found at ssd.jpl..gov/?planet phys par

The mean radii are used, but increased with 1% in order to make sure that the found trajectory can be trusted.

9 3.2 Restricted 3-Body Problem The problem of analytical trajectory calculation goes from simple to all but impossible when a third body is involved. It is a well-known fact that general 3-body problem is chaotic in nature, but even simplifications such as the Planar Circular Restricted 3-body Problem (PCR3BP) is gives rise to chaotic behavior [31].

3.2.1 Planar Circular Restricted 3-body Problem

The PCR3BP assumes that the smallest mass m3 is orders of magnitudes smaller than the other two masses m1and m2,wherem1 >m2 [20]. The motion of the larger masses is assumed to be circular, which is almost the case with the planets and the Sun. The motion of all three bodies is assumed to be confined to a plane.

In order to simplify the governing equations of the CPR3BP the coordinate sys- tem is a synodic system, meaning that it rotates with the two larger bodies[28]. Without loss of generality the largest body can be assumed to lie on the x-axis at µ,whereµ is defined by µ Gm m µ = 2 = 2 = 2 µ2 + µ1 Gm2 + Gm1 m2 + m1 with G being Newton’s gravitational constant.

By normalizing the system in such a way that the unit of length is the dis- tance between the larger bodies, and the unit of time is is their orbit period divided by 2⇡ one gets the system[28]

x˙ = vx

y˙ = vy @⌦ v˙ = +2v x @x y @⌦ v˙ = 2v y @y x where x2 + y2 1 µ µ ⌦= + + 2 (x + µ)2 + y2 (x + µ 1)2 + y2 and thus p p @⌦ (µ 1)(x + µ) µ(x + µ 1) = x + 3 + 3 @x (x + µ)2 + y2 (x + µ 1)2 + y2 @⌦ p (µ 1)y p µy = y + 3 + 3 @y (x + µ)2 + y2 (x + µ 1)2 + y2 p p 3.2.2 Lagrange Points There exists equilibrium points in the Restricted 3-Body Problem where the smaller body can in theory can stay indefinitely. These points are called La- grangian points after the French mathematician Joseph-Louis Lagrange. In

10 Figure 2: Position of the Lagrangian points. The iso-lines represent levels of constant potential energy. Image credit: NASA (Listed under Creative Com- mons 3.0 license). reality these points are highly unstable and the smallest of perturbations on the small body will kick it away from the equilibrium [35].

There are five of these points, referred to as L1 to L5 [18]. The first three lie on the line going through the two massive bodies, and L4 and L5 lie in the plane of motion and are mirror symmetrical over the x-axis. See figure 3 for a visualization.

In order to derive the position of these points in the CPR3BP one has only to find the points where

x˙ =0 y˙ =0

v˙x =0

v˙y =0 which is to say @⌦ @⌦ = =0 @x @y Unfortunately calculating the position these points involve finding the roots of a third function, which is a task to be avoided by all but the foolishly brave. It is, however, simple to find very accurate approximations to these points using root finders such as Newton-Raphson and Halley’s method. Only the L1,L2

11 and L3 points are of interest in this study, and as such y can be assumed to be zero. This reduces the equation to

(µ 1)(x + µ) µ(x µ 1) x + + =0 x + µ 3 x + µ 1 3 | | | | which divides the x-axis into three segments depending on the sign of x + µ and x + µ 1. Each segment have a slightly altered equation of their own: (µ 1) µ x + + =0ifx + µ 1 0 (x + µ)2 (x + µ 1)2 (µ 1) µ x + + =0ifx + µ 1 < 0 and x + µ 0 (x + µ)2 (x + µ 1)2 (µ 1) µ x + + =0ifx + µ<0 (x + µ)2 (x + µ 1)2

The L1, L2 and L3 Lagrange points can be found from these three equations.

3.2.3 Periodic Lyapunov Orbits

There exists periodic orbits in the plane defined in CPR3BP around the L1, L2 and L3 Lagrange Points. These are called Periodic Lyapunov Orbits [28]. These are highly unstable orbits, but allow for a spacecraft to follow the path of a planet without falling far into its gravitational well.

These orbits lack analytic solutions and finding them is a great area of study. The most common approaches of finding these orbits is to linearize the system around the in question and find decent approximations[32], use shooting methods[14], or use generating functions [12]. Each of these methods have their disadvantages: the approximations are quick but rough, the shooting methods are sensitive to initial conditions [20], and the generating functions have limited spatial range of applicability [20].

3.2.4 Generation of Periodic Lyapunov Orbits In recent years a new approach surfaced. By defining a function that calculates the fitness of each orbit approximation, one can simply apply a continuous op- timizer to the problem. This approach has been implemented successfully using a PSO on the Earth-Moon system [28].

This is the approach that Cassandra will use as well, since it allows for a great reuse of code. Since the continuous optimizers used in Cassandra have been written in CUDA this generation will hopefully receive a speedup compared to previous studies.

4 Purpose and Scope

The purpose of this study is to create a Generative Design software that com- bines simplicity of the Keplerian trajectories with the low-fuel trajectories of the 3-body problem.

12 In order to limit the scope of the study it will not include:

Aero-breaking • Relativistic E↵ects • Low Thrust trajectories • Moons and planetoids • Any solar system but our own • Sensitivity Analysis • Radiation Analysis • Cassandra will hopefully be of use to anyone who wants to quickly try out deep space mission ideas, even without these additions.

5 Algorithms

The algorithms in this paper are used for two things: approximating solutions to mathematical equations, both di↵erential equations and regular equations, were an analytic solution is lacking or for optimization.

5.1 Integrators A numerical integrator is used to approximate the solution of an Ordinary Dif- ferential Equation (ODE) when an analytic solution is unavailable. All ODE’s described in this study will be initial condition ODE’s, meaning that the initial state of the problem is known. A numerical integrator approximates the deriva- tive (sometimes referred to as the right hand side of the ODE) over an interval and approximates the integral of the derivative over the specified interval. The value of the calculated integral is then added to the current state of the ODE, thus approximating a new state. The details of this integration varies from in- tegrator to integrator.

The integrators will be used to numerically approximate a solution to the re- stricted 3-body problem.

5.1.1 Adaptive time-step Runge-Kutta The adaptive time-step Runge-Kutta is a method of integration based on the idea that the di↵erence between a step of lower order integrator and a higher order integrator can be used as an error estimation [9]. The so called Runge- Kutta-Fehlberg is a Runge-Kutta based method that calculates the p:th and (p + 1):th order approximations each iteration. A fixed step Runge-Kutta of order p needs to evaluate the right-hand side function at p points. In order to improve eciency the Runge-Kutta-Fehlberg method uses the same points for both the p:th order approximation and the (p + 1):th order approximation, thus the cost of the adaptive time-step is roughly one right-hand side evaluation per

13 iteration.

The method is given a local tolerance ✏, and if the di↵erence between the two approximations is greater than ✏, then the step-size is decreased and the approxi- mations are recalculated. Usually a minimum time-step is supplied to make sure that the method terminates.

5.2 Optimizers There are two types of optimizers used in this study: continuous optimiz- ers and a discrete optimizer. A continuous optimizer is used for minimiz- ing/maximizing function with real values as input, and a discrete one is used to minimize/maximize a function which uses integers as input.

In this study the discrete optimizer will only be used to decide which plan- ets that the spacecraft should do a flyby of, and in what order. The continuous optimizer will be used to find periodic orbits in the restricted 3-body problem as well as actually designing the Keplerian orbits between the planetary flybys.

5.2.1 Particle Swarm Optimization Particle Swarm Optimization (PSO) is one of the more common swarm based optimization methods. It is widely used in spacecraft trajectory optimization [40, 28, 15]. In it there are N particles, each with a position and velocity (these particles, and therefore their position and velocity, only exist in the so- lution space; it is not a physical position or velocity), where each position must uniquely represent a solution to the problem to be optimized [33]. These parti- cles then travel over the fitness landscape in search of a good solution.

The particles interact with each other in a way that loosely resembles the move- ment of flocks of birds and schools of fish. Denote the position of particle t t t t number i at time index t by Xi , and its velocity by Vi . Both Xi and Vi are d- dimensional vectors, where d is the dimensionality of the optimization problem at hand. During each iteration the velocity is updated according to the formula

V t+1 = ↵ V t + u (P Xt)+ u (N Xt) i i 1 1 i i 2 2 i i where Pi is the best position that the particle in question has visited, and Ni is the best position that any particle in the neighborhood has visited, and ↵, 1 and 2 are tuning parameters. The position is then updated by the formula

t+1 t t+1 Xi = Xi + Vi There are multiple ways to define the neighborhood of a particle. A global neighborhood means that every particle can interact with every other particle, and while this seems intuitive enough this method often gets trapped in local minima since all particles tend to flock around the best solution so far. The neighborhood used in this study is a ring topology, meaning that each parti- cle has a left and a right neighbor and all particles are connected to each other through their neighbors. Although other topologies might have proved superior, the ease of implementing this on in a CUDA block far outweighed any slight

14 Figure 3: Visualization of a ring topology. potential gains. See figure 1 for a visualization.

1+r1 The parameters are set as ↵ = 2 , 1 =1.49445r2 and 2 =1.49445r3, where ri is a uniformly random number in the range [0, 1), in accordance with [33]. The particles therefore have di↵erent values for these tune-able parameters.

5.2.2 Self-Adaptive Di↵erential Evolution Di↵erential Evolution (DE) is a continuous optimizer, that uses the di↵erence between individuals to create a new o↵spring. The classical di↵erential evo- lution algorithm requires two parameters, usually referred to as p and f [40]. During each iteration all individuals in the population are updated according to these rules: Step one is to select 3 random but distinct individuals A, B, C from the iteration before. Call the new individual Y . It is an o↵spring of these three individuals defined byY = A+f(B C), where f is a tuneable parameter. These o↵-springs will be created until all a new population of the same size as the original is created. Each of these new individuals will cross over with an old individual. The old individual is replaced if and only if the fitness of the individual created using the cross over mutation is higher than the fitness of the old individual.

In this study an exponential crossover is utilized, which means that a random point q is chosen uniformly such that 0 q

The self-adaptive version of Di↵erential Evolution tunes the parameters f and p automatically. Each individual contains the original gene as well as values for f and p. Before calculating the next iteration there is a 10% chance that either of them are mutated. During this mutation, fi is sampled randomly from a uniform distribution on [0.1, 1] while pi is drawn from a uniform distribution on [0, 1]. These new values are then used in the computation of the next iteration.

5.2.3 Ant Colony Optimization Ant Colony Optimization (ACO) is a swarm based discrete optimization tech- nique based on the collective movements of ants searching for food using pheromones

15 [8]. It is used to find good solutions to combinatorial optimization problems and has been applied favorably to the Traveling Salesman Problem [7], the Multidi- mensional Knapsack Problem [17] and the construction of minimum spanning trees [23].

For each iteration every ant walks a path (a set of edges) which represents a solution to the discrete problem to be optimized. The ant leaves a trail of pheromones in the path to signal how good the solution (or food source, in the case of actual ants) is. When other ants chose their paths they are more likely to walk along an edge where the pheromones signal good solutions.

Given N nodes with fully connected edges between them, where all the ants start at node 0 with the objective of getting to an end node in such a way that minimizes an arbitrary function f, the ants leave pheromones in the edges be- tween these nodes. The construction of paths is random, where the probability distribution is determined by the pheromones. The precise nature of the of this distribution varies depending on the type of ACO [8], in this study the min-max version is used.

The min-max version of ACO finds the minimum fitness fmin and maximum fitness fmax of all paths that were traversed during an iteration. An intermedi- ate value ci is calculated by linearly mapping the fitness fi of an ant between 0 and 1, where fmin maps to 0 and fmax maps to 1. The ci value is calculated for every path. The intensity of the pheromones created each iteration between two arbitrary nodes is proportional to the sum of all c values who’s path traversed the edge between these nodes. When a new ant has to decide which edge to traverse next, the probability of each edge is proportional to its pheromone level.

The pheromones from the previous iterations linger into the subsequent iter- ations according to the formula

M p =(1 ↵)p + ↵ c /M i+1 i i i=0 X where piis the intensity of the pheromone at iteration i, ↵ is the rate at which the pheromones diminish due to evaporation and M is the number of ants.

The rough outline of the ACO is defined below: Set parameters; Initialize pheromone trails; while termination conditions not met do ConstructAntSolutions; ApplyLocalSearch (optional); UpdatePheromones; end Algorithm 1: Rought outline of the Ant Colony Optimization.

16 5.3 Root Finders Root finders are algorithms used to find the solution to f(x) = 0 for complex and sometimes multi-dimensional functions. In this study they will only be used for finding a solution to Lambert’s problem, but this will prove to be a bottleneck. It is therefore of utmost importance that these are as ecient as possible.

5.3.1 Newton-Raphson Newton-Raphson is perhaps the most known root finder algorithm. Given a function f(x), which could be either a scalar or vector function Newton- Raphson’s method finds an approximation to the root.

The function f(x) must be di↵erentiable. A linear approximation of the function at point x⇤ is f(x) f 0(x⇤)(x x⇤)+f(x⇤) ⇡ thus giving an approximate root

f 0(x⇤)(x x⇤)+f(x⇤)=0

f(x⇤) x x⇤ = f 0(x⇤)

f(x⇤) x = x⇤ f 0(x⇤)

Using an initial guess x0 it is then simple to iteratively use these tangential approximations to improve the root approximation by

f(xi) xi+1 = xi f 0(xi)

5.3.2 Halley’s Method Halley’s method work on the same principle as Newton-Raphson; it also uses a point-based approximation in order to iteratively improve the root approxima- tion. The di↵erence is that Halley’s method uses a rational linear-over-linear function approximation instead of a linear one. A linear-over-linear function is defined as ↵ + x + x for some ↵,,, R. 2 Using the same procedure as Newton-Raphson’s method Halley’s method is defined by

2f(x )f (x ) x = x i 0 i i+1 i 2f (x)2 f(x )f (x ) 0 i 00 i Note that for small values the second derivative the formula approximates Newton-Raphson’s method rather well.

17 5.3.3 Ad Hoc Root Finder An equation that shows up in section 4.1.2 is 1 1 g(x) = arccos + arccos =0 x/↵ 1 x/ 1 where ↵,< 0 and 0 <<⇡. This equation lacks analytic solutions, and the root finder might become a computational bottle-neck if managed improperly.

An ad hoc root finding algorithm was developed in order to avoid such bottle- necks. It is based on the same principle as the Newton-Raphson method and Halley’s method in the sense that it iteratively approximates the function us- ing point-based approximations. The root to this approximation function xi is found analytically and a new approximation is created using the value of xi.

The chosen function should be one that has analytic roots, but still approxi- 1 mates the behavior of the original function g(x). The derivative of arccos x/↵ 1 is calculated in order to find out more about the behavior of g(x).

d arccos 1 1 x/↵ 1 d x/↵ 1 1 = ⇣ dx ⌘ dx 0 1 2 1 1 ( x/↵ 1 ) @q A 1 d arccos x/↵ 1 ↵ 1 = 2 ⇣ dx ⌘ (x ↵) 0 ↵ 2 1 1 ( x ↵ ) @q A 1 d arccos x/↵ 1 ↵ = ⇣ dx ⌘ 2 ↵ 2 (x ↵) 1 ( x ↵ ) Since ↵<0 this is negative x>0. It goesq to infinity as x 0, and to 0 as x . This means that arccos8 1 has a value of positive! infinity when !1 x/↵ 1 x = 0, is strictly decreasing, and converges as x grows. It is easy to see that it converges to arccos 0 = ⇡/2.

An other function that shares these properties is c/x + ⇡/2, where c is some constant. This gives c g(x) + ⇡ ⇡ x where the root is c x = r ⇡ In order to calculate the value of c for a specific xi one solves c g(x)= + ⇡ x x(g(x)+ ⇡)=c Which leads to the final algorithm g(x )+ ⇡ x = x i i+1 i ⇡ 18 The initial guess x0 was derived using an even simpler function approximation. A first order approximation is arccos(z) ⇡/2 z thus giving ⇡ 1 1 arccos ⇡/2 x/↵ 1 ⇡ x/↵ 1 Which results in 1 1 g(x) ⇡ =0 ⇡ x/↵ 1 x/ 1 Which reduces to a parabolic equation with the roots

(↵ + )(1 + ⇡) (↵2 + 2)(1 + ⇡)2 2↵( 1+2 +2⇡ + ⇡2 2(1 + ⇡)) x = ± 0 2(⇡ ) p

The smallest x0 that is larger than zero is used as an initial guess.

6 First Attempt

The Cassandra presented in this paper is not the first attempt at a software that finds low fuel trajectories by the author. The first few months of the project was dedicated to developing such a software with a more general approach than that of the Cassandra described in the next section. No simplifications were made regarding the model of gravity (except for the exclusion of relativistic e↵ects and all bodies where modeled as spheres of even density), instead Newton’s law of gravity was applied for all planets as well as the sun and the solution was found numerically using Runge-Kutta-Felhberg. This made the software rather slow.

The V ’s were equally general. Each such maneuver was modeled using 4 parameters: The components of the V in all three Cartesian directions Vx, Vy and Vz as well as time since previous maneuver. By combining this with a initial state and a starting time gives a uniquely determined trajectory.

In order to minimize the fuel usage a simple CUDA version of the Particle Swarm Optimizer was implemented. In order to avoid unfeasible and unwanted trajectories, a limit was put on the maximum time of flight. This was on the order of magnitude of about 10 years.

It should be mentioned that while this introduces the task of making sure that the spacecraft actually rendezvous with the destination planet. This cloud be done by introducing penalties. Or by introducing a Keplerian Lambert’s Leg from the position of the spacecraft to the destination planet, where the time of flight is a new parameter to be optimized. While the first one is more general, the other one gave far better results.

19 7 Details of Implementations

The bulk of the code is written in C++, with heavy emphasis of the C-part, with the exception of the parts of the code that are written for the GPU-device; those are written in CUDA.

There are a number of mission parameters that have to be supplied by the user, such as destination planet, approximate take o↵, maximum number of moves in the trajectory. These have to be defined before compilation of the software. This will hopefully let the compiler make a slightly more ecient code. These parameters are found in config.h.

7.1 Planetary Positions The first step of Cassandra is to create a list of planetary objects. Each planet is defined by its [35], which are defined in JPL’s paper Keple- rian Elements of Approximate Positions of the Major Planets [34]. The orbital elements are calculated in an reference time, which is defined by the user before compilation, and the trajectory approximations are only valid in a small time span around this reference time.

It should also be noted that the orbits of the planets are assumed to be cir- cular instead of elliptical. This reduces the accuracy of the results, but it allows for a more natural transition from the MGA model to the Circular Restricted 3-body Problem. It stands to reason that it reduces the running time as well, since the determination of the position of a particle requires the solution to

↵ = x sin x [34] which lacks analytical solutions and relies on time consuming iterative meth- ods.

The elliptical orbit is converted to a circle in such a way that time of revo- lution is conserved. According to Kepler’s third planetary law

2⇡ 1.5 trev = a pµ

2⇡ and since pµ is constant the radius of the circle is equal to the semi-major axis a of the ellipse.

7.2 Discrete-Continous Optimization Cassandra is, at its core, an optimization software. However since it needs to decide which planets to do a flyby of, which is a discrete choice, as well as find good values for continuous values such as time of flight it needs an optimizer capable of discrete optimization as well as a continuous optimization. The way this is resolved in Cassandra is by implementing a discrete optimizer in which the fitness function calls another continuous optimizer.

The main reason for the separation of continuous and discrete is simplicity.

20 There is also a bit of a shortage of discrete/continuous hybrid methods.

In this study there is only one discrete optimizer, Ant Colony Optimization, and two continuous optimizers (Particle Swarm Optimization and Di↵erential Evolution). This limitation is simply one of scope, and the choice of optimizers is rather arbitrary. There are however some reasons behind the choices. Both PSO and DE are rather common and generic optimizers, and they usually com- plement each other rather well since PSO is swarm based and DE makes use of the di↵erence between individuals. The choice of ACO was one of simplicity; it the one of the simplest methods that still models the problem rather well by behaving like a Markov Chain.

7.3 Objective Function The goal of this study is to find low fuel trajectories for a spacecraft, and as such the function to be minimized by the continuous optimizers should be one measuring fuel usage. It is however common practice to minimize the sum of V ’s instead, since it’s simpler and gives the same results in the end.

Cassandra’s approximation of the sum of V ’s is four-fold; it contains the departure of Earth, the landing (or orbit insertion) at the destination planet, the MGA flybys and the entry and departure of the Lyapunov orbits.

The departure and landing from Earth and to the destination planet are the roughest approximations. In order to keep the calculations fast and simple the V was simply modeled as the di↵erence in velocity of the planet and the ve- locity of the spacecraft as it left earth or arrived at the destination planet. The gravitational e↵ects of those planets are ignored for simplicity.

The details of the calculation of a V in a MGA flyby has been covered in the MGA section. However since Lambert’s problem might lack a unique so- lution, for example owing to multirevolutions, one still has to define which of the possible trajectories the spacecraft has to follow. In order to keep a balance between good results and short execution times Cassandra ignores multirevolu- tion solutions, but considers both retrograde orbits and prograde orbits. This means that for each Lambert leg there are 2 possibilities, thus giving a total of 2N trajectories, where N is the number of legs. Cassandra calculates each of these and returns the one with the smallest fuel consumption.

The calculation of the solutions to Lambert’s problem is a based on an open source code developed by Dario Izzo of the Advanced Concepts Team at the [16]. The code is part of the Pagmo software, but the version used in this study has been converted to CUDA by me in order to make it run on GPU devices.

The Lyapunov orbits are unstable, and small amounts of fuel is required to keep a spacecraft in the desired orbit. These are ignored, with the justification that the main thruster system of a spacecraft tend to be separated from the smaller trajectory controllers [21].

21 The objective function of the discrete optimizers are simply the best value found of the continuous optimizer for the defined constellation of discrete values. This value has a stochasticity to it since the the continuous optimizers are random. In order to reduce the variance of the discrete objective function it is important that the continuous optimization receives enough running time. This is, how- ever, a trade o↵since this will either increase the running time of Cassandra of, if the running time is fixed, it will reduce the number of discrete iterations.

7.4 Implementation of Periodic Lyapunov Orbit Genera- tion 7.4.1 Theory of Optimization The perhaps most computationally expensive operation Cassandra does every iteration is generating the periodic Lyapunov orbits. This is done using a GPU- enabled PSO algorithm where each trajectory guess is represented by two pa- rameters: initial position on the x-axis x0 and believed period of revolution T . Each periodic Lyapunov orbit has a constant value C referred to as the Jacobi constant [28]. This value is defined as C = 2⌦ (v2 + v2) x y using the notation from section 4.

The initial position can, without loss of generality, be assumed to lie on the x-axis. Since the system of equations is symmetric around the y-axis the vx component can be assumed to be zero in the initial state. If one defines the angle the velocity vector makes with the x-axis as then the governing system of equations simplify to [28]

x˙ = p2⌦ C cos y˙ = p2⌦ C sin ⌦ cos ⌦ sin ˙ = y x p2⌦ C @⌦ @⌦ where ⌦x := @x and ⌦y := @y . The initial state of the angle is ⇡/2, since vx(0) is assumed, once again without loss of generality, to be positive (and non- zero) and vy(0) = 0.

By integrating this system of ODE’s using the Runge-Kutta-Fehlberg method until t = T one can calculate the fitness of the trajectory. In order for the orbit to be periodic its starting state and end state are required to be the same. Hence x(T )=x0, y(T )=y(0) = 0, and (T )=(0) = ⇡/2+2k⇡,withk Z. This can be reduced to an error function that should be minimized. 2 J = x(T ) x + y(T ) + min ( (T ) ⇡/2 mod 2⇡, (T ) ⇡/2 mod 2⇡) | 0| | | | | | | This function has a global minimum of zero at the periodic orbits (provided that such an orbit exists). This method of generating orbits is taken from Pontani et al’s 2010 entry in the book Spacecraft Trajectory Optimization [28]. The optimization is of course heavily accelerated using the massively parallel computational power of a modern GPU.

22 7.4.2 Troubleshooting Lyapunov Orbits While the objective function J does have its (possible) global minima in a pe- riodic orbit, it has another minima in a time of flight of zero. However even if the time of flight is restricted there tends to be a local minima at the shortest time of flight. Unfortunately this usually led to premature convergence for the optimizer.

In order to make sure that the trajectory actually makes a complete orbit around the Lagrange point a new variable is introduced. is the angle between the spacecraft and the x-axis but measured in the Lagrange point. The controlling equation of is

d p2⌦ C = ((x x )sin y cos ) dt (x x )2 + y2 L L were xL is the position of the Lagrange point in the synodic coordinate system, and (0) = ⇡. This is a changed form of the used in [28], with the alteration of the orbiting point: in the source the spacecraft’s objective is to orbit the moon and thus the angle was measured around the moon instead of around a Lagrange point.

The spacecraft makes a full revolution if and only if (T ) (0) 2⇡,whereT is the final time. The objective function J is then changed| such| that it returns 12 9 9 a big penatly, 10 ,if (T ) (0) < 10 2⇡. The purpose of the 10 factor is to not overpenalize trajectories| that almost| complete a circuit.

In order to calculate the evolution of one needs a decent approximation of xL. This calculation is based on the three equations derived in section 4.2.2. combined with the root finding method Halley’s method.

7.4.3 Implementation In order to increase the eciency of the calculation of the sum of V ’s, the Lyapunov orbits were calculated once, before the continuous optimizer is called. The resulting orbits are saved as a set of sampled points that can be interpo- lated at a later time to calculate an approximate position along the calculated curve. Each sample point contains the x and y positions as well as the time, all in the synodic frame of reference with the normalized units. The number of samples per Lyapunov orbit is set to 100. This means that the Jacobi constant needs to be defined before the continuous optimizer is called.

There are three continuous parameters to each Lyapunov orbit: 0,1 and time of flight. The two ’s represent the entry and exit point of the trajectory. is a normalized unit that goes from 0 to 1 (exclusively), where each corre- sponds to the point (x(T ),y(T )), where T is the period of the Lyapunov orbit.

This implementation of the orbit calculation was chosen because, while some accuracy is lost in the interpolation, it o↵ers the continuous optimizer a lot of freedom without having to recalculating the orbits. If either of 0,1 and ttof changes all that needs to be calculated is the interpolation as well as a conver-

23 sion from the synodic frame of reference to the heliocentric Cartesian coordinate system, neither of which are computationally expensive.

7.5 Approximations and Reliability of Results Throughout this study there have been mentions of approximations, especially regarding the sum of V ’s and the force of gravity. This leads to leads to some questions regarding the accuracy of the software.

It is true that the results from this project isn’t accurate enough to be the sole basis of a deep space mission. It is, however, common practice to divide the the search for viable and ecient spacecraft trajectories into two di↵erent optimization searches: one global, and one local. The job of the global search is to find a trajectory that is close to a good path, and the job of the local one is to use such a trajectory as the starting point for a much more accurate optimization.

This project is a global search.

8Experiments

The experiments can be bundled into three distinct groups: the di↵erent root finders are used to calculate the closest approach of a spacecraft to a planet, the PSO algorithm is used together with the Runge-Kutta-Felhberg to find periodic Lyapunov orbits, and then all parts are finally tested together to actually design a spacecraft trajectory.

8.1 Hardware Setup All experiments were run on the same computer to make the results as fair as possible. The computer was provided by Precisit. Its processor was an Intel Core i5-4690K at 3.5GHz, with 8 GB RAM. It had 4 cores, but none of the CPU code was written to use multicore support. The operating system was Windows 7.

The GPU was an Nvidia GeForce GTX 750 Ti with 640 CUDA cores, and a memory frequency of 5400 MHz, 4 GB of RAM and a memory band width of 86.40 GB/s.

8.2 Compiler and Flags Nvidias own compiler nvcc was used for the compilation of the device code. However a general purpose C++ host compiler is needed as well. Visual Stu- dios C++ compiler cl.exe was used in this study.

The compiler flag -O5 was used to ensure the shortest possible execution time.

24 8.3 Root Finders for Calculation of Closest Approach The eciency of the root finders when applied to the calculation of the closest approach was investigated using a simple experiment. The behavior of Newton- Raphson was compared to the ad hoc method on the CPU. In each method there was a limit on the number of iterations at 500. If the absolute function 13 value was less than 10 it was considered as a convergence, and the method terminated. If, however, the absolute value of the function was greater than 5 10 after 500 iterations, the run was considered a failure.

The initial guess x0 was the same for both methods and is described in sec- tion 3.3.3.

8.4 Periodic Lyapunov Orbits In order to measure the execution time and convergence of the PSO algorithm that finds periodic Lyapunov orbits 3 experiments were run. All of them tried to find orbits around the Lagrange points of Jupiter, since the it has the biggest µ value of all the planets.

The three experiments had di↵ering Jacobi constants: C0 0.01, C0 0.02 and C 0.03, where C is the Jacobi constant corresponding to the Lagrange 0 0 point in question. The position of the L1,L2 and L3 Lagrange points are cal- culated for all planets using Halley’s method at the start of the code.

In these experiments the Lagrange point in question was the L1 point.

Each block on the GPU was a separate PSO run, and there was no commu- nication between the blocks. This was in order to ensure that the trajectory found was the desired one, and not a local minima. There were 64 blocks, with 32 threads in each; each thread corresponded to one particle. The algorithm was allowed to run for 300 iterations, and the fitness of the best solution found was returned every 30 iterations.

8.5 Massively Parallel Multiple Gravity Assists The behavior of the Multiple Gravity Assist part of the code was first investi- gated separately, without the periodic Lyapunov orbits.

8.5.1 Continuous optimization only At first the continuous optimization algorithm was tested separately from the discrete planet optimization. An experiment was conducted in order to test the behavior of the two optimizers: Di↵erential Evolution and Particle Swarm Op- timization. In this experiment the goal was to minimize the V in a trajectory starting at Earth and doing a fly-by of Venus, then Mars and then a rendezvous at Jupiter. The starting time is between the first day of 2000 to the last day of 2004, and the maximum time of flight between fly-bys was 5 years. Each optimizer was allowed to run 300 iterations, and the best fitness was recorded every 10 iterations.

25 Experiment nr. Destination Earliest launch Max tof Nr. of fly-bys 1 Saturn 2020 15 years 2 2 Mercury 1973 10 years 3 3 Neptune 1850 20 years 4

Table 2: The setup of the three MGA experiments.

8.5.2 Discrete/continuous Optimization Three experiments were conducted. Each of them using the Ant Colony Opti- mization method for the discrete optimization and Particle Swarm Optimization for the continuous optimization. PSO was used since it tends to do better for smooth fitness landscapes, with small changes in the fitness along some line such as the banana function [40], at least for big populations.

In each of the three experiments the starting planet was Earth.

The first experiment was about finding a trajectory to Saturn with earliest launch in 2020, with 2 planetary flybys. The maximum time of flight for each individual move was 15 years. The second experiment tried finding a path to Mercury using 3 planetary fly-bys with a maximum time of flight of 10 years for each move. The earliest launch date was 1973, at the end of the . The third experiment tried finding a trajectory to Uranus, with 4 flybys and a maximum time of flight of 20 years per move. The earliest launch date was set to 1850. To say that this is early in the history of space flight is an understatement. The reason this year was chosen was that it would give variance in the relative position of planets.

See table 2 for a summary of this information.

Each block was a separate PSO run without communication between the blocks, just like in the periodic Lyapunov orbit finder. The number of blocks and threads remained unaltered as well.

One di↵erence between this PSO optimization and that of the periodic Lya- punov orbits, is that there are unfeasible trajectories in MGA that cannot be described by simple inequality equations. The fitness function of the MGA adds a huge penalty if the trajectory is unfeasible. If the position (and all previous positions) of a particle are unfeasible, then the next position will be uniformly random over the domain. This is to ensure that a feasible solution is found as quickly as possible.

8.6 Conical Arcs And Lyapunov Orbits Combined The last experiment was a combination of conical trajectories and Lyapunov orbits. In the experiment the has to leave Earth to end up in a Lyapunov orbit around Jupiter’s L1-point, perhaps to study its magnetic field. This orbit should complete at least one orbit and have the energy C0 0.03. The probe should then leave Jupiter and continue to Uranus, where it will ren- dezvous. The maximum time of flight between orbital maneuvers is 5 years, and

26 Method: Newton-Raphson Ad Hoc Method Execution time: 6.722s 13.098 s Percent converged: 99.5844 % 99.9949 %

Table 3: Comparison of the root finding methods, when applied to the calcula- tion of closest approach of a planet in MGA. the probe is expected to leave Earth between 2035 and 2040.

The procedure of finding the Lyapunov orbit is the same as in section 8.6. After a suitable orbit has been found, a di↵erential evolution algorithm is applied to the flight times as well as the point of entry and departure in the Lyapunov orbit. The di↵erential evolution was allowed to run for 2000 iterations, to make sure that it converged.

9 Results 9.1 Root Finders for Calculation of Closest Approach The results of the root finding experiment is found in table 3 below. To sum- marize; the Newton-Raphson method was almost twice as fast, but did not converge as often as the ad hoc method did.

9.2 Periodic Lyapunov Orbits The convergence of the three experiments is shown as the error of the best solution found so far in figure 4. The trajectory of the orbits are shown in figure 4, using a synodic coordinate system.

9.3 Massively Parallel Multiple Gravity Assists 9.3.1 Continuous optimization The results in figure 6 show that the di↵erential evolution algorithm both con- verges faster and finds a feasible solution quicker than particle swarm optimiza- tion.

9.3.2 Discrete and Continuous Optimization The resulting trajectories from the experiments can be found in figures 8 and 9. The plot of the convergence of the V s of the best individual as a function of the iteration numbers is given in figure 7.

9.4 Conical Arcs And Lyapunov Orbits Combined The V of the best individual found is recorded in figure 10.

27 Figure 4: Convergence of the periodic Lyapunov orbits around the L1 point in the Jupiter-Sun system.

Figure 5: Periodic Lyapunov orbits around the L1 point of the Jupiter-Sun system with di↵erent energies.

28 Figure 6: Comparison of continuous optimization with di↵erential evolution in green and particle swarm optimization in green.

Figure 7: The convergence of experiment 1 (blue), 2 (green) and 3 (red).

29 Figure 8: Experiment 2.

30 Figure 9: Experiment 3.

Figure 10: The V required for the trip from Earth to the L1-point of the Jupiter-Sun system to Uranus.

31 10 Analysis 10.1 Root Finders Both root finding algorithms converged more than 99 % of the times, and should probably be considered as reliable enough for the application. This makes the ad hoc method moot, since the execution time of the Newton-Raphson method is 49% smaller than that of the ad hoc method. This di↵erence could very well be due to the fact that one iteration of the ad hoc method requires more floating point operations than one iteration of Newton-Raphson.

10.2 Periodic Lyapunov Orbits An orbit with a small error was found for all of the three energy levels. This is in agreement with the results in [28].

10.3 Massively Parallel Multiple Gravity Assists 10.3.1 Continuous optimization The Particle Swarm Optimization method performed much worse than the Self- Adaptive Di↵erential Evolution. Both when it came to convergence and how fast the algorithm can find a feasible solution. This was unexpected, but in retrospect not surprising since new research indicates that di↵erential evolution seems to handle constraints better than PSO [19].

10.3.2 Discrete and Continuous Optimization In all of the three experiments feasible solutions were found, however the re- quired V in the second experiment was much higher than in the others. This can be seen in the jagged and pointy appearance in figure 8; those sharp turns usually require high V ’s. Experiment 1 and 3, however, converge to more ecient solutions. Thus giving some merit to the method.

10.4 Conical Arcs And Lyapunov Orbits Combined The di↵erential evolution algorithm was used together with particle swarm in this experiment. The particle swarm algorithm was used to find the Lyapunov orbit since that had proved ecient enough both in [28] and in the experiment described above. The di↵erential evolution algorithm was applied to the opti- mization of the times between the maneuvers, since it had shown an aptitude towards that in a previous experiment. The result shows that such a combined optimization approach creates a trajectory which might actually be feasible, with a V of 2.6 AU/year.

10.5 Conclusions The fact that a reasonable trajectory can be created with a combination of regular MGA trajectories and periodic Lyapunov orbits gives credence to the approach presented in the paper. This means that one is able to design a mis- sion were the spacecraft can stay close to a planet and study its behavior from

32 midrange, without falling too deep into its gravitational well, and then con- tinue with a series of flybys of other planets. An example of such a mission could study the magnetosphere of Jupiter and then continue to Neptune and/or Uranus, which have not been studied up close since Voyager.

The new root finding algorithm, however, did not pay o↵since no running time improvements were made compared to Newton-Raphson, which is the gold standard in the field.

11 Further Research

The scope of this study was rather limited owing to the fact that a lot of time was spent implementing the general software, that ultimately did not work. This unfortunately means that there were many possible additions that didn’t make it into the final product.

The simplest such addition that would most likely give a substantial boost in the results is Deep Space Maneuvers (DSM). For example missions such as the Rosetta mission [10] include Deep Space Maneuvers and would be much harder without them. Implementing DSM is rather simple as well. They could either be implemented naively by representing each of them with 4 parameters [28], such as in the failed general software, or they could be implemented using Primer Vectors [29].

Additional optimization algorithms should have been implemented as well. Per- haps one that could optimize continuously and discretely at the same time. But perhaps a Genetic Algorithm would be more likely to produce better results. The advantage a Genetic Algorithm has over ACO is that once it has found a good part of the trajectory, it can easily communicate this to other individuals and to the coming generations. The most pressing disadvantage of the method is that it relies heavily on a good crossover function and those might take some time and expertise to develop.

Some other improvements that might have proved slightly trickier than those previously mentioned is the implementation of moons as well as finding other solutions to the CPR3BP (such as non-planar Vertical orbits and Halo orbits [6]). Both of these additions are likely to heavily add to the running time of the code, which is why they were excluded, but they would also increase the proba- bility of finding suitable chaotic low-fuel trajectories, which ultimately was the purpose of this study.

A more substantial change would be to implement support for low-thrust tra- jectories, either as a complement to high thrust or replacing it. This is most likely the change that would convert Cassandra to a code capable of actually aiding in the process of designing deep space missions. However such a change is well beyond the scope of this study, since low-thrust trajectories are a lot more computationally expensive and require a huge number of parameters in order to be determined. There is (as of writing this) no commonly used model such as the MGA model for low thrust, since this is still a new and ongoing area of

33 study [27, 38, 37].

References

[1] Selim Akl and Marius Nagy. Introduction to Parallel Computation. In Roman Trobec, Marian Vajtersic, and Peter Zinterhof, editors, Parallel Computing: Numerics, Applications, and Trends, chapter 2, pages 43–80. Springer, first edition, 2009.

[2] Gene Amdahl. Validity of the single processor approach to achieving large scale computing capabilities. In AFIPS spring joint computer conference, number 2010, pages 1–15, 1967. [3] Autodesk Inc. Generative Design at Airbus, 2016.

[4] John T. Betts. Survey of Numerical Methods for Trajectory Optimization. Journal of Guidance, Control, and Dynamics, 21(2):193–207, 1998. [5] J.-P. Bibring, M. G. G. T. Taylor, C. Alexander, U. Auster, J. Biele, A. Er- coli Finzi, F. Goesmann, G. Klingelhoefer, W. Kofman, S. Mottola, K. J. Seidensticker, T. Spohn, and I. Wrigh. Philae’s First Days on the Comet. Science, 349(6247):493, 2015. [6] R. C. Calleja, E. J. Doedel, A. R. Humphries, A. Lemus, and B. E. Olde- man. Computing Invariant Manifolds and Connecting Orbits in the Circu- lar Restricted Three Body Problem. arXiv preprint, pages 1–25, 2011. [7] Marco Dorigo and L.M. Gambardella. Ant colony system: a cooperative learning approach to the traveling salesman problem. IEEE Transactions on Evolutionary Computation, 1(1):53–66, 1997. [8] Marco Dorigo, Birattari Mauro, and Thomas Stutzle. Ant Colony Op- timization : Overview and Recent Advances. IRIDIA – TECHNICAL REPORT SERIES, (May), 2009.

[9] Erwin Fehlberg. Low-order classical Runge-Kutta formulas with step size control and their application to some heat transfer problems. Technical Report July, 1969. [10] Hermann Glassmeier, Karl-Heinz Boehnhardt, Detlef Koschny, Ekkehard K¨uhrt, and Ingo Richter. The Rosetta Mission: Flying Towards the Origin of the Solar System. Space Science Reviews, 128(1):1–21, 2007. [11] D.A. Godfrey. A hexagonal feature around Saturn’s north pole. Icarus, 76(2):335–356, 1988. [12] V M Guibout and D J Scheeres. Periodic orbits from generating functions. Advances in the Astronautical Sciences, 116(2):1029–1048, 2004. [13] Gregory S Hornby, Al Globus, Derek S Linden, and Jason D Lohn. Au- tomated antenna design with evolutionary algorithms. Proc. AIAA Space Conference, 5:1–8, 2006.

34 [14] K Howell and H Pernicka. Numerical determination of Lissajous trajectories in the restricted three-body problem. , 41(1):107–124, 1986. [15] D. Izzo, V. M. Becerra, D. R. Myatt, S. J. Nasuto, and J. M. Bishop. Search space pruning and global optimisation of multiple gravity assist spacecraft trajectories. Journal of Global Optimization, 38(2):283–296, 2007. [16] Dario Izzo. Revisiting Lambert’s Problem. Celestial Mechanics and Dy- namical Astronomy, pages 1–15, 2014. [17] Min Kong, Peng Tian, and Yucheng Kao. A new ant colony optimization algorithm for the multidimensional Knapsack problem. Computers and Operations Research, 35(8):2672–2683, 2008. [18] Wang Koon, Martin Lo, Jerrold Marsden, and Shane Ross. Dynamical Systems, the Three-Body Problem and Space Mission Design. 1.2 edition, 2011. [19] Tarig Faisala Mahmud Iwana, R. Akmeliawatib and Hayder M A A Al- Assadi. Performance comparison of di↵erential evolution and particle swarm optimization in constrained optimization. International Symposium on Robotics and Intelligent Sensors 2012, 2012. [20] Christopher Martin and Bruce Conway. Optimal Low-Thrust Trajectories Using Stable Manifolds. In Bruce Conway, editor, Spacecraft Trajectory Op- timization, chapter 9, pages 238–262. Cambridge Press, 1:st paper edition, 2010. [21] J. Barrie Moss and John Stark. Propulsion Systems. In Spacecraft Systems Engineering, chapter 6, pages 177–220. 2011. [22] Nasa. Voyager Enters Interstellar Space, 2013. [23] Frank Neumann and Carsten Witt. Ant Colony Optimization and the min- imum spanning tree problem. Theoretical Computer Science, 411(25):2406– 2413, 2010. [24] Nvidia. Nvidia CUDA C Programming Guide Version 4.2. page 173, 2012. [25] Hermann Oberth. Ways to Spaceflight. 1972. [26] Westwic Peter J. Into the Black: JPL and the American Space Program. Yale University Press, 2007. [27] Anastassios E. Petropoulos and James M. Longuski. A shape-based algo- rithm for the automated design of low-thrust, gravity-assist trajectories. Advances in the Astronautical Sciences, 109 III(5):2321–2336, 2002. [28] Mauro Pontani and Bruce Conway. Swarming Theory Applied to Space Tra- jectory Optimization. In Spacecraft Trajectory Optimization, chapter 10, pages 263–293. Cambridge University Press, first pape edition, 2010. [29] John Prussing. Primer Vector Theory and Applications. In Bruce Con- way, editor, Spacecraft Trajectory Optimization, chapter 2, pages 16–36. Cambridge University Press, 1:st paper edition, 2010.

35 [30] Da Qi Ren. Algorithm level power eciency optimization for CPUGPU processing element in data intensive SIMD/SPMD computing. Journal of Parallel and Distributed Computing, 71(2):245–253, 2011.

[31] Yuan Ren, Josep J. Masdemont, Gerard G??mez, and Elena Fantino. Two mechanisms of natural transport in the Solar System. Communications in Nonlinear Science and Numerical Simulation, 17(2):844–853, 2012. [32] David Richardsson. Analytic construction of periodic orbits about the collinear points. Celestial mechanics, 22(3):241–253, 1980. [33] J. Robinson and Y. Rahmat-Samii. Particle swarm optimization in electro- magnetics. IEEE Transactions on Antennas and Propagation, 52(2):397– 407, 2004. [34] E M Standish. Keplerian Elements for Approximate Positions of the Major Planets. Technical report, JPL / Caltech, 2011. [35] John Stark, Graham Swinerd, and Peter Fortescue. Celestial Mechanics. In Spacecraft System Engineering, chapter 4, pages 79–110. John Wiley & Sons, fourth edition, 2011.

[36] S. A. Stern, F. Bagenal, K. Ennico, G. R. Gladstone, and W. M. Grundy. The Pluto system: Initial results from its exploration by . Science, 350(6258), 2015. [37] Ehsan Taheri and Ossama Abdelkhalik. Shape Based Approximation of Constrained Low-Thrust Space Trajectories Using Fourier Series. Journal of Spacecraft and Rockets, 49(3), 2012. [38] Bradley Wall and Bruce Conway. Shape-Based Approach to Low-Thrust Rendezvous Trajectory Design. Journal of Guidance, Control, and Dynam- ics, 32(1), 2009. [39] M.H. Willebeek-LeMair and A.P. Reeves. Strategies for dynamic load bal- ancing on highly parallel computers. IEEE Transactions on Parallel and Distributed Systems, 4(9):979–993, 1993. [40] Alexander Wittig, Viktor Wase, and Dario Izzo. On the Use of GPUs for Massively Parallel Optimization of Low-Thrust Trajectories. 6:th Interna- tional Conference on Astrodynamics Tools and Techniques, 2016.

36