-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththesis-ch03-lazysp.tex
1586 lines (1464 loc) · 64.5 KB
/
thesis-ch03-lazysp.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\chapter{Fast Pathfinding on Graphs via Lazy Evaluation}
\label{chap:lazysp}
The roadmap methods described in Chapter~\ref{chap:roadmaps}
create a discretization of the configuration space using
a graph $G = (V,E)$.
This allows the motion planning problem to be solved by way of
a pathfinding algorithm on $G$
-- and there are a large variety of such algorithms available
in the literature to choose from.
However,
the computational efficiency of suitable algorithms
depends intimately on the underlying problem domain.
In this chapter,
we consider the general shortest path problem
with a particular focus on domains (such as robot motion planning)
where evaluating the edge weight function
dominates algorithm running time.
Inspired by lazy approaches in robotics,
we define and investigate the \emph{Lazy Shortest Path} class of
algorithms which is differentiated by the choice of
an \emph{edge selector} function.
We show that several algorithms in the literature are equivalent to
this lazy algorithm for appropriate choice of this selector.
Further, we propose various novel selectors inspired by
sampling and statistical mechanics,
and find that these selectors outperform
existing algorithms on a set of example problems.
\begin{figure}
\centering
\begin{tikzpicture}
\tikzset{>=latex} % arrow heads
%\draw[step=1cm,black!10,very thin] (0,0) grid (8,4);
\node[draw,align=center,minimum height=1.0cm,thick]
at (2.5,2.5) {Graph\\$G=(V,E)$};
\node[draw,align=center,minimum height=1.0cm,thick]
at (5.5,2.5) {Weight Function\\$w:E \rightarrow [0,+\infty]$};
\node[draw,align=center,minimum height=1.0cm,minimum width=3cm,thick]
(alg) at (4,1) {Shortest Path\\Algorithm};
\node[draw,align=center,shape=document,minimum width=1.5cm,ultra thin]
(query) at (1,1) {Query $u$};
\node[draw,align=center,shape=document,minimum width=1.5cm,ultra thin]
(path) at (7,1) {Path $p^*$};
\draw[->] (3,2) -- (3,1.5);
\draw[->] (5,2) -- (5,1.5);
\draw[->] (query.east) -- (alg.west);
\draw[->] (alg.east) -- (path.west);
\end{tikzpicture}
\caption{While solving a shortest path query,
a shortest path algorithm incurs computation cost from three sources:
examining the structure of the graph $G$,
evaluating the edge weight function $w$,
and maintaining internal data structures.}
\label{fig:sp-intro}
\end{figure}
\section{The Shortest Path Problem}
Graphs provide a powerful abstraction
capable of representing problems in a wide variety of domains
from computer networking to puzzle solving
to robotic motion planning.
%\ajnote{Way too vague and general -- disconnected from second sentence.
%Maybe mention ``standard problems'' on graphs.}
In particular,
many important problems can be captured
as \emph{shortest path problems} (Figure~\ref{fig:sp-intro}),
wherein a path $p^*$ of minimal length is sought
between two query vertices through a graph $G$
with respect to an edge weight function $w$.
%As such,
%a large number of algorithms have been proposed in the literature
%for solving shortest path problems efficiently.
Despite the expansive applicability of this single abstraction,
there exist a wide variety of algorithms in the literature
for solving the shortest path problem efficiently.
%\ajnote{You say ``despite'' but the second part seems to follow from
%the first.
%There are many solutions because there are many problems.}
This is because the measure of computational efficiency,
and therefore the correct choice of algorithm,
is inextricably tied to the underlying problem domain.
The computational costs incurred by an algorithm
can be broadly categorized into three sources
corresponding to the blocks in Figure~\ref{fig:sp-intro}.
One such source consists of queries on the structure
of the graph $G$ itself.
The most commonly discussed such operation,
\emph{expanding} a vertex (determining its successors),
is especially fundamental
%\ajnote{especially costly?}
when the graph is represented implicitly,
e.g. for domains with large graphs
such as the 15-puzzle or Rubik's cube.
It is with respect to vertex expansions
that A* \citep{hart1968astar} is optimally efficient.
A second source of computational cost consists of maintaining
ordered data structures inside the algorithm itself,
which is especially important for problems with large branching
factors.
For such domains,
approaches such as partial expansion \citep{yoshizumi2000peastar}
or iterative deepening \citep{korf1985idastar}
significantly reduce the number of vertices generated and stored
by either selectively filtering surplus vertices from the frontier,
or by not storing the frontier at all.
The third source of computational cost arises not from reasoning
over the structure of $G$,
but instead from evaluating the edge weight function $w$
(i.e. we treat discovering an out-edge and determining its weight
separately).
Consider for example the problem of articulated robotic motion planning
using roadmap methods \citep{kavrakietal1996prm}.
While these graphs are often quite small
(fewer than $10^5$ vertices),
determining the weight of each edge requires performing many
collision and distance computations for the complex geometry
of the robot and environment,
resulting in planning times of multiple seconds to find a path.
As described in Chapter~\ref{chap:roadmaps},
we consider problem domains in which evaluating the edge weight
function $w$ dominates algorithm running time.
In this chapter,
we investigate the following research question:
\begin{quote}
{\normalsize
How can we minimize the number of edges we need to evaluate
to answer shortest-path queries?
}
\end{quote}
We make three primary contributions.
First,
inspired by lazy collision checking techniques from
robotic motion planning \citep{bohlin2000lazyprm},
we formulate a class of shortest-path algorithms
that is well-suited to problem domains with expensive edge evaluations.
Second,
we show that several existing algorithms in the literature
can be expressed as special cases of this algorithm.
Third,
we show that the extensibility afforded by the algorithm allows for
novel edge evaluation strategies,
which can outperform existing algorithms
over a set of example problems.
\section{Lazy Shortest Path Algorithm}
We describe a lazy approach to finding short paths
which is well-suited to domains with
expensive edge evaluations.
\subsection{Problem Definition}
A path $p$ in a graph $G = (V,E)$
is composed of a sequence of adjacent edges
connecting two endpoint vertices.
Given an edge weight function
$w : E \rightarrow [0,+\infty]$,
the length of the path with respect to $w$ is then:
\begin{equation}
\mbox{len}(p, w) = \sum_{e \in p} w(e).
\label{eqn:lazysp:len-definition}
\end{equation}
Given a single-pair planning query
$u: (v_{\ms{start}}, \, v_{\ms{goal}})$
inducing a set of satisfying paths $P_u$,
the \emph{shortest-path problem} is:
\begin{equation}
p^* = \argmin_{p \, \in \, P_u} \mbox{len}(p, w).
\label{eqn:objective}
\end{equation}
A shortest-path algorithm computes a satisfying solution $p^*$
given $(G, u, w)$.
Many such algorithms have been proposed
to efficiently accommodate a wide array of underlying problem domains.
%(outlined in Section~\ref{sec:discussion}).
The well-known principle of best-first search (BFS)
is commonly employed to select vertices for expansion
so as to minimize such expansions while guaranteeing optimality.
Since we seek to minimize edge evaluations,
we apply BFS to the question of selecting candidate paths in
$G$ for evaluation.
The resulting algorithm, Lazy Shortest Path (LazySP),
is presented in Algorithm~\ref{alg:lazy-outline},
and can be applied to graphs defined implicitly or explicitly.
%\cdnote{To Sidd: You might not like this paragraph -- but I feel like
%going directly from the problem definition to the algorithm doesn't
%connect to the rationale strongly enough without it.
%What do you think?}
\subsection{The Algorithm}
\begin{algorithm}[t]
\caption{Lazy Shortest Path (LazySP)}
\label{alg:lazy-outline}
\begin{algorithmic}[1]
\Function {\textsc{LazyShortestPath}}{$G, u, w, w_{\ms{est}}$}
\State $E_{\ms{eval}} \leftarrow \emptyset$ %\Comment Initialize evaluated edges to empty
\State $w_{\ms{lazy}}(e) \leftarrow w_{\ms{est}}(e) \quad \forall e \in E$ %\Comment Initialize lazy edge weights to estimate (inexpensive)
\Loop
\State $p_{\ms{candidate}} \leftarrow
\mbox{\sc ShortestPath}(G, u, w_{\ms{lazy}})$ %\Comment Compute the shortest path with lazy edge weights
\label{line:lazy-outline-shortestpath}
\If {$p_{\ms{candidate}} \subseteq E_{\ms{eval}}$} %\Comment If all edges on path have already been evaluated,
\State \Return $p_{\ms{candidate}}$ %\Comment path returned is provably optimal
\EndIf
\State $E_{\ms{selected}} \leftarrow \mbox{\sc Selector}(G, p_{\ms{candidate}})$ %\Comment Select edges on path to process
\label{line:lazy-outline-chooseedges}
\For {$e \in E_{\ms{selected}} \setminus E_{\ms{eval}}$} %\Comment For all unevaluated selected edges
\State $w_{\ms{lazy}}(e) \leftarrow w(e)$ \Comment Evaluate (expensive)
\State $E_{\ms{eval}} \leftarrow E_{\ms{eval}} \cup e$ %\Comment Add to evaluated edge set
\EndFor
\EndLoop
\EndFunction
\end{algorithmic}
\end{algorithm}
We track evaluated edges with the set $E_{\ms{eval}}$.
We are given an estimator function $w_{\ms{est}}$ of the true edge weight $w$.
This estimator is inexpensive to compute
(e.g. edge length or even $0$).
We then define a \emph{lazy} weight function $w_{\ms{lazy}}$
which returns the
true weight of an evaluated edge and otherwise
uses the inexpensive estimator $w_{\ms{est}}$.
At each iteration of the search,
the algorithm uses $w_{\ms{lazy}}$ to compute a candidate path
$p_{\ms{candidate}}$
by calling an existing solver \textsc{ShortestPath}
(note that this invocation requires no evaluations of $w$).
Once a candidate path has been found,
it is returned if it is fully evaluated.
Otherwise,
an \emph{edge selector} is employed which selects
graph edge(s) for evaluation.
The true weights of these edges are then evaluated
(incurring the requisite computational cost),
and the algorithm repeats.
%\subsection{Theoretical Properties}
LazySP is complete and optimal:
\marginnote{Proof of all theorems are available
in Appendix~\ref{sec:appendix-proofs}.}
\begin{theorem}[Completeness of LazySP]
If the graph $G$ is finite,
\textsc{ShortestPath} is complete,
and the set $E_{\ms{selected}}$
returned by \textsc{Selector}
returns at least one unevaluated edge on $p_{\ms{candidate}}$,
then \textsc{LazyShortestPath} is complete.
\label{thm:lazy-completeness}
\end{theorem}
\begin{theorem}[Optimality of LazySP]
If $w_{\ms{est}}$ is chosen such that
$w_{\ms{est}}(e) \leq \epsilon \, w(e)$ for some parameter
$\epsilon \geq 1$ and
\textsc{LazyShortestPath} terminates
with some path $p_{\ms{ret}}$,
then $\mbox{len}(p_{\ms{ret}}, w) \leq \epsilon \, \ell^*$
with $\ell^*$ the length of an optimal path.
\label{thm:lazy-optimality}
\end{theorem}
The optimality of LazySP depends on the admissibility of
$w_{\ms{est}}$
in the same way that the optimality of A* depends on
the admissibility of its goal heuristic $h$.
Theorem~\ref{thm:lazy-optimality} establishes the general
bounded suboptimality of LazySP
w.r.t. the inflation parameter $\epsilon$.
While our theoretical results (e.g. equivalences)
hold for any choice of $\epsilon$,
for clarity our examples and experimental results
focus on cases with $\epsilon = 1$.
\subsection{The Edge Selector: Key to Efficiency}
\begin{algorithm}[t]
\caption{Various Simple LazySP Edge Selectors}
\begin{algorithmic}[1]
\Function {\textsc{SelectExpand}}{$G, p_{\ms{candidate}}$}
\State $e_{\ms{first}} \leftarrow$ first unevaluated $e \in p_{\ms{candidate}}$
\State $v_{\ms{frontier}} \leftarrow G.\mbox{source}(e_{\ms{first}})$
\State $E_{\ms{selected}} \leftarrow G.\mbox{out\_edges}(v_{\ms{frontier}})$
\State \Return $E_{\ms{selected}}$
\EndFunction
\vspace{0.02in}
\Function {\textsc{SelectForward}}{$G, p_{\ms{candidate}}$}
\State \Return $\{ \mbox{first unevaluated } e \in p_{\ms{candidate}} \}$
\EndFunction
\vspace{0.02in}
\Function {\textsc{SelectReverse}}{$G, p_{\ms{candidate}}$}
\State \Return $\{ \mbox{last unevaluated } e \in p_{\ms{candidate}} \}$
\EndFunction
\vspace{0.02in}
\Function {\textsc{SelectAlternate}}{$G, p_{\ms{candidate}}$}
\If {LazySP iteration number is odd}
\State \Return $\{ \mbox{first unevaluated } e \in p_{\ms{candidate}} \}$
\Else
\State \Return $\{ \mbox{last unevaluated } e \in p_{\ms{candidate}} \}$
\EndIf
\EndFunction
\vspace{0.02in}
\Function {\textsc{SelectBisection}}{$G, p_{\ms{candidate}}$}
\State \Return $\left\{ \begin{array}{ll}
\mbox{unevaluated } e \in p_{\ms{candidate}} \\
\mbox{furthest from nearest evaluated edge}
\end{array} \right\}$
\EndFunction
\end{algorithmic}
\label{alg:simple-selectors}
\end{algorithm}
%The algorithm purposely leaves undecided
%the edge evaluation selector codified in
%\textsc{Selector} (line~\ref{line:lazy-outline-chooseedges}),
%and therefore describes a class of algorithms
%differentiated by the choice of this selector.
%This paper discusses particular choices.
The LazySP algorithm exhibits a rough similarity to optimal
replanning algorithms such as
D* \citep{stentz1994dstar,stentz1995focusseddstar}
which plan a sequence of shortest paths for a mobile robot
as new edge weights are discovered during its traverse.
D* treats edge changes
passively as an aspect of the problem setting
(e.g. a sensor with limited range).
The key difference is that our problem setting treats
edge evaluations as an active choice that can be exploited.
While any choice of edge selector that meets the conditions above
will lead to an algorithm that is complete and optimal,
its \emph{efficiency} is dictated by the choice of this
selector.
This motivates the theoretical and empirical investigation of different
edge selectors in this chapter.
\textbf{Simple selectors.}
We codify five common strategies in
Algorithm~\ref{alg:simple-selectors}.
The Expand selector captures the edge weights that are evaluated
during a conventional vertex expansion.
The selector identifies the first unevaluated edge
$e_{\ms{first}}$ on the candidate path,
and considers the source vertex of this edge a \emph{frontier} vertex.
It then selects all out-edges of this frontier vertex
for evaluation.
The Forward and Reverse selectors select the first and last
unevaluated edge on the candidate path, respectively
(note that Forward returns a subset of Expand).
The Alternate selector simply alternates between Forward
and Reverse on each iteration.
This can be motivated by both bidirectional search algorithms
as well as motion planning algorithms such as
RRT-Connect \citep{kuffner2000rrtconnect}
which tend to perform well w.r.t. state evaluations.
The Bisection selector
chooses among those unevaluated edges
the one furthest from an evaluated edge on the candidate path.
This selector is roughly analogous to the collision checking strategy
employed by the Lazy PRM \citep{bohlin2000lazyprm}
as applied to our problem on abstract graphs.
In the following section,
we demonstrate that instances of LazySP using simple selectors
yield equivalent results to existing vertex algorithms.
We then discuss two more sophisticated
selectors motivated by weight function sampling
and statistical mechanics.
% prob-box2d00-halton-roots16
% fwd:34 partall:22 rev:24 fwdexpand:77
% bisect:25 worlddist:22 alt:23 partsimple:22
\begin{figure*}[t!]%
\!\!%
\subfloat[Expand(77)]{%
\centering%
\begin{tikzpicture}
\node at (0,-0.0) {\includegraphics{build/lazysp-example-1/alg-fwdexpand-after5}};
\node at (0,-2.5) {\includegraphics{build/lazysp-example-1/alg-fwdexpand-end}};
\node at (0,-4.8) {\includegraphics{build/lazysp-example-1/alg-fwdexpand-path-bars}};
\end{tikzpicture}%
}%
\!\!%
\subfloat[Forward(34)]{%
\centering%
\begin{tikzpicture}
\node at (0,-0.0) {\includegraphics{build/lazysp-example-1/alg-fwd-after5}};
\node at (0,-2.5) {\includegraphics{build/lazysp-example-1/alg-fwd-end}};
\node at (0,-4.8) {\includegraphics{build/lazysp-example-1/alg-fwd-path-bars}};
\end{tikzpicture}%
}%
\!\!%
\subfloat[Reverse(24)]{%
\centering%
\begin{tikzpicture}
\node at (0,-0.0) {\includegraphics{build/lazysp-example-1/alg-rev-after5}};
\node at (0,-2.5) {\includegraphics{build/lazysp-example-1/alg-rev-end}};
\node at (0,-4.8) {\includegraphics{build/lazysp-example-1/alg-rev-path-bars}};
\end{tikzpicture}%
}%
\!\!%
\subfloat[Alternate(23)]{%
\centering%
\begin{tikzpicture}
\node at (0,-0.0) {\includegraphics{build/lazysp-example-1/alg-alt-after5}};
\node at (0,-2.5) {\includegraphics{build/lazysp-example-1/alg-alt-end}};
\node at (0,-4.8) {\includegraphics{build/lazysp-example-1/alg-alt-path-bars}};
\end{tikzpicture}%
}%
\!\!%
\subfloat[Bisect(25)]{%
\centering%
\begin{tikzpicture}
\node at (0,-0.0) {\includegraphics{build/lazysp-example-1/alg-bisect-after5}};
\node at (0,-2.5) {\includegraphics{build/lazysp-example-1/alg-bisect-end}};
\node at (0,-4.8) {\includegraphics{build/lazysp-example-1/alg-bisect-path-bars}};
\end{tikzpicture}%
}%
\!\!%
\subfloat[WeightSamp(22)]{%
\centering%
\begin{tikzpicture}
\node at (0,-0.0) {\includegraphics{build/lazysp-example-1/alg-worlddist1000-after5}};
\node at (0,-2.5) {\includegraphics{build/lazysp-example-1/alg-worlddist1000-end}};
\node at (0,-4.8) {\includegraphics{build/lazysp-example-1/alg-worlddist1000-path-bars}};
\end{tikzpicture}%
}%
\!\!%
\subfloat[Partition(22)]{%
\centering%
\begin{tikzpicture}
\node at (0,-0.0) {\includegraphics{build/lazysp-example-1/alg-partall-after5}};
\node at (0,-2.5) {\includegraphics{build/lazysp-example-1/alg-partall-end}};
\node at (0,-4.8) {\includegraphics{build/lazysp-example-1/alg-partall-path-bars}};
\end{tikzpicture}%
}%
\caption[Snapshots of the LazySP algorithm using each edge selector
discussed in this chapter on the same obstacle roadmap graph problem,
with start and goal.
At top, the algorithms after evaluating five edges
(evaluated edges labeled as valid or invalid).
At middle, the final set of evaluated edges.
At bottom, for each unique path considered from left to right,
the number of edges on the path that are
already evaluated, evaluated and valid, evaluated and invalid,
and unevaluated.
The total number of edges evaluated is noted in brackets.
Note that the scale on the Expand plot has been adjusted
because the selector evaluates many edges not on the candidate
path at each iteration.
]{Snapshots of the LazySP algorithm using each edge selector
discussed in this chapter on the same obstacle roadmap graph problem,
with start (\protect\tikz[baseline=-0.5ex]{\protect\node[circle,fill=blue,inner sep=1pt]{};})
and goal (\protect\tikz[baseline=-0.5ex]{\protect\node[circle,fill=green,inner sep=1pt]{};}).
At top, the algorithms after evaluating five edges
(evaluated edges labeled as
\protect\tikz{\protect\draw[very thick] (0,0) -- (0.15,0.15);} valid
or \protect\tikz{\protect\draw[very thick,red] (0,0) -- (0.15,0.15);} invalid).
At middle, the final set of evaluated edges.
At bottom, for each unique path considered from left to right,
the number of edges on the path that are
\protect\tikz{\protect\node[fill=green!40!white,draw=black]{};}\;already evaluated,
\protect\tikz{\protect\node[fill=green!70!black,draw=black]{};}\;evaluated and valid,
\protect\tikz{\protect\node[fill=red!70!black,draw=black]{};}\;evaluated and invalid,
and \protect\tikz{\protect\node[fill=black!10!white,draw=black]{};}\;unevaluated.
The total number of edges evaluated is noted in brackets.
Note that the scale on the Expand plot has been adjusted
because the selector evaluates many edges not on the candidate
path at each iteration.
}
\label{fig:snapshots}
\end{figure*}
\section{Edge Equivalence to A* Variants}
In the previous section,
we introduced LazySP as the path-selection analogue
to BFS vertex-selection algorithms.
In this section,
we make this analogy more precise.
In particular,
we show that LazySP-Expand
%(that is, LazySP with the Expand selector)
%\ajnote{name consistency}
is edge-equivalent to a variant of A*
(and Weighted A*),
and that LazySP-Forward is edge-equivalent to a variant of
Lazy Weighted A*
(see Table~\ref{table:equivalences}).
%\ajnote{Say ``as described below''?}
It is important to be specific about the conditions under which
these equivalences arise,
which we detail here.
\begin{table}
\centering
{\small%
\begin{tabular}{lll}
\toprule
LazySP & Existing & \\
Selector & Algorithm & Result \\
\midrule
Expand & (Weighted) A* & Edge-equivalent \\
& & (Theorems \ref{thm:astar-equiv-from-lazy},
\ref{thm:astar-equiv-to-lazy}) \\
\addlinespace[0.3em]
Forward & Lazy Weighted A* & Edge-equivalent \\
& & (Theorems \ref{thm:lwastar-equiv-from-lazy},
\ref{thm:lwastar-equiv-to-lazy}) \\
\addlinespace[0.3em]
Alternate & Bidirectional Heuristic & Conjectured \\
& Front-to-Front Algorithm & \\
\bottomrule
\end{tabular}%
}%
\caption{LazySP equivalence results.
The A*, LWA*, and BHFFA algorithms use reopening and the dynamic
$h_{\ms{lazy}}$ heuristic (\ref{eqn:h_lazy}).}
\label{table:equivalences}
\end{table}
\textbf{Edge equivalence.}
We say that two algorithms are \emph{edge-equivalent} if they
evaluate the same edges in the same order.
We consider an algorithm to have evaluated an edge
the first time the edge's true weight is requested.
\textbf{Arbitrary tiebreaking.}
For some graphs,
an algorithm may have multiple allowable choices at each iteration
(e.g. LazySP with multiple shortest candidate paths,
or A* with multiple vertices in OPEN with lowest $f$-value).
We will say that algorithm A is equivalent to algorithm B
if for any choice available to A,
there exists an allowable choice available to B
such that the same edge(s) are evaluated by each.
\textbf{A* with reopening.}
We show equivalence to variants of A* and Lazy Weighted A*
that do not use a CLOSED list to prevent
vertices from being visited more than once.
%\ssnote{Why this comparison?! Not explained.}.
%Note that if the heuristic used is $h(v) = \epsilon h_c(v)$
%with $h_c(v)$ consistent,
%a CLOSED list could potentially reduce edge evaluations
%while still guaranteeing $\epsilon$-suboptimality.
\begin{figure}
\centering
\begin{tikzpicture}
\tikzset{>=latex} % arrow heads
%\draw[step=1cm,black!10,very thin] (0,0) grid (8,4);
\node[draw,circle,inner sep=1pt,fill=black!20] (S) at (1,1) {S};
\node[draw,circle,inner sep=1pt] (X) at (2,2.7) {X};
\node[draw,circle,inner sep=1pt,fill=black!20] (Y) at (3,1) {Y};
\node[draw,circle,inner sep=1pt] (G) at (5,1) {G};
\draw[->] (S) -- (Y) node [midway,fill=white] {1,1};
\draw[->] (Y) -- (G) node [midway,fill=white] {1,3};
\draw[->] (S) -- (X) node [midway,fill=white] {1,1};
\draw[->,densely dotted] (X) -- (Y) node [midway,fill=white] {1,?};
\node[anchor=west] at (2.3,2.9) {$h_{\ms{est}} = 2$};
\node[anchor=west] at (2.3,2.5) {$h_{\ms{lazy}} = 4$};
% for legend
%\node at (7,2.9) {unevaluated:};
%\draw[->,dashed] (6,2.5) -- (8,2.5)
% node [midway,fill=white] {($w_{est}$)\,?};
%\node at (7,1.9) {evaluated:};
%\draw[->] (6,1.5) -- (8,1.5)
% node [midway,fill=white] {($w_{est}$)\,$w$};
\draw[->,densely dotted] (4.5,2.9) -- (6.5,2.9)
node[midway,yshift=0.03cm,fill=white,inner sep=1pt,font=\small] {unevaled};
\draw[->] (4.5,2.55) -- (6.5,2.55)
node[midway,yshift=0.03cm,fill=white,inner sep=1pt,font=\small] {evaled};
\node at (5.5,2.2) {$w_{\ms{est}},w$};
\draw[black!10] (4.25,1.95) rectangle (6.75,3.2);
\end{tikzpicture}
\caption{A* comparison between
the static goal heuristic $h_{\ms{est}}$ (\ref{eqn:h_est})
and the dynamic goal heuristic $h_{\ms{lazy}}$ (\ref{eqn:h_lazy})
on a simple graph from start S to goal G.
The values of both the edge weight estimate $w_{\ms{est}}$
and the true edge weight $w$ (for evaluated edges) are shown.
Using either goal heuristic,
the A* algorithm first expands vertices S and Y,
evaluating three edges in total and leaving X and G on OPEN.
After finding that edge YG has $w=3$,
the dynamic heuristic value $h_{\ms{lazy}}(\mbox{X})$
is updated from 2 to 4.
While the A* using the static $h_{\ms{est}}$ would next expand X,
the A* using the dynamic $h_{\ms{lazy}}$ would next expand G
and terminate, having never evaluated edge XY.}
\label{fig:updating-heuristic}
\end{figure}
\textbf{A* with a dynamic heuristic.}
In order to apply A* and Lazy Weighted A* to our problem,
we need a goal heuristic over vertices.
The most simple may be
\begin{equation}
h_{\ms{est}}(v) = \min_{p : v \rightarrow v_g} \mbox{len}(p, w_{\ms{est}}).
\label{eqn:h_est}
\end{equation}
Note that the value of this heuristic could be computed as a
pre-processing step using Dijkstra's algorithm \citep{dijkstra1959anote}
before iterations begin.
However,
in order for the equivalences to hold,
we require the use of the lazy heuristic
\begin{equation}
h_{\ms{lazy}}(v) = \min_{p : v \rightarrow v_g} \mbox{len}(p, w_{\ms{lazy}}).
\label{eqn:h_lazy}
\end{equation}
This heuristic is dynamic in that it depends on $w_{\ms{lazy}}$
which changes as edges are evaluated.
Therefore,
heuristic values must be recomputed for all affected vertices on OPEN
after each iteration.
%An illustrative example is shown in
%Figure~\ref{fig:updating-heuristic}.
%(We discuss efficient implementation of $h_{\ms{lazy}}$ as it relates
%to the D* family of algorithms in Section~\ref{sec:discussion}.)
\subsection{Equivalence to A*}
We show that the LazySP-Expand algorithm
is edge-equivalent to a variant of the A*
shortest-path algorithm.
%We consider the variant of A* which allows a vertex $v$ to be reopened
%if its stored cost $g[v]$ is improved.
We make use of two invariants that are maintained during the
progression of A*.
\marginnote{Proof of all invariants are available
in Appendix~\ref{sec:appendix-proofs}.}
\begin{invariant}
If $v$ is discovered by A* and $v'$ is undiscovered,
with $v'$ a successor of $v$,
then $v$ is on OPEN.%
\label{inv:astar-cundisc-popen}%
\end{invariant}
\begin{invariant}
If $v$ and $v'$ are discovered by A*,
with $v'$ a successor of $v$,
and $g[v] + w(v,v') < g[v']$,
then $v$ is on OPEN.%
\label{inv:astar-wless-popen}%
\end{invariant}
When we say a vertex is \emph{discovered},
we mean that it is either on OPEN or CLOSED.
Note that Invariant \ref{inv:astar-wless-popen} holds
because we allow vertices to be reopened;
without reopening (and with an inconsistent heuristic),
later finding a cheaper path to $v$ (and not reopening $v'$)
would invalidate the invariant.
We will use the goal heuristic $h_{\ms{lazy}}$ from (\ref{eqn:h_lazy}).
Note that if an admissible edge weight estimator $\hat{w}$ exists
(that is, $\hat{w} \leq w$),
then our A* can approximate the Weighted A* algorithm
\citep{pohl1970weightedastar}
with parameter $\epsilon$
by using $w_{\ms{est}} = \epsilon \, \hat{w}$,
and the suboptimality bound from
Theorem~\ref{thm:lazy-optimality} holds.
\begin{figure}[t]
\centering
\begin{tikzpicture}
%\draw[step=1cm,gray,very thin] (0,0) grid (8,3);
\draw[fill=black!05] (2.1,1.5) ellipse (0.4cm and 0.5cm);
\draw[fill=black!05] (5.9,1.5) ellipse (0.4cm and 0.5cm);
\draw[fill=black!05] (4,1) ellipse (0.4cm and 0.4cm);
\node[align=center] at (0.75,1.5) {$P_{\ms{candidate}}$\\(LazySP)};
\node[align=center] at (7.25,1.5) {$S_{\ms{candidate}}$\\(A*)};
\node[align=center] at (4,1.75) {$V_{\ms{frontier}}$};
\node[fill=black,circle,inner sep=1pt] (p1) at (2.15,1.7) {};
\node[fill=black,circle,inner sep=1pt] (p2) at (2.05,1.3) {};
\node[fill=black,circle,inner sep=1pt] (s1) at (5.95,1.8) {};
\node[fill=black,circle,inner sep=1pt] (s2) at (5.85,1.3) {};
\node[fill=black,circle,inner sep=1pt] (v1) at (4.1,0.9) {};
\draw[->] (p1) -- (v1);
\draw[->] (p2) -- (v1);
\draw[->] (s1) -- (v1);
\draw[->] (s2) -- (v1);
\end{tikzpicture}
\caption{Illustration of the equivalence
between A* and LazySP-Expand.
After evaluating the same set of edges,
the next edges to be evaluated by each algorithm
can both be expressed as a surjective mapping onto
a common set of unexpanded
frontier vertices.
}
\label{fig:astar-equiv-mapping}
\end{figure}
\textbf{Equivalence.}
In order to show edge-equivalence,
we consider the case where both algorithms
are beginning a new iteration
having so far evaluated the same set of edges.
LazySP-Expand has some set $P_{\ms{candidate}}$ of allowable
candidate paths minimizing $\mbox{len}(p,w_{\ms{lazy}})$;
the Expand selector will then identify a vertex on the chosen path
for expansion.
A* will iteratively select a set of vertices from OPEN to expand.
Because it is possible that a vertex is expanded multiple times
(and only the first expansion results in edge evaluations),
we group iterations of A* into \emph{sequences},
where each sequence $s$ consists of
(a) zero or more vertices from OPEN that have already been expanded,
followed by (b) one vertex from OPEN that is to be expanded
for the first time.
We show that both the set of allowable candidate paths $P_{\ms{candidate}}$
available to LazySP-Expand
and the set of allowable candidate vertex sequences $S_{\ms{candidate}}$
available to A*
map surjectively to the same set of unexpanded frontier vertices $V_{\ms{frontier}}$
as illustrated in Figure~\ref{fig:astar-equiv-mapping}.
This is described by way of
Theorems \ref{thm:astar-equiv-from-lazy}
and \ref{thm:astar-equiv-to-lazy} below.
\marginnote{Proof of all theorems are available
in Appendix~\ref{sec:appendix-proofs}.}
\begin{theorem}
If LazySP-Expand and A* have evaluated the same set of edges,
then for any candidate path $p_{\ms{candidate}}$ chosen by LazySP
yielding frontier vertex $v_{\ms{frontier}}$,
there exists an allowable A* sequence $s_{\ms{candidate}}$
which also yields $v_{\ms{frontier}}$.
\label{thm:astar-equiv-from-lazy}
\end{theorem}
\begin{theorem}
If LazySP-Expand and A* have evaluated the same set of edges,
then for any candidate sequence $s_{\ms{candidate}}$ chosen by A*
yielding frontier vertex $v_{\ms{frontier}}$,
there exists an allowable LazySP path $p_{\ms{candidate}}$
which also yields $v_{\ms{frontier}}$.
\label{thm:astar-equiv-to-lazy}
\end{theorem}
\subsection{Equivalence to Lazy Weighted A*}
%\begin{algorithm}
% \caption{Forward Edge Evaluation Selector}
% \begin{algorithmic}[1]
% \Function {\textsc{SelectForward}}{$G, p_{\ms{candidate}}$}
% \State $e_{\ms{first}} \leftarrow$ first unevaluated $e \in p_{\ms{candidate}}$
% \State \Return $\{ e_{\ms{first}} \}$
% \EndFunction
% \end{algorithmic}
% \label{alg:selectforward}
%\end{algorithm}
In a conventional vertex expansion algorithm,
determining a successor's cost is a function of both
the cost of the edge and the value of the heuristic.
If either of these components is expensive to evaluate,
an algorithm can defer its computation by maintaining the successor
on the frontier with an approximate cost until it is expanded.
The Fast Downward algorithm \citep{helmert2006fastdownward} is motivated
by expensive heuristic evaluations in planning,
whereas the Lazy Weighted A* (LWA*) algorithm \citep{cohen2014narms}
is motivated by expensive edge evaluations in robotics.
We show that the LazySP-Forward algorithm
is edge-equivalent to a variant of the Lazy Weighted A*
shortest-path algorithm.
For a given candidate path,
the Forward selector returns the first unevaluated edge.
\textbf{Variant of Lazy Weighted A*.}
We reproduce a variant of LWA* without a CLOSED list
in Algorithm~\ref{alg:lwastar}.
For the purposes of our analysis,
the reproduction differs from the original presentation,
and we detail those differences here.
With the exception of the lack of CLOSED,
the differences do not affect the behavior of the algorithm.
\begin{algorithm}[t]
\caption{Lazy Weighted A* (without CLOSED list)}
\label{alg:lwastar}
\begin{algorithmic}[1]
\Function {\textsc{LazyWeightedA*}}{$G, w, \hat{w}, h$}
\State $g[v_{\ms{start}}] \leftarrow 0$
\State $Q_v \leftarrow \{ v_{\ms{start}} \}$
\Comment Key: $g[v] + h(v)$
\label{line:lwastar-key-qvertices}
\State $Q_e \leftarrow \emptyset$
\Comment Key: $g[v] + \hat{w}(v,v') + h(v')$
\label{line:lwastar-key-qedges}
\While {$\min(Q_v.{\mbox{TopKey}}, Q_e.{\mbox{TopKey}}) < g[v_{\ms{goal}}]$}
\If {$Q_v.{\mbox{TopKey}} \leq Q_e.{\mbox{TopKey}}$}
\State $v \leftarrow Q_v.{\mbox{Pop}}()$
\For {$v' \in G.\mbox{GetSuccessors}(v)$}
\State $Q_e.\mbox{Insert}((v,v'))$
\EndFor
\Else
\State $(v,v') \leftarrow Q_e.{\mbox{Pop}}()$
\If {$g[v'] \leq g[v] + \hat{w}(v,v')$}
\label{line:lwastar-test}
\State {\bf continue}
\EndIf
\State $g_{\ms{new}} \leftarrow g[v] + w(v,v')$
\Comment evaluate
\If {$g_{\ms{new}} < g[v']$}
\State $g[v'] = g_{\ms{new}}$
\State $Q_v.\mbox{Insert}(v')$
\EndIf
\EndIf
\EndWhile
\EndFunction
\end{algorithmic}
\end{algorithm}
The most obvious difference is that we present the original OPEN list
as separate vertex ($Q_v$) and edge ($Q_e$) priority queues,
with sorting keys shown on lines \ref{line:lwastar-key-qvertices}
and \ref{line:lwastar-key-qedges}.
A vertex $v$ in the original OPEN with $trueCost(v) = true$
corresponds to a vertex $v$ in $Q_v$,
whereas a vertex $v'$ in the original OPEN
with $trueCost(v') = false$ (and parent $v$)
corresponds to an edge $(v,v')$ in $Q_e$.
Use of the edge queue obviates the need for
duplicate vertices on OPEN with different parents
and the $conf(v)$ test for identifying such duplicates.
This presentation also highlights the similarity between LWA*
and the inner loop of the Batch Informed Trees (BIT*) algorithm
\citep{gammell2015bitstar}.
The second difference is that the edge usefulness test
(line 12 of the original algorithm)
has been moved from before inserting into OPEN
to after being popped from OPEN,
but before being evaluated
(line~\ref{line:lwastar-test} of Algorithm~\ref{alg:lwastar}).
This change is partially in compensation for removing the CLOSED
list.
This adjustment
does not affect the edges evaluated.
We make use of an invariant that is maintained during the
progression of Lazy Weighted A*.
\marginnote{Proof of all invariants are available
in Appendix~\ref{sec:appendix-proofs}.}
\begin{invariant}
For all vertex pairs $v$ and $v'$,
with $v'$ a successor of $v$,
if $g[v] + \max(w(v,v'), \hat{w}(v,v')) < g[v']$,
then either vertex $v$ is on $Q_{v}$
or edge $(v,v')$ is on $Q_e$.%
\label{inv:lwastar}%
\end{invariant}
We will use $h(v) = h_{\ms{lazy}}(v)$ from (\ref{eqn:h_lazy})
and $\hat{w} = w_{\ms{lazy}}$.
Note that the use of these dynamic heuristics requires that the
$Q_v$ and $Q_e$ be resorted after every edge is evaluated.
\textbf{Equivalence.}
The equivalence follows similarly to that for A* above.
Given the same set of edges evaluated,
the set of allowable next evaluations is identical for each
algorithm.
\marginnote{Proof of all theorems are available
in Appendix~\ref{sec:appendix-proofs}.}
\begin{theorem}
If LazySP-Forward and LWA* have evaluated the same set of edges,
then for any allowable candidate path $p_{\ms{candidate}}$
chosen by LazySP yielding first unevaluated edge $e_{ab}$,
there exists an allowable LWA* sequence $s_{\ms{candidate}}$
which also yields $e_{ab}$.
\label{thm:lwastar-equiv-from-lazy}
\end{theorem}
\begin{theorem}
If LazySP-Forward and LWA* have evaluated the same set of edges,
then for any allowable sequence of vertices and edges $s_{\ms{candidate}}$
considered by LWA* yielding evaluated edge $e_{ab}$,
there exists an allowable LazySP candidate path $p_{\ms{candidate}}$
which also yields $e_{ab}$.
\label{thm:lwastar-equiv-to-lazy}
\end{theorem}
\subsection{Relation to Bidirectional Heuristic Search}
LazySP-Alternate chooses unevaluated edges from either
the beginning or the end of the candidate path at each iteration.
We conjecture that an alternating version of the Expand selector
is edge-equivalent to the
Bidirectional Heuristic Front-to-Front Algorithm
\citep{champeauxsint1977bhffa}
for appropriate lazy vertex pair heuristic,
and that LazySP-Alternate is edge-equivalent
to a bidirectional LWA*.
\begin{algorithm}[t]
\caption{Maximum Edge Probability Selector
\emph{(for WeightSamp and Partition path distributions)}}
\begin{algorithmic}[1]
\Function {\textsc{SelectMaxEdgeProb}}{$G, p_{\ms{candidate}}, \mathcal{D}_p$}
\State $p(e) \leftarrow \Pr( \, e \in P \, )
\mbox{ for } P \sim \mathcal{D}_p$
\State $e_{\ms{max}} \leftarrow$ unevaluated $e \in p_{\ms{candidate}}$
maximizing $p(e)$
\State \Return $\{ e_{\ms{max}} \}$
\EndFunction
\end{algorithmic}
\label{alg:selectmaxscore}
\end{algorithm}
\section{Novel Edge Selectors}
Because we are conducting a search over paths,
we are free to implement selectors which are not constrained to
evaluate edges in any particular order
(i.e. to maintain evaluated trees rooted at the start and goal
vertices).
In this section,
we describe a novel class of edge selectors which is designed
to reduce the total number of edges evaluated during the course
of the LazySP algorithm.
These selectors operate by maintaining a distribution over potential
paths at each iteration of the algorithm
(see Figure~\ref{fig:maxprob-selectors-overview}).
This path distribution induces a Bernoulli distribution for each
edge $e$ which indicates its probability $p(e)$ to lie on
the potential path;
at each iteration,
the selectors then choose the unevaluated edge that maximizes
this edge indicator probability (Algorithm~\ref{alg:selectmaxscore}).
The two selectors described in this section differ
with respect to how they maintain this distribution over potential paths.
% make -f e8_experiments/scripts/Makefile.lazysp-fig-dists
\begin{figure}[t]
\centering
\begin{tikzpicture}
\tikzset{>=latex}
\node[draw,minimum width=2.4cm,minimum height=3.0cm] (startbox) at (-3.0,0) {};
\node[inner sep=0pt] at (-3.0,-0.35) {\includegraphics[scale=2.0]{build/lazysp-fig-dists/fig-sofar}};
\node[align=center,font=\small,below] at (startbox.north) {known\\edges};
\node[draw] (quesbox) at (-1.2,0) {?};
\node[draw,minimum width=2.1cm,minimum height=3.0cm] (pathsbox) at (0.4,0) {};
\node[inner sep=0pt] at (-0.05, 0.1) {\includegraphics[scale=0.8]{build/lazysp-fig-dists/fig-path-00}};
\node[inner sep=0pt] at ( 0.85, 0.1) {\includegraphics[scale=0.8]{build/lazysp-fig-dists/fig-path-01}};
\node[inner sep=0pt] at (-0.05,-0.8) {\includegraphics[scale=0.8]{build/lazysp-fig-dists/fig-path-02}};
\node[inner sep=0pt] at ( 0.85,-0.8) {\includegraphics[scale=0.8]{build/lazysp-fig-dists/fig-path-03}};
\node[align=center,font=\small,below] at (pathsbox.north) {path\\distribution};
\node[align=center,font=\normalsize,above] at (pathsbox.south) {$\dots$};
\node[draw,minimum width=2.4cm,minimum height=3.0cm] (goalbox) at (3.0,0) {};
\node[inner sep=0pt] at (3.0,-0.35) {\includegraphics[scale=2.0]{build/lazysp-fig-dists/fig-dist-probs}};
\node[align=center,font=\small,below] at (goalbox.north) {edge indicator\\distributions};
\draw[->] (startbox) -- (quesbox);
\draw[->] (quesbox) -- (pathsbox);
\draw[->] (pathsbox) -- (goalbox);
\end{tikzpicture}
\caption{Illustration of maximum edge probability selectors.
A distribution over paths
(usually conditioned on the known edge evaluations)
induces on each edge $e$ a Bernoulli distribution