• No results found

3.3 Continuous Optimal Trajectories

3.3.2 Anytime A* Extensions

With all of the continuous framework in place, the Anytime A* algorithms can be easily extended to the continuous case with a few additional caveats. The pseudocode for the algorithms is provided in Figures 3.3, 3.4, 3.2, where ARA* and ANA* both make use of the “shared functions” on Lines 3–23. This implementation is close to the descrip- tion provided in §3.2.2 and summarized in Table 3.2, but is different in several details described below.

Algorithm 3: Shared functions for ARA* and ANA* algorithms procedure : Initialize() 1 incon← ∅ 2 accepted← {t} 3 considered← N(t) 4 U(x)= +∞ ∀ x ∈ X 5 U(t) ← 0 6 U(y) ← h/ f (y) ∀ y ∈ N(t) 7 Ψ ← +∞

procedure : Prune(considered)

8 for x ∈considereddo 9 if U(x)+ ϕ(x) > Ψ then

10 Remove x fromconsidered

procedure : ImproveSolution()

11 whileconsidered, ∅ do 12 x∗← BestKey()

13 Remove x∗fromconsideredand put inaccepted 14 if x∗ = x then

15 break

16 for y ∈ N(x∗) do

17 if U(y) ≥ U(x∗) then

18 Utemp ← Update(y)

19 if Utemp < U(y) then

20 U(y) ← Utemp if y ∈acceptedthen

21 Add y toincon

22 else if U(y)+ ϕ(y) ≤ Ψ then

23 Add y toconsidered

Figure 3.2: Pseudocode for the shared functions that ARA* (Algorithm 3.3) and ANA* (Algorithm 3.4) use.

Algorithm 4: ARA* Algorithm

procedure : Main()

1 Initialize() while wϕ is inconsistent do 2 ImproveSolution()

3 Ψ ← U(s)

4 Moveinconintoconsidered;accepted← ∅

5 Prune(considered) 6 w ←min {w −∆w, U(s)/ϕ(t)} procedure : SortKey(x) 7 return U(x)+ wϕ(x) procedure : BestKey() 8 return argmin x∈considered SortKey(x)

Figure 3.3: Pseudocode for ARA* algorithm.

Algorithm 5: ANA* Algorithm

procedure : Main()

1 Initialize() while considered, ∅ do 2 ImproveSolution()

3 Ψ ← U(s)

4 Moveinconintoconsidered;accepted← ∅

5 Prune(considered) procedure : SortKey(x) 6 return (Ψ − U(x))/(γh + ϕ(x)) procedure : BestKey() 7 return argmax x∈considered SortKey(x)

Figure 3.4: Pseudocode for ANA* algorithm.

Implementation details and differences from the discrete case:

• In essence, the main difference between the continuous and discrete setting is the Update() procedure (3.10) (Line 18); to produce the correct output on graphs this should be replaced by Line 9 of Algorithm 3.1. The rest of the modifications on

this list were introduced for the sake of efficiency only.

• Here we present both algorithms as iterative label-setting methods, i.e. whenever a gridpoint is accepted it cannot become re-considered until the next iteration. This is different than the original ANA* [7], which was iterative label-correcting in nature [7]. To turn both algorithms into iterative label-correcting methods one could allow for previously accepted nodes to reenter the considered list (i.e., re- move Lines 20–21 and change the following “else if” to “if” on Line 22).3

• Pruning (i.e. AA*) can be easily ‘turned off’ by substituting 0 for ϕ(x) only on Lines 9 and 22.

• The ANA* SortKey from §2 (i.e. the righthand-side of (3.5)), would present and additional complication in the continuous setting. Here, the optimal path is a continuous curve throughΩ rather than a node-to-node path. An optimal domain restriction algorithm would process gridpoints only in an -tube of this optimal trajectory, accepting them in ascending order based on U-values. Unfortunately the original ANA* SortKey does exactly the opposite in a neighborhood of s. In fact, it prioritizes accepting s first since the SortKey is infinite there. Moreover, it has an even worse effect on gridpoints near s since the limit of the (Ψ−U(x)/ϕ(x) is not well-defined as x approaches s (assumingΨ = U(s)). To remedy this issue, we have used a modified SortKey on Line 6,

(Ψ − U) / (γh + ϕ) , (3.12)

where γ > 0 is selected ‘large enough’ to correct this issue.4

3We have also implemented and tested this iterative label-correcting version but we found it far less ef- ficient in this continuous setting. The iterative label-correcting methods suffer from a “back-propogation” of updates in the ImproveSolution() routine, where a single gridpoint triggers a chain reaction of gridpoint values becoming re-updated.

4Our experimental evidence shows that as γ decreases, so does the time between iterations. This is because decreasing γ increases the new key at s, causing it to becomeacceptedmore quickly. γ can also

• Unfortunately, if w0 is too large and ∆w is small, it might take many iterations

until any meaningful improvement is discovered for the optimal (s − t)-trajectory. On graphs the ‘reset formula’ (3.4) provided a way to decrease w to a ‘smart’ value. We use a slightly simpler version on Line 6 that that helps with efficiency given by

w ← {w −∆w, U(s)/ϕ(t)} (3.13)

3.4

Numerical Results

In this section we conduct experiments on real and synthetic data both on cartesian grids and simplicial meshes. The performance of the Anytime A* algorithms is mea- sured relative to the performance of SA*-FMM and classical FMM (terminated once

s ∈ accepted). The Anytime methods are not quicker to produce the exact value U(s),

but this is not the goal of these algorithms. Instead, an Anytime A* algorithm is use- ful if it produces several high quality solutions in a fraction of the SA*-FMM total time TS A, and with enough runtime produce the correct solution. However, in spe-

cial situations SA*-FMM can take longer than FMM, so we compare to the total time Ttotal = min {TS A, TF M M}. Typically TS A < TF M M, however when SA*-FMM provides

little-to-no restriction it can be slower than regular FMM; e.g. see §3.4.5.

The main experimental evidence we present are performance profiles for ARA* and ANA*. If U∗(s) is the currently found solution by a profiled method and U(s) is the FMM-produced solution, we measure “solution quality” as the relative error at s

E , (U∗(s) − U(s)) / U(s) ≥ 0.

Since SA*-FMM with an inconsistent ϕ can produce additional errors [18], we also report ES A for all of the examples. In addition, we report ES, the measure of quality

for the straight-line trajectory from s to t. An anytime method is worthwhile for a particular example if it produces several solutions with E ∈ hES A, ESi before the time

Ttotal. The results of benchmarking are succinctly summarized in Table 3.3. For anytime

algorithms, Eαrefers to the error of the best solution found up to the time αTtotal.

For each example we also provide “time vs. solution quality” plots in Figures 3.6, 3.9, 3.11, 3.13, and 3.16. E is capped at 1.0 and the curves are only plotted until the time 1.25Ttotal.

Another important statistic is the size of SA*-FMM-accepted set compared to the FMM-accepted set, defined respectively by

L∗ = {x ∈ X | U∗(x)+ ϕ(x) ≤ U∗(s)} and L = {x ∈ X | U(x) ≤ U(s)} . Examples of particular interest are ones where SA*-FMM is unable to provide sufficient restriction, which is indicated when |L∗|/ |L| is closer to 1. This situation typically arises because ϕ  V on much ofΩ, and thus inflating ϕ helps provide more restriction; this justifies the use of WA*/ARA*/ANA*.