• No results found

Chapter 6 Modelling results

N/A
N/A
Protected

Academic year: 2021

Share "Chapter 6 Modelling results"

Copied!
14
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Chapter 6

Modelling results

In this chapter the algorithm discussed in the previous chapter will be used to solve problems. For a directed acyclic graph with a sink and source node the weight matrix will always have the form

W =            0 w(1, 2) w(1, 3) w(1, 4) · · · w(1, n) ∞ 0 w(2, 3) w(2, 4) · · · w(2, n) ∞ w(3, 2) 0 w(3, 4) · · · w(3, n) ∞ w(4, 2) w(4, 3) 0 · · · w(4, n) ... . .. ∞ ∞ ∞ ∞ · · · 0            .

In matrix W the first element in the first column, the last element in the last row and the diagonal contains zeros; the remaining elements in the last row and first column are ∞.

(2)

6.1

Problem 1

6.1.1

Part A

We apply the algorithms discussed in the previous chapter on a real world problem. Let the problem be an owner of a transport company requiring the shortest route from Potchefstroom to Bethlehem. Therefore in a directed graph Potchefstroom will be the source node and Bethlehem the sink. Be-tween the sink and the source there are 6 nodes (cities). Label the cities as follows:

Node number City

1 Potchefstroom 2 Parys 3 Sasolburg 4 Viljoenskroon 5 Heilbron 6 Kroonstad 7 Frankfort 8 Bethlehem

The distances between the cities are

From To Distance Potchefstroom Parys 49.3 Potchefstroom Sasolburg 100 Potchefstroom Viljoenskroon 62.5 Parys Sasolburg 42.8 Sasolburg Heilbron 58.4 Sasolburg Kroonstad 124 Sasolburg Frankfort 111 Viljoenskroon Kroonstad 59.7 Heilbron Kroonstad 94.3 Heilbron Bethlehem 133 Kroonstad Bethlehem 140 Frankfort Bethlehem 118

(3)

This data are available on google maps. The data in matrix form will be W =                0 49.3 100 62.5 ∞ 0 42.8 ∞ ∞ 0 58.4 124 111 ∞ ∞ ∞ 0 ∞ 59.7 ∞ ∞ ∞ ∞ ∞ ∞ 0 94.3 ∞ 133 ∞ ∞ ∞ ∞ ∞ 0 ∞ 140 ∞ ∞ ∞ ∞ ∞ ∞ 0 118 ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0               

and the tree graph is as shown in figure 6.1.

0 0.2 0.4 0.6 0.8 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 height = 5 1 2 3 5 8 6 7 8 8 3 5 6 8 8 8 8 6 6 4

Figure 6.1: Tree graph

Application of the two algorithms Matlab codes 7.1.1 and 7.1.2 provide the following results

(4)

Dijkstra’s algorithm

shortest path cost = 262.2000 and

path = 9 1 2 1 3 4 3 6.

The sequence path illustrates the best previous node, which can be inter-preted as the shortest path is 1 → 4 → 6 → 8 with cost 262.2.

Floyd-Warshall algorithm The new weight matrix will be

weight =                0 49.3 92.1 62.5 150.5 122.2 203.1 262.2 ∞ 0 42.8 ∞ 101.2 166.8 153.8 234.2 ∞ ∞ 0 ∞ 58.4 124.0 111.0 191.4 ∞ ∞ ∞ 0 ∞ 59.7 ∞ 199.7 ∞ ∞ ∞ ∞ 0 94.3 133.0 ∞ ∞ ∞ ∞ ∞ 0 140.0 ∞ ∞ ∞ ∞ ∞ ∞ 0 118.0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0               

and the new path matrix

path =                1 2 2 4 3 4 3 6 1 2 3 4 3 3 3 5 1 2 3 4 5 6 7 5 1 2 3 4 5 6 7 6 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8                .

(5)

The shortest path from the sink to the source is found by interpreting p(1, 8) = 6 and p(6, 8) = 8, which implies the path is 1→ 6 → 8. To obtain the path from node one to node six look at p(1, 6) = 4 and p(4, 6) = 6, which imply the path is 1 → 4 → 6. Then p(1, 4) = 4, which implies the path is 1→ 4. Thus the same results are found; the shortest path is 1 → 4 → 6 → 8 with cost 262.2. In order words the shortest route is Potchefstroom, Viljoen-skroon, Kroonstad to Bethlehem.

6.1.2

Part B

If factors such as roadworks, accidents and the condition of the road are taken into consideration, the choice of a path will no longer only depend on the distance. In order to take these factors into consideration and still determine the shortest path, we formulated the following criteria: For the condition of the road we assign a mark on a scale of 1− 3 with 1 good, 2 poor and 3 very poor. For the conditions of roadworks, 1 for no roadworks, 2 for roadworks that do not affect all the lanes and 3 for stop and go. Lastly accidents 1 if there are no accidents, 2 there was an accident but it does not affect all the lanes and 3 there was an accident and the road is temporarily closed. For example

