Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Pre-final read over: major progress all around
Browse files Browse the repository at this point in the history
  • Loading branch information
mossr committed Apr 30, 2021
1 parent 7254cdc commit 520ae77
Show file tree
Hide file tree
Showing 38 changed files with 1,301 additions and 3,243 deletions.
36 changes: 36 additions & 0 deletions MSCS-TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
TODO:
[x] combine references.bib
[x] See Dorsa notes
[ ] See Mykel notes
[x] Subsections for tooling: CrossEntropyVariants.jl and FailureRepresentation.jl
[x] Combine Acknowledgments
[x] "dissertation" wording in the signatures page
[x] Remove "graduate studies" committee?


Mykel notes:
[x] Concatenate research papers from MS (if they're related work / extensions)
[x] Add introduction
[ ] Flow together body chapters
[ ] Remove redundancies between them
[x] Change conclusions/future work into discussion
- Two big things:
[x] 1) intro chapter
[x] shortest intro chapter possible (concise)
[x] "freshman undergrad could understand contributions"
[x] 2) final chapter
[x] one section "Summary" high level, no jargon, no non-sense
[x] second section "Contributions", summarize how you've supported your claims (back references, specialized terminology)
[x] third: future work
[x] https://www2.eecs.berkeley.edu/Pubs/Theses/
[x] Fix \texttt to use old monofont
[x] Move JuliaMono font files.
[x] Page header to be small caps
[x] POMDPStressTesting.jl Acknowledgments moved to main Acknowledgments (TRPO/PPO)
[x] Check for duplicate references
[x] Comb through references (you know Mykel will)
[x] Appendix reformatting (figures/fix overflow)
[ ] Clean everything up
[ ] Publically release __after__ approved by Stanford.
[x] Algorithm size \small:
https://tex.stackexchange.com/questions/435649/algorithm-caption-size-reduction
13 changes: 13 additions & 0 deletions algorithms/ce-surrogate.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
\begin{lstlisting}[language=JuliaLocal]
function ce_surrogate(S, 𝐌; m, m_elite, k_max)
for k in 1:k_max
mₑ, m_elite = evaluation_schedule(k, k_max) # number of evaluations from a schedule
𝐗 = rand(𝐌, mₑ) # draw mₑ samples from 𝐌
𝐘 = map(S, eachcol(𝐗)) # evaluate samples 𝐗 using true objective S
𝐞 = 𝐗[:, sortperm(𝐘)[1:m_elite]] # select elite samples output from true objective
𝐄 = model_elite_set!(𝐗, 𝐘, 𝐌, 𝐞, m, m_elite) # find model-elites using a surrogate
𝐌 = fit(𝐌, 𝐄) # re-fit distribution 𝐌 using model-elite samples
end
return 𝐌
end
\end{lstlisting}
11 changes: 0 additions & 11 deletions algorithms/ce_surrogate.jl

This file was deleted.

5 changes: 5 additions & 0 deletions algorithms/cem-variants-functions.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
\begin{lstlisting}[language=JuliaLocal]
𝐌′ = cross_entropy_method(S, 𝐌) # standard CEM
𝐌′ = ce_surrogate(S, 𝐌) # surrogate-based CEM
𝐌′ = ce_mixture(S, 𝐌) # surrogate-based CEM using mixture models
\end{lstlisting}
6 changes: 6 additions & 0 deletions algorithms/cem-variants-usage-basis.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
\begin{lstlisting}[language=JuliaLocal]
S = paraboloid # objective function
𝐌 = MvNormal([0, 0], [200 0; 0 200]) # proposal distribution

(𝐌, bestₓ, bestᵥ) = ce_surrogate(S, 𝐌; basis=:squared)
\end{lstlisting}
11 changes: 11 additions & 0 deletions algorithms/cem-variants-usage.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
\begin{lstlisting}[language=JuliaLocal]
using CrossEntropyVariants
using Distributions

S = sierra # objective function
𝛍 = [0, 0] # initial mean
𝚺 = [200 0; 0 200] # initial covariance
𝐌 = MvNormal(𝛍, 𝚺) # proposal distribution

