Genetic optimization of the Hyperloop route through the Grapevine
Casey J. Handmer
350-17
California Institute of Technology
Pasadena
California 91125
USA
We demonstrate a genetic algorithm that employs a versatile fitness function to optimize route selection for the Hyperloop, a proposed high speed passenger transportation system.
HyperloopPaper.tex
\documentclass[12pt]{iopart}

\expandafter\let\csname equation*\endcsname\relax
\expandafter\let\csname endequation*\endcsname\relax
\usepackage{amsmath} 
\usepackage{amssymb} 
\usepackage{hyperref}
\usepackage{graphicx} 
\usepackage{mathrsfs} 
\usepackage{fullpage}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{ulem}

\usepackage{caption}
\usepackage{subcaption}

\usepackage{pdfpages}

\numberwithin{equation}{section}

\begin{document}

\title{Genetic optimization of the Hyperloop route through the Grapevine}
\author{Casey J. Handmer\\
  350-17, California Institute of Technology, Pasadena, California
  91125, USA}
\ead{chandmer@caltech.edu}

\begin{abstract}
We demonstrate a genetic algorithm that employs a versatile fitness function to optimize route selection for the Hyperloop, a proposed high speed passenger transportation system.
\end{abstract}

\section{The Hyperloop and the Grapevine: an awkward relationship}

The Hyperloop is a proposed rapid transportation system ideally suited to linking two metropolitan areas separated by between 200km and 1500km, such as Los Angeles and San Francisco~\cite{HyperloopWP}. Employing an elevated steel tube with reduced pressure, the Hyperloop is intended to reduce travel times between these two cities to around 30 minutes. 

\begin{figure}[h!]
  \centering
  \includegraphics[width=0.8\textwidth]{GrapevineGoogle.png}
  \caption{\small{Google maps screen grab of the Grapevine region, showing the I5 corridor and relief. The Hyperloop must traverse these mountains between lower right and upper left.}}
  \label{fig:Init}
\end{figure}

While the majority of the projected route follows the relatively straight Interstate 5 (I5) through the California central valley, entering the LA basin presents a more formidable challenge. Indeed, the existing rail transportation corridor must detour through the Tehachapi and Cajon passes. The I5 passes through a series of steep valleys between Santa Clarita and Tejon ranch, making several sharp turns. Ideally, the Hyperloop should follow a similar path, with bridges and tunnels smoothing the kinks enough to ensure passenger comfort even while travelling up to ten times faster than a car.

In practice, passenger discomfort can be avoided by making sufficiently gentle turns. The minimum radius of curvature is given by 
\begin{equation}
r_{min} = v^2/a_{max}\;.
\end{equation}
At a projected maximum speed of 1,220km/h (339m/s) and a maximum lateral acceleration of half a \(g\), \(r_{min} = 23.4\)km. Needless to say, the center of curvature must also smoothly vary---it wouldn't do to rattle passengers back and forth every second. The Hyperloop is proposed to traverse these hills and bends at a slower speed, but maximizing the minimum radius of curvature is still strongly favored.

The problem is thus defined. Bridges and tunnels are expensive. The region's geography is highly non-trivial. The route must employ gentle turns, ideally no less than 23.4km radius of curvature. This problem has an absurdly high dimensionality, and is thus well suited to the application of genetic algorithms: the second-best algorithm to solve any problem. 

\section{How to design a non-terrible genetic algorithm}

Genetic algorithms are not necessarily a cure-all. As anyone who has reproduced can tell you, genetics is a complicated business. The following elements are necessary, but not necessarily sufficient, to create a genetic algorithm that doesn't waste everyone's time~\cite{PiTPlecture}.