From To condition of the road roadworks accident total

Potchefstroom Parys 2 2 1 5 Potchefstroom Sasolburg 2 3 2 7 Potchefstroom Viljoenskroon 3 3 1 7 Parys Sasolburg 2 1 3 6 Sasolburg Heilbron 1 1 1 3 Sasolburg Kroonstad 1 2 2 5 Sasolburg Frankfort 1 2 2 5 Viljoenskroon Kroonstad 2 3 1 6 Heilbron Kroonstad 3 1 3 7 Heilbron Bethlehem 1 3 2 6 Kroonstad Bethlehem 1 1 1 3 Frankfort Bethlehem 1 1 2 4

(6)

greater than 6. Thus we remove the sections Potchefstroom to Salsolburg (node 1 to node 3), Potchefstroom to Viljoenskroon (node 1 to node 4) and Heilbron to Kroonstad (node 5 to node 6). Node 1 has three successors, 2, 3 and 4, but for this specific problem the only possible successor is 2. Node 5 has two successors, 6 and 8, but for this specific problem the only possible successor is 8. Therefore, the only possible path is 1→ 2 → 3 → 5 → 8, i.e.

Potchefstroom → Parys → Sasolburg → Heilbron → Bethlehem.

6.1.3

Part C

Another example

From To condition of the road roadworks accident total

Potchefstroom Parys 2 2 1 5 Potchefstroom Sasolburg 2 3 1 6 Potchefstroom Viljoenskroon 3 3 1 7 Parys Sasolburg 2 1 3 6 Sasolburg Heilbron 1 1 1 3 Sasolburg Kroonstad 1 2 2 5 Sasolburg Frankfort 1 2 2 5 Viljoenskroon Kroonstad 2 3 1 6 Heilbron Kroonstad 3 1 2 6 Heilbron Bethlehem 2 3 2 7 Kroonstad Bethlehem 3 3 1 7 Frankfort Bethlehem 1 1 2 4

If we look at figure 6.1 and remove the part of the paths that have a total greater than 6 we will see that the branch on the right-hand side is no longer applicable. The new weight matrix will be

(7)

W =              0 49.3 100 ∞ 0 42.8 ∞ ∞ 0 58.4 124 111 ∞ ∞ ∞ 0 94.3 ∞ ∞ ∞ ∞ 0 ∞ ∞ ∞ ∞ ∞ 0 118 ∞ ∞ ∞ ∞ ∞ ∞ 0              where

Node number City

1 Potchefstroom 2 Parys 3 Sasolburg 4 Heilbron 5 Kroonstad 6 Frankfort 7 Bethlehem

With the Matlab codes 7.1.1 and 7.1.2, the results will be as follows:

Dijkstra’s algorithm

shortest path cost = 321.1000

and

path = 8 1 2 3 3 3 6.

(8)

Floyd-Warshall algorithm weight =              0 49.3 92.1 150.5 216.1 203.1 321.1 ∞ 0 42.8 101.2 166.8 153.8 271.8 ∞ ∞ 0 58.4 124.0 111.0 229.0 ∞ ∞ ∞ 0 94.3 ∞ ∞ ∞ ∞ 0 ∞ ∞ ∞ ∞ ∞ 0 118.0 ∞ ∞ ∞ ∞ ∞ ∞ 0              and path =              1 2 2 3 3 3 6 1 2 3 3 3 3 6 1 2 3 4 5 6 6 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7              .

The shortest path from the sink to the source is found by interpreting p(1, 7) = 6 and p(6, 7) = 7, which implies the path is 1→ 6 → 7. To obtain the path from node one to node six look at p(1, 6) = 3 and p(3, 6) = 6, which implies the path is 1 → 3 → 6. Then p(1, 3) = 2 and p(2, 3) = 3, which im-plies the path is 1→ 2 → 3. Thus the shortest path is 1 → 2 → 3 → 6 → 7. The cost of the shortest path is 321.1000. Thus the path is Potchefstroom, Parys, Sasolburg, Frankfort to Bethlehem.

6.2

Problem 2

6.2.1

Part A

If a forensic expert has a bloodstain with diameter, D1 = 3.5 mm, it will

(9)

velocity is in the interval v0 = 5ms−1 and less. This scenario using equation

3.11 is plotted in figure 3.4, where we have assumed the initial height is 2m. If we place a grid on the figure 3.4, then we obtain figure 6.2. In figure 6.2 each line represents the displacement of a droplet over time.

