**Algorithm 2**

estimation of *y i*ð Þ � 1 and *y i*ð Þ with known data from *w*3. Variables *h*<sup>1</sup> and *h*<sup>2</sup> (see lines from 9 to 14) store the average of the absolute difference between historical and modeled data, from *w*<sup>1</sup> and *w*2, respectively*. h*<sup>3</sup> (line 15) stores the absolute difference of the historical and estimated data, from *w*<sup>3</sup> and index *i-1*. The condition in line 16 verifies that the *y i*ð Þ � 3 to *y i*ð Þ � 1 speeds are nonempty, i.e., available. *h*1…*h*<sup>3</sup> are normalized and converted to weights, named *W*1…*W*3. Because *h* carries the error, a greater *h* results in a smaller *W*, and so forth. In line 18, the predicted speed is calculated using the weights, the modeled speed with *w*<sup>1</sup> and *w*2, and the estimation with previous data of *w*3. If the condition in line 16 is not true, then in line 21 the speed prediction is calculated with the modeled data and new weights,

without the *w*<sup>3</sup> data.

**Algorithm 1**

3.*if i* ≤*deep* 4.^*y i*ðÞ¼ *<sup>M</sup>*<sup>1</sup>

6.*if i* ≥*deep* þ 1

9.*h*<sup>1</sup> ¼ 0*; h*<sup>2</sup> ¼ 0*;* 10.*for j* ¼ 1 *to j* ¼ *deep* 11.*h*<sup>1</sup> <sup>¼</sup> *<sup>h</sup>*<sup>1</sup> <sup>þ</sup> *y i*ð Þ� � *<sup>j</sup> <sup>M</sup>*<sup>1</sup>

12.*h*<sup>2</sup> <sup>¼</sup> *<sup>h</sup>*<sup>2</sup> <sup>þ</sup> *y i*ð Þ� � *<sup>j</sup> <sup>M</sup>*<sup>2</sup>

*h*1þ*h*2þ*h*<sup>3</sup>

*<sup>W</sup>*<sup>2</sup> <sup>¼</sup> <sup>1</sup>�*h*<sup>2</sup>

*h*1þ*h*<sup>2</sup>

14.*h*<sup>1</sup> ¼ *h*1*=deep* ; *h*<sup>2</sup> ¼ *h*2*=deep* 15.*h*<sup>3</sup> ¼ j j *y i*ð Þ� � 1 *y i*ð Þ � 1

1�*h*1þ1�*h*2þ1�*h*<sup>3</sup>

; *<sup>h</sup>*<sup>2</sup> <sup>¼</sup> *<sup>h</sup>*<sup>2</sup> *h*1þ*h*<sup>2</sup>

5.*end if*

13.*end for*

17.*h*<sup>1</sup> <sup>¼</sup> *<sup>h</sup>*<sup>1</sup>

18.^*y i*ðÞ¼ *<sup>M</sup>*<sup>1</sup>

21.^*y i*ðÞ¼ *<sup>M</sup>*<sup>1</sup>

22.*end if* 23.*end if* 24.*end for* 25.*end for*

**Appendix B**

**120**

19.*else* 20.*h*<sup>1</sup> <sup>¼</sup> *<sup>h</sup>*<sup>1</sup>

*Initial conditions: deep* = 3;

*Sustainability in Urban Planning and Design*

*<sup>k</sup>*ð Þ*<sup>i</sup>* <sup>∗</sup> <sup>0</sup>*:*<sup>5</sup> <sup>þ</sup> *<sup>M</sup>*<sup>2</sup>

7.*y i*ð Þ¼ � 1 *y i*ð Þþ � 2 ð Þ *y i*ð Þ� � 2 *y i*ð Þ � 3 8.*y i*ðÞ¼ *y i*ð Þþ � 1 ð Þ *y i*ð Þ� � 1 *y i*ð Þ � 2

> *<sup>k</sup>*ð Þ *<sup>i</sup>* � *<sup>j</sup>*

> *<sup>k</sup>*ð Þ *<sup>i</sup>* � *<sup>j</sup>*

16.*if y i*ð Þ � 1 ∉∅ ∧ *y i*ð Þ � 2 ∉∅ ∧ *y i*ð Þ � 3 ∉ ∅

*h*1þ*h*2þ*h*<sup>3</sup>

; *<sup>h</sup>*<sup>2</sup> <sup>¼</sup> *<sup>h</sup>*<sup>2</sup>

*<sup>k</sup>*ð Þ*<sup>i</sup>* <sup>∗</sup>*W*<sup>1</sup> <sup>þ</sup> *<sup>M</sup>*<sup>2</sup>

*<sup>k</sup>*ð Þ*<sup>i</sup>* <sup>∗</sup>*W*<sup>1</sup> <sup>þ</sup> *<sup>M</sup>*<sup>2</sup>

*<sup>k</sup>*ð Þ*i* ∗ 0*:*5

; *<sup>h</sup>*<sup>3</sup> <sup>¼</sup> *<sup>h</sup>*<sup>3</sup>

; *<sup>W</sup>*<sup>3</sup> <sup>¼</sup> <sup>1</sup>�*h*<sup>3</sup>

*<sup>k</sup>*ð Þ*i* ∗*W*<sup>2</sup>

*h*1þ*h*2þ*h*<sup>3</sup>

1�*h*1þ1�*h*2þ1�*h*<sup>3</sup>

; *W*<sup>1</sup> ¼ 1 � *h*1; *W*<sup>2</sup> ¼ 1 � *h*2;

From Algorithm 2, in lines 3 to 10 it is compared the modeled and historical speed category (from *w*<sup>1</sup> and *w*2), with the historical from *w*3, to determine which is

*<sup>k</sup>*ð Þ*i* ∗*W*<sup>2</sup> þ *y i*ð Þ ∗*W*<sup>3</sup>

; *<sup>W</sup>*<sup>1</sup> <sup>¼</sup> <sup>1</sup>�*h*<sup>1</sup>

1�*h*1þ1�*h*2þ1�*h*<sup>3</sup>

;

1.*for k* ¼ 0 *to k* ¼ 7 2.*for i* ¼ 1 *to i* ¼ *Nk*

```
Initial conditions: score1 = 0; score2 = 0; score3 = 0; score4 = 0;
threshold ∈ [0.75,0.95];
    1.for i ¼ 1 to i ¼ N
    2.if i>1
```

```
3.if H3ð Þ ¼¼ i � 1 S1ð Þ i � 1
 4.score1 þ þ; end if
 5.if H3ð Þ ¼¼ i � 1 S2ð Þ i � 1
 6.score2 þ þ; end if
 7.if H3ð Þ ¼¼ i � 1 H1ð Þ i � 1
 8.score3 þ þ; end if
 9.if H3ð Þ ¼¼ i � 1 H2ð Þ i � 1
10.score4 þ þ; end if
11.end if
12.if Pð 2ð Þi ≥ threshold ∧ ð Þ score2 ≥score1
13.S3ðÞ¼ i S2ð Þi ; else
14.if Pð 1ð Þi ≥threshold ∧ ð Þ score1 ≥score2
15.S3ðÞ¼ i S1ð Þi ; else
16.if score4 ≥ score3
17.S3ðÞ¼ i H2ð Þi ; else
18.S3ðÞ¼ i H1ð Þi ; end if
19.end if
20.end if
21.end for
```
*Sustainability in Urban Planning and Design*