(𝐌, bestₓ, bestᵥ) = ce_surrogate(S, 𝐌)
\end{lstlisting}
26 changes: 11 additions & 15 deletions algorithms/mcts-pw-algorithm-part2.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
% \vspace{-2.5mm}
\begin{algorithm}[!ht]
\caption{Monte Carlo tree search simulation.}
\captionsetup{font=small}
\small
\caption{Monte Carlo tree search simulation.}
\label{alg:mcts-pw-simulate}
\begin{algorithmic}
\Function{Simulate$(s, d)$}{}
Expand All @@ -23,23 +24,21 @@
\end{algorithmic}
\end{algorithm}
%
% \vspace{-2.5mm}
\begin{algorithm}[!ht]
\captionsetup{font=small}
\small
\caption{Modified rollout with end-of-depth evaluation.}
\label{alg:mcts-pw-rollout}
\begin{algorithmic}
\Function{Rollout$(s,d)$}{}
\If {$d = 0$}
\State $(p, e, d) \leftarrow \textproc{Evaluate}(s)$
\State $\tau \leftarrow \textproc{IsTerminal}(s)$
% \State $(\bar{a},s^\prime) \leftarrow \textproc{Evaluate}(s)$
\State $\bar{a}^* \leftarrow \textproc{UpdateBestAction}(s,Q)$
\State \Return $R(p,e,d,\tau)$
% \State \Return $R(s,\bar{a},s^\prime)$
\ElsIf {$d = \floor{d_\text{max}/2}$}
\State $\bar{a} \leftarrow \bar{a}^*$ \algorithmiccomment{feed best action}
\Else
% \State $\bar{a} \sim \mathbb{U}$ \algorithmiccomment{sample seed uniformly}
\State $\bar{a} \leftarrow \textproc{SampleAction}(s,Q)$
\EndIf
\State $(s^\prime, r) \sim G(s,\bar{a})$
Expand All @@ -49,13 +48,14 @@
\end{algorithm}
%
\begin{algorithm}[!ht]
\captionsetup{font=small}
\small
\caption{Action selection with progressive widening.}
\label{alg:mcts-pw-action-widen}
\begin{algorithmic}
\Function{SelectAction$(s)$}{}
\If {$| A(s) | \le kN(s)^\alpha$}
\State $\bar{a} \leftarrow \textproc{SampleAction}(s,Q)$
% \State $\bar{a} \sim \mathbb{U}$ \algorithmiccomment{sample seed uniformly}
\State $(N(s,\bar{a}), Q(s,\bar{a})) \leftarrow (N_0(s,\bar{a}), Q_0(s,\bar{a}))$
\State $A(s) \leftarrow A(s) \cup \{\bar{a}\}$
\EndIf
Expand All @@ -65,25 +65,21 @@
\end{algorithm}
%
\begin{algorithm}[!ht]
\caption{Single deterministic next state.}
\captionsetup{font=small}
\small
\caption{Single deterministic next state.}
\label{alg:mcts-pw-deterministic-state}
\begin{algorithmic}
\Function{DeterministicStep$(s,\bar{a})$}{}
\If {$N(s,\bar{a},\cdot) = \emptyset$}
\State $(s^\prime, r) \sim G(s,\bar{a})$
% \State $R(s,\bar{a},s^\prime) \leftarrow r$
\State $\textproc{SetCache}(s, \bar{a}, s^\prime, r)$
\State $N(s,\bar{a},s^\prime) \leftarrow N_0(s,\bar{a},s^\prime)$
\Else
% \State $s^\prime \leftarrow \arg_{s^\prime} N(s,\bar{a},\cdot)$
% \State $(s^\prime, r) \leftarrow (\textproc{CachedNextState}(s,\bar{a}), R(s,\bar{a},s^\prime))$
% \State $(s^\prime, r) \leftarrow \textproc{CachedNextState}(s,\bar{a})$
\State $(s^\prime, r) \leftarrow \textproc{GetCache}(s,\bar{a})$
% \State $s^\prime \leftarrow (\cdot)$
% \State $r \leftarrow R(s,\bar{a},s^\prime)$
\State $N(s,\bar{a},s^\prime) \leftarrow N(s,\bar{a},s^\prime)+1$
\EndIf
\State \Return $(s^\prime,r)$
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{algorithm}
3 changes: 2 additions & 1 deletion algorithms/mcts-pw-algorithm.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
%
\begin{algorithm}[!ht]
\captionsetup{font=small}
\small
\caption{Top-level Monte Carlo tree search algorithm.}
\label{alg:mcts-pw}
\begin{algorithmic}
Expand Down
8 changes: 3 additions & 5 deletions algorithms/monte-carlo-algorithm.tex
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
\algtext*{EndLoop}% Remove "end _X_" text
\algtext*{EndIf}
\algtext*{EndFor}
\algtext*{EndFunction}
\begin{algorithm}[th!]
\captionsetup{font=small}
\small
\caption{Direct Monte Carlo simulation.}
\label{alg:mc}
\begin{algorithmic}
Expand All @@ -13,4 +11,4 @@
\EndFor
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{algorithm}
13 changes: 13 additions & 0 deletions algorithms/pomdp-stress-testing-interface.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
\begin{lstlisting}[language=JuliaLocal]
# GrayBox simulator and environment
abstract type GrayBox.Simulation end
function GrayBox.environment(sim::Simulation)::GrayBox.Environment end
function GrayBox.transition!(sim::Simulation)::Real end