0 0.25 0.5 0.75 1 1.25 1.5 2 2.025 2.05 2.075 2.1 2.125 Time Distance

Figure 6.2: Distances fall over time

Then for the time 0, 0.75 and 1.5 we can determine the probability of an object being present. In figure 6.2 there are 11 lines, so in order to calculate the probability we count the number of lines in a half block radius from the point. Further, assume that the probability is never 1 or 0, but 0.99 and 0.01 respectively.

(10)

p0 i p0.75i ρ1.5i p02 = 0.99 p0.752 = 0.01 p1.52 = 0.01 p02.0125 = 0.36 p0.75 2.0125 = 0.01 p1.52.0125= 0.01 p02.025 = 0.36 p0.752.025 = 0.01 p1.52.025= 0.01 p0 2.0375 = 0.01 p0.752.0375 = 0.18 p1.52.0375= 0.01 p02.05 = 0.01 p0.752.05= 0.36 p1.52.05= 0.01 p02.0625 = 0.01 p0.75 2.0625 = 0.45 p1.52.0625= 0.01 p0 2.075 = 0.01 p0.752.075 = 0.01 p1.52.075= 0.01 p0 2.0875 = 0.01 p0.752.0875 = 0.01 p1.52.0875= 0.45 p02.1 = 0.01 p0.752.1 = 0.01 p1.52.1 = 0.36 p02.1125 = 0.01 p0.75 2.1125 = 0.01 ρ1.52.1125 = 0.18

For each of the probabilities calculate with equation 5.2 the cost for the directed edge and the sum of each row a column.

Cost Cost Cost Sum

c(e0 2,j) = −4.5951 c(e 0,75 2,j ) = 1.9956 c(e 1,5 2,j) = 1, 9956 P tc(e t 2,j) = −0.6039 c(e0 2.0125,j) = 0.5754 c(e 0,75 2.0125,j) = 1.9956 c(e 1,5 2.0125,j) = 1.9956 P tc(et2.0125,j) = 4.5666 c(e0 2.025,j) = 0.5754 c(e 0,75 2.025,j) = 1.9956 c(e 1,5 2.025,j) = 1.9956 P tc(e t 2.025,j) = 4.5666 c(e0 2.0375,j) = 1.9956 c(e0,752.0375,j) = 1.5164 c(e 1,5 2.0375,j) = 1.9956 P tc(e t 2.0375,j) = 5.5076 c(e0 2.05,j) = 1.9956 c(e 0,75 2.05,j) = 0.5754 c(e 1,5 2.05,j) = 1.9956 P tc(e t 2.05,j) = 4.5666 c(e0 2.0625,j) = 1.9956 c(e 0,75 2.0625,j) = 0.2007 c(e 1,5 2.0625,j) = 1.9956 P tc(et2.0625,j) = 4.1919 c(e0 2.075,j) = 1.9956 c(e 0,75 2.075,j) = 1.9956 c(e 1,5 2.075,j) = 1.9956 P tc(e t 2.075,j) = 5.9868 c(e0 2.0875,j) = 1.9956 c(e 0,75 2.0875,j) = 1.9956 c(e 1,5 2.0875,j) = 0.2007 P tc(e t 2.0875,j) = 4.1919 c(e0 2.1,j) = 1.9956 c(e 0,75 2.1,j) = 1.9956 c(e 1,5 2.1,j) = 0.5754 P tc(e t 2.1,j) = 4.5666 c(e0 2.1125,j) = 1.9956 c(e 0,75 2.1125,j) = 1.9956 c(e 1,5 2.1125,j) = 1.5164 P tc(e t 2.1125,j) = 5.5076 P ic(e0i,j) = 10.5249 P ic(e 0,75 i,j ) = 16.2617 P ic(e 1,5 i,j) = 16.2617 .

Using equation 5.3 the shortest path can be calculated. To determine the shortest path with the use of Dijkstra and Floyd-Warshall algorithm we need the elements of the weight matrix. We calculate the elements as follows:

X t,i c(et i,j) X j∈N(i) fi,jt . (6.1) To determine P

(11)

area of the point, 1 if there are one or two lines in the area and 2 if there are more than two lines. Then P

j∈N(i)f(i,j)0 for the following j values will have

a value X j∈N(i) f(2,2.0375)0 = 1 X j∈N(i) f(2,2.05)0 = 2 X j∈N(i) f(2,2.0625)0 = 2 X j∈N(i) f(2,2.075)0 = 1

for the rest of the j values the sum will be zero. Also for P

j∈N(i)f 0,75 (i,j) the values will be X j∈N(i) f(2.0375,2.0875)0.75 = 1 X j∈N(i) f(2.05,2.0875)0.75 = 2 X j∈N(i) f(2.0625,2.1)0.75 = 2 X j∈N(i) f(2.075,2.1125)0.75 = 1

