|
Algorithm 2 Creating a path given its closest point to the traffic light |
|
Procedure CreatePath(C, j, t, P) |
| k ← 1 |
| dk ← 0 |
// dk: Traversed distance to the stopping point at the path’s k-th index |
| rk ← j
|
// rk: The data point index at the path’s k-th index |
| While dk < Lp ∧ rk > 1 ∧ [∄ (R, D) ∈ P such that rk−1 ∈ R] |
| k ← k + 1 |
| rk ← rk−1 − 1 |
| dk ← dk−1 + dist(
) |
| End While
|
| R ← ⟨r1, r2, ..., rk⟩ |
| D ← ⟨d1, d2, ..., dk⟩ |
| If dk ≥ Lp
|
// If the path’s traversed distance is greater than Lp
|
| Return {(R, D)} |
| Else
|
| Return ∅ |
| End If
|
|
End Procedure
|