Information Technology Reference
In-Depth Information
If no match is detected, we assign a score of 0. Note, that we require
ω>τ
. The actual
values used for evaluation are given in table 2.
Score
max
is defined as
|P|−
1
i
=0
score
score
max
, yielding
to a value in the range
[0
,
1]
where larger values denote higher priority in selecting the
next vertex for
P
. Finally, we assign the weight
β
and store heuristic
h
2
in
v
(line 14).
Heuristic 2 is trying to optimize path stability by preferring
v
ω
. Heuristic 2 is defined as
β
∗
V
whose own path
along
G
covers more of path
P
, the idea being that if
v
cannot find next vertex for
P
it at
least gets closer to the destination. In vehicular ad-hoc network terms we can interpret
this as preferring a vehicle that can carry the message closer to the destination in the
case when a more suitable vehicle cannot be found.
∈
Algorithm 4.
Heuristic 3: Edge weights along
P
1:
w
P
← P.totalWeight
2:
for all
(
v ∈ N
)
do
3:
e
v
← f
(
v,t
)
.e
4:
w ←
0
5:
if
(
e
v
∈ P
)
then
6:
for
(
i ←
0;
i<P.size−
2;
i
++)
do
7:
if
(
e
v
==
edge
(
P
[
i
]
,P
[
i
+1]))
then
w ← w
+
f
(
v,t
)
.w
8:
9:
break
10:
else
11:
w ← w
+
edge
(
P
[
i
]
,P
[
i
+1])
.w
12:
end if
13:
end for
14:
else
15:
leastWeight ←∞
16:
v ← nil
17:
for
(
i ←
0;
i<P.size−
1;
i
++)
do
18:
if
(
w
(
P
[
i
]
, v,t
)
<leastWeight
)
then
leastWeight ← w
(
P
[
i
]
, v,t
)
19:
20:
v ← P
[
i
]
21:
end if
22:
end for
23:
for
(
i ←
0;
i<P.size−
2;
i
++)
do
24:
if
(
P
[
i
]==
v
)
then
25:
break
26:
else
27:
w ← w
+
edge
(
P
[
i
]
,P
[
i
+1])
.w
28:
end if
29:
end for
30:
end if
w
w
P
)
31:
v.h
3
← γ ∗
(
32:
end for