(12)

Then using these facts and equation 6.1 we obtain X t=0,i c(et 2,2.0375) X j∈N(i) f(2,2.0375)0 = −4.5951 × 1 = −4.5951 X t=0,i c(et 2,2.05) X j∈N(i) f(2,2.05)0 = −4.5951 × 2 = −9.1902 X t=0,i c(et2,2.0625) X j∈N(i) f(2,2.0625)0 = −4.5951 × 2 = −9.1902 X t=0,i c(et 2,2.075) X j∈N(i) f(2,2.075)0 = −4.5951 × 1 = −4.5951 X t,i c(et2.0375,2.0875) X j∈N(i) f(2.0375,2.0875)0.75 = 1.5164× 1 = 1.5164 X t,i c(et 2.05,2.0875) X j∈N(i) f(2.05,2.0875)0.75 = 0.5754× 2 = 1.1508 X t,i c(et 2.0625,2.1) X j∈N(i) f(2.0625,2.1)0.75 = 0.2007× 2 = 0.4014 X t,i c(et 2.075,2.115) X j∈N(i) f(2.075,2.1125)0.75 = 1.9956× 1 = 1.9956.

If we refer back to figure 4.5 the source and the sink do not represent any position. In figure 4.5 time zero is in our case t = 0, time 1 is t = 0.75 and time 2 is t = 1.5. Therefore, the weight matrix will be

W =                          0 1 1 1 1 1 1 1 1 1 1 ∞ ∞ 0 ∞ ∞ −4.5951 −9.1902 −9.1902 −4.5951 ∞ ∞ ∞ 1 ∞ ∞ 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 1 ∞ ∞ ∞ 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ 1 ∞ ∞ ∞ ∞ 0 1.5164 1 ∞ ∞ ∞ ∞ ∞ 0 1.1508 1 ∞ ∞ ∞ ∞ ∞ ∞ 0 0.4014 1 ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 1.9956 1 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 1 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 1 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 1 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0                          .

(13)

We have constructed the weight elements from the source to all the other nodes, except the sink, unity and the weight elements from any node, except the source, to the sink also unity. The weight matrix has negative weight, therefore only the Floyd-Warshall algorithm can be used to determine the shortest path. Using Matlab code 7.1.2 we obtain the following results

Floyd-Warshall algorithm weight =                          0 1 1 1 −3.6 −8.2 −8.2 −3.6 −7.0 −7.8 −1.6 −7.2 ∞ 0 ∞ ∞ −4.6 −9.2 −9.2 −4.6 −8.0 −8.8 −2.6 −8.2 ∞ ∞ 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 1.0 ∞ ∞ ∞ 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ 1.0 ∞ ∞ ∞ ∞ 0 ∞ ∞ ∞ 1.5 ∞ ∞ 1.0 ∞ ∞ ∞ ∞ ∞ 0 ∞ ∞ 1.2 ∞ ∞ 1.0 ∞ ∞ ∞ ∞ ∞ ∞ 0 ∞ ∞ 0.4 ∞ 1.0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 2.0 1.0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 1.0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 1.0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0 1.0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 0                          path =                          1 2 3 4 2 2 2 2 6 7 8 6 1 2 3 4 5 6 7 8 6 7 8 6 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12                          .

(14)

Thus for this specific problem the solution of equation 5.3 is f∗

=−7.1902

with the path 1→ 2 → 6 → 12.

6.3

Results

The two problems are real world problems. The first problem illustrated the calculation of a shortest path through a network when there are no additional constraints and when there are additional constraints. The second problem is based on a blood stain problem. We have solved the problem using multi-target tracking techniques.

Referenties

GERELATEERDE DOCUMENTEN

Ever since the Reformation the providence of God has been variously applied in the doctrine of scripture. In the Reformed and Protestant Orthodox traditions, and in the

Eighteen studies were excluded from the quantitative analysis as they did not provide information on cancer incidence or mortality, but rather on stage or grade of cancer (4

In order to better understand the proposed model and provide a clearer picture of how entrepreneurial spirit can affect self-perceived employability while taking soft skills

Participants in the experimental condition had also more trials with overproduction in the prediction-motion task, while participants in the control condition had a similar.

- The greater the number of policy instruments in the climate policy domain that are being implemented in the local project arena, the better the degree of energy conservation in

Farmers Jatropha Research center Researchers Land Research grant Agricultural Network.. in Labuhan Alas Academic Network in

The central-decentral paradox 31 Depending on the mission, vision and strategic goals of the university as laid down in the institutional strategy, each university has to choose how

The most valuable acoustic properties to classify upon a male test set are the fundamental frequency, the first formant frequency and the difference between two intensity objects