• Keine Ergebnisse gefunden

Solving the SDP for One Component Efficiently

After outlining all of the pruning and fixing methods, one part of the algorithm for solving the SDP for one component is still missing: the procedure to execute these methods. As already discussed, we can expect to have to calculate PNds,tand FNds,t for extended component graphs with the same start and end nodes for different delay values. This means that is is possible (and effective) to use previous results as bounds for the current domain request. Algorithm 9.2 shows how this works in detail.

Algorithm 9.2:Calculating PNds,tand FNds,tfor one component

Input : Extended component graphGc, source nodes, target nodet, delay limitdand domain store Domains

Output: PNds,tand FNds,tofG

1 PosNodes pn,FixNodes fn;

// calculate pn (=PNds,t)

2 ifDomains.hasPosNodes(s,t,d)then pn=Domains.getPosNodes(s,t,d) else

3 PosNodes pnUB=Domains.getPosUB(s,t,d);

4 PosNodes pnLB=Domains.getPosLB(s,t,d);

5 ifpnUB==pnLBthenpn=pnUBelse

6 PosNodes pnToTest=pnUB∧(¬pnLB);// bit-vector operations

7 prune(s,t,d,pnToTest);// call one of the pruning methods

8 pn=pnLB∨pnToTest;

9 end

10 end

// calculate fn (=FNds,t)

11 ifDomains.hasFixNodes(s,t,d)then fn=Domains.getFixNodes(s,t,d) else

12 FixNodes fnUB=Domains.getFixUB(s,t,d);

13 FixNodes fnLB=Domains.getFixLB(s,t,d);

14 iffnUB==fnLBthenfn=fnUBelse

15 RestrictGraph Gr=restrict(Gc,pn);

16 FixNodes fnToTest=pn∧fnLB∧(¬fnUB);

17 fix(s,t,d,fnToTest,Gr);// call one of the fixing methods

18 fn=fnUB∨fnToTest;

19 end

20 end

// store calculated domains, return

21 Domains.setPosDomain(s,t,d,pn);

22 Domains.setFixDomain(s,t,d,fn);

23 Domains.simplify(s,t,d);

24 returnpn,fn;

The input of the preprocessing algorithm for a component cis the extended component graph Gc, the data for the required connection (source and target nodes, maximum allowed delay) and the store for previously calculated PNds,tand FNds,twithin this component.

The first step of the algorithm is calculating PNds,t. If PNds,t is already present in the domain store, then there is nothing more to do. Otherwise, we use the results of previous calls as upper and lower bounds. The upper bound is a previously calculated PNds,t0 withd0 > dbut as small as possible. If no such domain has been calculated before, then it isVc. Obviously, if there is no simple path using a node withind0, then there will be none withind, so PNds,tis a subset of PNds,t0. Similarly, we try to find a lower bound PNds,t00 withd00 < dbut as large as possible. If no such domain has been calculated, then it is the empty set. If there is a simple path using a node within d00, then this path is of course still valid with delay boundd, so all nodes in PNds,t00also belong to PNds,t. If the upper and lower bounds are equal, then we already know PNds,t and nothing more needs to be done. Otherwise, the nodes that are included in PNds,t0 , but not in PNds,t00, are the ones we still need to test whether they belong to PNds,t, which is stated in line 6. Note that we assume a bit-vector representation of the domains, so we can apply bit-wise logical operators. After determining which nodes need to be tested, we apply one of the pruning methods discussed previously. The pruning method will remove all nodes from the nodes to test that do not belong to PNds,t. It is free to ignore the input about nodes to test. The Path Enumeration method for instance cannot use it, the All Pair Shortest Path method on the other hand can and does use it. The final PNds,tis then assembled from the lower bound and the nodes that have passed the pruning.

The second step of the algorithm determines FNds,t. It works basically the same way as the first step. One thing to note here is that the term upper bound still refers to a domain that was derived by allowing more delay and lower bound refers to a domain where less delay was allowed. The result is that for fixed nodes, the upper bound will contain fewer nodes than the lower bound.

In case no suitable upper or lower bounds have been calculated, the upper bound will be the empty set and the lower boundVc. For calculating the nodes for which we have to test whether they belong to FNds,t (line 16), that means we have to test all nodes that belong to PNds,t and are present in lower bound, but not in the upper bound. The restriction to PNds,t is especially useful at the beginning when no suitable lower bound is known. One of the discussed fixing methods is then called with the nodes to test and removes all nodes that do not belong to FNds,t. As an additional input, the fixing method gets the extended component graph, restricted by the possible nodes. This for instance increases the efficiency of path calculations, because parts of the extended component graph are removed.

The last step of the algorithm is storing the calculated domains in the domain store, followed by a simplification step. The main idea here is that it is not necessary to store all calculated domains, because a lot of them will be the same. It is sufficient to store the same domain only twice; for the lowest and the highest delay for which this domain occurred. As a consequence, the memory requirements for storing domains can be reduced. On the other hand, the probability of finding exactly the requested domain already present in the domain store is decreased, but we will still get the same upper and lower bounds and save execution time that way.

1

2

3

4 1

3

1

3

1 1

Figure 9.10: FNds,tcan change without PNds,tchanging.

As an implementation remark, note that PNds,t and FNds,t are stored completely independently from each other, because changing delays can add or remove nodes from one without affecting the other. It is easy to see that changing delay may change PNds,twithout changing FNds,t. Just think about a graph without fixed nodes where increasing the delay bound might add nodes to PNds,t. The other direction is also possible, Figure 9.10 shows an example. For simplicity reasons we omitted the nodes for every arc. It holds that PN51,4 = PN61,4 = {1,2,3,4}, but FN51,4 ={1,2,4}and FN61,4 ={1,4}. The main insight here is that even with perfect pruning, the resulting graph can contain delay-infeasible paths. This means that an incomplete fixing method that does not take delays into account applied to a pruned extended component graph derived by a complete pruning algorithm will still be incomplete. In this example, the fixing method cannot distinguish the situations for delay5and6.