# BlackBox.interface(input::InputType)::OutputType
function BlackBox.initialize!(sim::Simulation)::Nothing end
function BlackBox.evaluate!(sim::Simulation)::Tuple{Real, Real, Bool} end
function BlackBox.distance(sim::Simulation)::Real end
function BlackBox.isevent(sim::Simulation)::Bool end
function BlackBox.isterminal(sim::Simulation)::Bool end
\end{lstlisting}
53 changes: 8 additions & 45 deletions appendices/episodic_ast_appendix.tex
Original file line number Diff line number Diff line change
@@ -1,43 +1,24 @@
% "and Miss Distances"
\chapter{Alternative FMS Failure Events}\label{sec:application_events}
This section details alternative failure events investigated and their associated miss distance calculations.
This section details alternative failure events investigated and their associated miss distance calculations when stress testing the trajectory predictions in a flight management system (FMS).
Ultimately, analysis of these failure events showed their inadequacy and arc length failures were selected as the primary event.

\section{Tangency Kinks}
Tangency kinks arise when a small angle threshold is exceeded between the inbound straight segment and the tangent of the turn segment at a given waypoint. The failure event occurs when this angle difference $\theta$ is above the threshold $\tau_k = 0.001$ \si{\radian}.

\begin{figure}[!ht]
\centering
\resizebox{0.6\columnwidth}{!}{\input{diagrams/tangent-angle.tex}}
\resizebox{0.5\columnwidth}{!}{\input{diagrams/tangent-angle.tex}}
\caption{Tangency kink failure event and miss distance.}
\label{fig:tangency_kink}
\end{figure}

