• No results found

3.4 Bound Selection

3.4.1 Procedure PC-bs-ILP

The following bound selection algorithm PC-bs-ILP is based on the idea that bound choices of two prime constituents need to share an element from {l, u} if and only if they are conjunctively associated. To achieve this the algorithm constructs and solves the system (3.1) for any given PC decomposition P of ϕ. As a result, the algorithm fixes the bound choice B of each prime constituent in the PC decomposition P of ϕ.

Steps 1–2 of the algorithm solve the 0-1 ILP system (3.1) for a PC decom- position P of ϕ. For this we use ILP-construct, which first constructs the system (3.1) without explicitly constructing the conjunctive associativity graph

G(ϕ, P ).

Steps 4–6 ensure that the bound choice B of each Gauss prime constituent is nonempty, and that B is not {l, u}. We ensure that the latter condition holds only to prevent including both (−∞, (), ∅) and (∞, (), ∅) into E when P contains exclusively Gauss prime constituents, because in such a case only one of ±∞ is needed.

Algorithm PC-bs-ILP(P, ϕ, x).

Input: a PC decomposition P of ϕ w.r.t. x.

Output: a PC decomposition P0 of ϕ w.r.t. x containing only prime constituents with fixed bound choices B.

1. (f, C) := ILP-construct(P, ϕ, x) 2. Compute a solution s of the system C.

3. For each µ ∈ P at position π with type Υ ∈ {COGAUSS, AT} do 3.1. B := ∅

3.2. If s(xl

π) = 1, then B := B ∪ {l}.

3.3. If s(xu

π) = 1, then B := B ∪ {u}.

3.4. Fix the bound choice of µ to B. 4. Bg:= {l}

5. If there exists a variable xu

π such that s(xuπ) = 1, then Bg:= {u}.

6. For each µ ∈ P with type Υ = GAUSS do 6.1. Fix the bound choice of µ to Bg.

7. Return P .

Algorithm ILP-construct(P, ϕ, x).

Input: a PC decomposition P of ϕ w.r.t. x.

Output: a system C of 0-1 ILP constraints for ϕ and P as in (3.1). 1. (C, P0) := ILP-subroutine P, ϕ, x, ()

2. For each µ = (π, Υ, c, F , B) ∈ P0 do 2.1. C := C ∪ {xlπ+ xuπ ≥ 1}

3. Return C.

Algorithm ILP-subroutine(P, ϕ, x, π).

Input: a PC decomposition P of ϕ w.r.t. x, a position π ∈ Pos(ϕ).

Output: a pair (C, P0), where C is a system of 0-1 ILP constraints, and P0⊆ P is the set of co-Gauss and atomic prime constituents occurring in π(ϕ).

1. If π is a position of a co-Gauss or atomic prime constituent in P , then 1.1. Return (∅, {π}).

2. If π is a position of a Gauss prime constituent in P or a leaf position, then 2.1. Return (∅, ∅).

3. For each child position π|1, . . . , π|n of π do 3.1. (Ci, Pi0) := ILP-subroutine(P, ϕ, x, π|i) 4. C :=Sn i=1Ci 5. P0:=Sn i=1P 0 i

6.1. Return (C, P0).

7. If the top-level operator of π(ϕ) is “∧,” then

7.1. For each pair of PCs µi∈ Pi0 and µj ∈ Pj0 such that i < j, do

7.1.1. Let πi and πj be the positions of µi and µj, respectively.

7.1.2. C := C ∪ {xl πi+ x u πj ≥ 1, x u πi+ x l πj ≥ 1} 7.2. Return (C, P0).

It is easy to see that ILP-construct meets its specification and constructs system (3.1) for a given PC decomposition P of ϕ. Its worst-case running time is quadratic in the size of the structural tree for ϕ because of the loop in step 7 of ILP-subroutine. Consequently, algorithmPC-bs-ILP is correct as well. Reasonable Solutions of 0-1 ILP System C

Algorithm PC-bs-ILP picks in step 2 any solution s of the system C. Therefore, it is correct to assign each variable the value 1 to obtain a solution of C. However, it is of huge practical importance to obtain as small elimination set E as possible. Here we propose a few strategies towards achieving this goal. These strategies are based on the observation that we have to be careful and minimize the number of variables that are assigned the value 1 in a solution s.

