• No results found

4.5

Minimising

IR

Calls in Solving

COMB

Until now, the complexity analysis was carried out under the assumption that checks to the inequality reasoning problem take constant time. However, in prac- tice, this problem is computationally expensive, so the practical aim is to lower the number of calls to the oracle IR. In this section, we discuss the benefits of using pair constraints to lower this number.

The brute force algorithm takes all combinations of changes, updates the system of (in)equalities with each combination to generate new systems, and uses

IR to check the consistency of each of these systems. This procedure uses an exponential number of calls to oracle IR, i.e. 2|C|, where C is the set of changes. In the two approaches presented in the previous section, calls to IR were done only when constructing the (bidirectional) co-occurrence graph, which used 2·|C|2

many calls, one for each ordered pair of changes, before calling IRagain to check the validity of each combination in the output.

Since now we want to minimise the size of the output with the information from the pair constraints, the entire information on these is needed. Moreover, we want to do this minimisation with as few calls to the oracle as possible. The intuition on how to do this is to find co-occurring sets of changes as fast as possible, and afterwards determine the dependencies between these. Observe that, because of the transitivity of relation →, the vertices of a cycle in the co- occurrence graph form a clique. In addition, since relations of the type ¬c1 →c2

are not pair constraints and those of type¬c1 → ¬c2 are redundant (see lemmas

4.2.1 and 4.2.2), extending our reasoning on¬C will not help identify cliques, as a change from ¬C can never be in the same clique with one from C.

Using these observations, we suggest the following procedure for identifying the co-occurring sets of changes and the pair constraints between them. As before, we assume that the input is some consistent system of (in)equalitiesS and some (ordered) set of changes on it C. For readability, we also assume that there is at most one change on each relation, but the generalisation is straightforward and does not change the results. By having this assumption, checks of membership in

PAIR are done with only one call to IR. We will refer to the following procedure asPCo−occurrence:

1. Start with the function clique(c) = c for all c∈ C. This labelling function will return, for each possiblec, which change is the representative one in its equivalence class.

2. Also, start withP air(c) =∅, whereP air(c) is the set of all pair constraints of typec→c0.

3. Construct the common set of relations, CommonS,C.

Take the first change (r, r0)∈ C such thatCommonS,C∪ {r0}∈/ IR, and, if it

exists, denote it byc⊥. Continue with the remaining changes, and for each c= (r, r0)∈ C such thatCommonS,C∪ {r0}∈/ IR, makeclique(c) = c⊥.

5. Find other cliques while keeping notes on the pair constraints that were already discovered.

(a) Let visited(c) = 0 iff clique(c)6=c⊥.

(b) Take each cs = (r, r0) ∈ C such that visited(cs) = 0. For each, start

with path = [cs] and do the following DFS procedure:

i. Let cl = (rl, r0l) be the last change in path.

ii. Take, in order, each change c ∈ C for which visited(c) = 0 and

cl 6= c. First process the changes that are not in path, and then

the other ones, in the order they appear inpath, from first to last: A. Check if cl → c, i.e. if CommonS,C ∪ {r0l, r} ∈/ IR. If true,

proceed to step B, otherwise, process the next change. If all changes were processed, proceed to step iii.

B. If c is in path, then for each c0 appearing in path after c, make clique(c0) = c, visited(c0) = 1, and remove c0 from path. Also remove c and make visited(c) = 1. Add to P air(cn) the

constraint cn →c, where cn is the new last element in path.

Otherwise, i.e. c is not inpath, add c at the end of path. C. Continue recursively from step i.

iii. Before backtracking, remove c from path, make visited(c) = 1, and add cl →cto P air(cl), where cl is the current last change in

path. Then backtrack and continue processing changes for cl.

6. Use the algorithm from theorem 4.4.4 to find the valid combinations for the co-occurrence graph with vertices inclique[C]− {c⊥}and edges from P air.

This will return a set of combinations Comb of representative changes.

7. Expand the representatives. In this step, for each combination set∈Comb, and any change c ∈ Q, add all the changes in the same equivalence class with cto Q, i.e. all c0 such that clique(c0) = c.

8. Return the updated set of combinations Comb.

Now, PCo−occurrence efficiently finds a super set of the valid combinations. Re-

garding the size of the final output, almost the same results hold as in the previous section. In case the number of cliques, i.e. |clique[C]|, is logarithmic in |C|, then the size of the output is polynomial. The same result is achieved when the mini- mum path cover number is constant.

The great benefit of this new procedure is that it does not check for deducible pair constraints. For example, for an existing path of the form c1 → c2 → c3,

Related documents