\subsection{Tight linkage}
Genetic algorithms use a genetic code, or genome, to parametrize a particular proposed solution. It is necessary to pick a representation that is sufficiently dense that phenotype (the physical nature of the proposal) is actually related to genotype (it's coded form). There is an art to it, and we found that a Bezier curve~\cite{Bezier}, parametrized by a set of order 10 control points, was ideal for this purpose. In essence, each genome contains a single gene.

\subsection{Useful diversity}
A genetic algorithm that introduces too much mutation in each generation is equivalent to a random search, and thus hopelessly inefficient. Conversely, too little or too limited mutation will result in premature stagnation with no exploration of the solution space. Some algorithms can dynamically vary mutation parameters. Similarly, an algorithm that begins with, say, 100 different genomes will quickly eliminate the weaker ones, narrowing an already limited gene pool. To avoid stagnation due to inbreeding, one can introduce a small number of new, randomly generated genomes at every generation.

\subsection{Good variation operators}
In addition to tweaking mutation parameters and ensuring a steady flow of new genetic material into the system, genetic algorithms must also perform crossover. Sometimes known as ``the fun part'', crossover occurs where two selected genomes mix their parameters to create the next generation. Mutation is typically introduced at this stage.

\subsection{A good fitness function}
This is the hardest part. A well designed genetic algorithm will find an optimal solution to the stated problem. If the problem is poorly stated, through poor design of a fitness function, then the solution will be unsatisfying. In the Hyperloop problem, there are several metrics to optimize, including cost, curvature, and maximum grade. Constructing a multidimensional Pareto front is preferable to an arbitrarily chosen weighted average. In more complicated problems, co-evolving fitness criteria is necessary to find a suitable global solution. In this instance, comparing the genome fitness with randomly generated sequences is a good way to normalize between generations.

\section{Technical implementation}
We implemented the Hyperloop routing genetic algorithm in {\it Mathematica}, included in Appendix~A. For the purposes of routing, we chose to start at the I5-I405 interchange near Granada Hills (GPS:34.29,-118.47) and end at the Tesla Supercharger in Tejon Ranch (GPS:34.99,-118.95).

\subsection{Geodata}
Geodata was obtained from the USGS website~\cite{USGS}, corresponding to the n35w119 graticule with 1 arc-second resolution in ArcGrid format.

\subsection{Fitness function}
Our fitness function assumed a constant cost per length of tunnel, and a cost for bridges or pylons that scaled with both height and length. Mathematically expressed, cost in \$/m is
\begin{align}
cost_{pylon} &= 116 h_{pylon}^2 \;,\\
cost_{tunnel} &= 310000 \;.
\end{align}
For a typical pylon height of 6m, this gives a cost per km of \$4.2m. For tunnels, the whitepaper's suggestion of \$31m/km is probably an order of magnitude too low as the Hyperloop will require at least two vacuum tunnels and a service tunnel~\cite{tunnelcost}. Additionally, the route has to cross the San Gabriel,  San Andreas, and Garlock faults, increasing geological complexity. We used a cost of \$310m/km. It is worth noting that placement of an optimal corridor is not highly sensitive to cost-function parameters.

The constraint on radius of curvature and maximum grade (6\%) was applied by calculating both using finite differences and then applying a steep penalty cost if limits were exceeded.

\subsection{Initialization}

The population is initialized with a specified number (we used 200) of genomes. Genomes are generated by randomly generating control points within the space. A specialized function converts them to a physical path from which metrics can be calculated. One such initial condition is shown in Fig.~\ref{fig:Init}. This population is entirely suboptimal, with paths that do not remotely follow the landscape, involve sharp turns, and pylons or bridges that vastly exceed today's engineering capability. Within a hundred generations of the algorithm, however, the evolved population will be much better suited to the problem landscape.

\begin{figure}[h!]
  \centering
  \includegraphics[width=0.8\textwidth]{HyperloopBezierGeneticPathPlot.png}
  \caption{\small{Relief map showing a subset of the initial population superposed on the relevant geography. The vertical scale is greatly exaggerated, distances are in meters.}}
  \label{fig:Init}
\end{figure}

\section{Results}

We found two solution classes that were locally optimal. The first underlines the challenges of using genetic algorithms, wherein a simulation found a simple straight tunnel 300m above sea level through the entire range.

The other, much more interesting solution set initially follows the I5 corridor north, before diverting to the east over Castaic Lake, cutting across the western extremity of Antelope Valley and finally returning to the surface of the central valley. This solution is shown in Figs.~\ref{fig:Relief} and~\ref{fig:Profile}.

It features a minimum curvature radius of 20km, a mean pylon height of 22m, a total tunnel length of 48km, and a maximum subsurface depth of 738m. A nearby variant shown in Appendix A achieves a minimum curvature radius of 23.5km for the use of 54km of tunnels---enabling transit through the Grapevine without slowing until the destination.

\begin{figure}[h!]
  \centering
  \includegraphics[width=0.8\textwidth]{HyperloopBezierGeneticReliefPlot.pdf}
  \caption{\small{Diagram showing proposed route on a relief map.}}
  \label{fig:Relief}
\end{figure}

\begin{figure}[h!]
  \centering
  \includegraphics[width=0.8\textwidth]{HyperloopBezierGeneticProfilePlot.pdf}
  \caption{\small{Diagram showing profile of route, with implied bridges and tunnels. Distances in meters, vertical scale exaggerated by a factor of 73.}}
  \label{fig:Profile}
\end{figure}

\section{Conclusion}
We have applied a genetic algorithm to solve a high dimensionality optimization problem. We have found a route for the Hyperloop through the Grapevine that permits a transit speed of 1130km/h (314m/s), reducing transit time by 139 seconds compared to that proposed in the whitepaper. More importantly, we have demonstrated the viability of an evolutionary approach to high speed transport route finding in general.

\section*{References}

\begin{thebibliography}{9}

\bibitem{HyperloopWP}
  \url{http://www.spacex.com/sites/spacex/files/hyperloop_alpha-20130812.pdf} 
  Accessed March 2 2015.

\bibitem{PiTPlecture}
  Lipson, Hod. ``Co-Evolutionary Learning: Distilling Free-Form Natural Laws from Experimental Data.'' Prospects in Theoretical Physics. IAS, Princeton, NJ. 20 July 2012. Lecture.

\bibitem{Bezier}
  \url{http://en.wikipedia.org/wiki/Bezier_curve}
  Accessed March 2 2015.

\bibitem{USGS}
  USGS data is available at the National Map Viewer.
  \url{http://viewer.nationalmap.gov}

\bibitem{tunnelcost}
  \url{https://pedestrianobservations.wordpress.com/2011/05/16/us-rail-construction-costs/} 
  Accessed March 2 2015.

\end{thebibliography}

\section*{Appendix A}

\includepdf[pages={1,2,3,4,5,6,7,8,9}]{HyperloopBezierGeneticPublish2.pdf}

\end{document}

1503.01524.extracted_bib
{HyperloopWP \url{http://www.spacex.com/sites/spacex/files/hyperloop_alpha-20130812.pdf Accessed March 2 2015.
1503.01524.extracted_bib
{PiTPlecture Lipson, Hod. ``Co-Evolutionary Learning: Distilling Free-Form Natural Laws from Experimental Data.'' Prospects in Theoretical Physics. IAS, Princeton, NJ. 20 July 2012. Lecture.
1503.01524.extracted_bib
{Bezier \url{http://en.wikipedia.org/wiki/Bezier_curve Accessed March 2 2015.
1503.01524.extracted_bib
{USGS USGS data is available at the National Map Viewer. \url{http://viewer.nationalmap.gov
1503.01524.extracted_bib
{tunnelcost \url{https://pedestrianobservations.wordpress.com/2011/05/16/us-rail-construction-costs/ Accessed March 2 2015.