To do this one first constructs a linear objective function κ in the variables S

π∈V{x l

π, xuπ}, where V is the set of vertices of the graph G(ϕ, P ) = (V, E),

i.e., the set of positions of all co-Gauss and atomic prime constituents in P . Minimizing κ w.r.t. the system C then prevents unnecessary 1-assignments in s. A simple objective function κ that ensures this is:

κ = X

π∈V

xlπ+ xuπ. (3.2)

Here we point to the fact that it is straightforward to adjust ILP-construct to also return this objective function κ for P and to minimize κ w.r.t. C in step 2 of PC-bs-ILP afterwards.

In practice one indeed wants to use an efficient 0-1 ILP solver [1] or a SAT solver with optimization functionality [40] for finding a solution of C with the smallest possible value of κ.

On the theoretical side observe that the facts that each constraint of (3.1) contains exactly two variables and that the objective function κ from (3.2) is linear ensure that this optimization problem can be reduced to the minimum weighted vertex cover problem. This is a well-studied combinatorial optimiza- tion problem [4, 5, 57, 24]. However, it is possible that the special structure of the graph—that always comes to existence from G(ϕ, P )—allows for more efficient approximation and kernelization algorithms.

Now we return to our Example 65 where we showed three colorings χl,

χu, and χ. The values of the objective function κ from (3.2) for these three

colorings are 5, 5, and 6, respectively. Observe, however, that the cost 5 of χl

does not really correspond with the produced structural test points: The prime constituent at position π4 added one to the objective function value (because

s(xlπ4) = 1 and s(x

l

π4) = 0 in this case) even though it does not produce any test point.

Therefore, it can make sense to multiply the variables in (3.2) by weights

wlπ and wuπ, respectively. Intuitively, it should be then possible to estimate the costs of produced test points more precisely. Consequently, such an adjusted κ should guide a solver towards such solutions of the system C that are expected to yield “nicer” elimination sets after PC-to-TPs.

As an example that it can make a significant difference for a prime con- stituent whether its lower bound candidate solutions or upper bound candidate solutions are used to obtain test points we consider the atomic formula f ≤ 0, where f = x3+ ax2

+ bx + c and a, b, c ∈ Z[u]. For simplicity we do not use clustering. Since the leading coefficient of f is positive, there are only four potential real 3-types of f . What these real types look like was discussed in Subsection 2.5.2. The following parametric root descriptions cover weak lower bounds of Φ(f ≤ 0, a) for any parameter values a ∈ Rm:

f, (3, 2), f, (4, 2).

At the same time, parametric root descriptions covering weak upper bounds of Φ(f ≤ 0, a) for any parameter values a ∈ Rmare

f, (1, 1), f, (2, 1), f, (3, 1), f, (3, 2), f, (4, 1), f, (4, 3).

Recall that, for example, the root specification (3, 1) of f represents the first (counting from the left to the right) real root of f hai whenever f hai is of real type (−1, 0, 1, 0, 1). Assuming that the costs, i.e., the time and the length of the obtained formula, of substituting a parametric root description f, (t, r) are the same regardless of the root specification (t, r) one would set wl

πto 2 and

wu

π to 6. Therefore, xlπ+ xuπ would be replaced with 2xlπ+ 6xuπ in the objective

function (3.2). Here π is the position of the atomic prime constituent f ≤ 0 in the formula ϕ.

For our Example 65 a weighted objective function κ based on the approach we have just described would look as follows:

κ = xlπ 1+ x u π1+ x l π2+ 0 · x u π2+ x l π3+ 0 · x u π3+ 0 · x l π4+ x u π4+ 0 · x l π5+ x u π5. The costs of the three admissible colorings χl, χu, and χ with respect to κ are

then 3, 3, and 2, respectively.

One could go even further and analyze the degree of f , the degrees of the parameters occurring in f , the number of recursive lower-degree virtual substi- tutions and lengths of the virtual substitution formula schemes of Appendix A to adjust the weights wl

πand wπuof prime constituents in P even more precisely.

However, in most cases counting the number of root specifications producing a test point, as we have shown above, should already yield a good approximation of the actual costs of a prime constituent when its lower/upper bound candidate solutions are taken.