Miss distance for the tangency kinks is calculated by first determining the azimuth angle $z$ between the start point of the arc $s$ and the center point $c$. The azimuth is calculated using a WGS84 Earth flattening leveraging the Geodesic.jl\footnote{\url{https://github.com/anowacki/Geodesics.jl}} package which implements Vincenty's formula \cite{vincenty}. The tangency angle $\theta$ is then calculated for each $\ell \in L$ where $L$ is the set of lateral packets that each have a straight segment and a turn arc with radius $r$. The sign of the radius $r$ indicates the direction of turn, where left is negative and right is positive. The course-in angle of the straight segment $\ell$ is denoted $\angle \ell$,
% \begin{align*}
% U(\phi) &= \arctan((1 - f) \tan \phi))\\
% (U_s, U_c) &= (U(\phi_s),\, U(\phi_c))
% \end{align*}
%
% \begin{align*}
% \lambda = \Lambda(L, f)
% \end{align*}
% https://github.com/anowacki/Geodesics.jl
%
% \begin{align*}
% % https://en.wikipedia.org/wiki/Vincenty%27s_formulae#Inverse_problem
% % Inverse problem
% % 1. Vincenty, T. (1975). "Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of nested equations" (PDF). Survey Review. XXIII (176): 88–93. doi:10.1179/sre.1975.23.176.88
% z = \arctan(\cos U_c \sin \lambda,\, \cos U_s \sin U_c - \sin U_s \cos U_c \cos \lambda)
% % \alpha_c = \arctan(\cos U_s \sin \lambda,\, -\sin U_s \cos U_c + \cos U_s \sin U_c \cos \lambda)
% \end{align*}
%
Miss distance for the tangency kinks is calculated by first determining the azimuth angle $z$ between the start point of the arc $s$ and the center point $c$. The azimuth is calculated using a WGS84 Earth flattening leveraging the Geodesic.jl\footnote{\url{https://github.com/anowacki/Geodesics.jl}} package which implements Vincenty's formula \cite{vincenty}. The tangency angle $\theta$ is then calculated for each $\ell \in L$ where $L$ is the set of lateral packets that each have a straight segment and a turn arc with radius $r$. The sign of the radius $r$ indicates the direction of turn, where left is negative and right is positive. The course-in angle of the straight segment $\ell$ is denoted $\angle \ell$, which we then get a distance metric of:
\begin{equation*}
% d = \tau_k - \max\left\{ \abs{z - \angle \ell + \sign(r)\frac{\pi}{2}} : (\ell,r) \in L \right\}.
d = \tau_k - \max\limits_{(\ell,r) \in L} \abs{z - \angle \ell + \sign(r)\frac{\pi}{2}}.
d = \tau_k - \max\limits_{(\ell,r) \in L} \abs{z - \angle \ell + \sign(r)\frac{\pi}{2}}
\end{equation*}
\phantom{}


\vspace{-6mm}
\section{Course Directions}
In-bound and out-bound course directions may deviate from one another and can be classified as a failure event.
Closely related to the \textit{disconnection} failure event, the course direction failures can arise when two sequential lateral packets are disconnected. This failure specifically looks for angle differences between the course-out $\theta_{\text{out}}$ and course-in $\theta_\text{in}$ directions of the sequential lateral packets. If this angle difference $\omega = \abs{\theta_\text{out} - \theta_\text{in}}$ is above the threshold $\tau_c = 1\si{\degree}$ then it is classified as a failure.
Expand All @@ -51,20 +32,9 @@ \section{Course Directions}

Miss distance is calculated as how close to the threshold $\tau_c$ is the maximum wrapped angle difference between the course-out angle and course-in angle denoted by $\omega$, namely
\begin{equation*}
% d = \tau_c - \max\left\{ \abs{\theta_\text{out} - \theta_\text{in}} : \theta_\text{out} \in L_i, \theta_\text{in} \in L_{i+1} \right\}.
% d = \tau_c - \max\limits_{\theta_\text{out} \in L_i, \theta_\text{in} \in L_{i+1}}\abs{\theta_\text{out} - \theta_\text{in}}.
d = \tau_c - \max\limits_{\substack{\theta_\text{out} \in L_i\\\theta_\text{in} \in L_{i+1}}}\abs{\theta_\text{out} - \theta_\text{in}}.
d = \tau_c - \max\limits_{\substack{\theta_\text{out} \in L_i\\\theta_\text{in} \in L_{i+1}}}\abs{\theta_\text{out} - \theta_\text{in}}.
\end{equation*}

% \begin{itemize}
% \item Explain how tangent angle is calculated
% \item Talk about WGS84 flattening
% \item Mention Vincenty's inverse formula, Karney's inverse formula, and cite comparison paper (get papers, \textit{GEODESIC ALGORITHMS: AN EXPERIMENTAL STUDY})
% \item Describe all variables used ($r = \text{radius}$, etc)
% \item Update how the angle is calculated based on Nick's adjustments
% \end{itemize}


\section{Disconnections}
Disconnected lateral packets occur when two sequential lateral packets are not connected end-to-start, thus leaving a distance $\delta$ between them. If this geodesic distance $\delta = \lVert e_i - p_{i+1} \rVert$ is above the threshold $\tau_d = 10$ \si{ft} then a failure occurred.

Expand All @@ -77,12 +47,5 @@ \section{Disconnections}

Miss distance is calculated as the threshold $\tau_d$ minus the maximum distance between the end points $e_i$ (or $s_i$ if no arc is provided) and the initial point $p_{i+1}$ of the next lateral packet:
\begin{equation*}
% d = \tau_d - \max\left\{ \lVert e_i - p_{i+1} \rVert : (e_i,p_{i+1}) \in L \right\}.
% d = \tau_d - \max\limits_{(e_i,p_{i+1}) \in L}\lVert e_i - p_{i+1} \rVert.
% d = \tau_d - \max\limits_{e_i \in L_i, p_{i+1} \in L_{i+1}}\lVert e_i - p_{i+1} \rVert.
d = \tau_d - \max\limits_{\substack{e_i \in L_i\\p_{i+1} \in L_{i+1}}}\lVert e_i - p_{i+1} \rVert
d = \tau_d - \max\limits_{\substack{e_i \in L_i\\p_{i+1} \in L_{i+1}}}\lVert e_i - p_{i+1} \rVert
\end{equation*}


% We use the modified reward function that incorporates severity based on the miss distance at the time of an event.
% For our four miss distances described above, we want to reward egregious miss distances, thus finding events that are more severe.
Loading

0 comments on commit 520ae77

Please sign in to comment.