Skip to main content
. 2014 Nov 27;14(12):22564–22594. doi: 10.3390/s141222564

Algorithm 1 Gain greedy algorithm

Input:
G = (V, E): The weighted road graph;
T: The delay bound;
B: The budget constraint;
Output:
Inline graphicc: The placement set of installing c-RSUs;
Inline graphicw: The placement set of installing w-RSUs;
1: Inline graphic = ∅, Inline graphic = ∅;
2: For all i, jV, initial Dij according to Equation (2);
3: while the placement cost is not exceed the budget B and Inline graphic ≠ |E| do
4: for all unselected viVdo
5:   Calc c-RSUs delay-bounded coverage gain gc(i) according to Equation (10);
6: end for
7: for all unselected viU and vi is with the transmission range of an existing RSU do
8:   Calc w-RSUs delay-bounded coverage gain gw(i) according to Equation (10);
9: end for
10: v* = {vi ∣ max{uc(l), uw(k)}, ∀viV };
11: if install a c-RSU and the placement cost is not exceed the budget Bthen
12:    Inline graphicc = Inline graphicc ∪{v*};
13: else
14:   if install a c-RSU and the placement cost is exceed the budget Bthen
15:     v* = {vi ∣ max{uw(k)}, ∀viV };
16:   end if
17: end if
18: if install a w-RSU and the placement cost is not exceed the budget Bthen
19:    Inline graphicw = Inline graphicw ∪{v*};
20: end if
21: if install a c-RSU or w-RSU and the placement cost is not exceed the budget Bthen
22:   V = V \ {v*};
23:    Inline graphic = Inline graphicInline graphicv*;
24: end if
25: end while
26: return Inline graphicc, Inline graphicw