• No se han encontrado resultados

Tema: Gasto en Comisiones de Ventas y de Mantención de Clientes

In this section we consider different types of constraints from simple clause constraints to Pseudo-Boolean constraints. The constraint types occur in different normal forms and applications.

Clauses

One of the most simple constraint types is a clause, which is a disjunction l1 ∨ . . . ∨

ln of literals l1, . . . , ln. Clauses play a key role for the conjunctive normal form (see

Subsection 2.1.2) and in the encoding of many applications.

Cardinality Constraints

For a set of literals, cardinality constraints restrict the number of simultaneously satisfied literals. Such a restriction can be very useful in many applications, such as restricting the set of engine variables assigned to true to exactly one. Another application is the usage of cardinality constraints within SAT-based optimization like MaxSAT in order to narrow the search space, see Chapter4.

Definition 15. (Cardinality Constraint) A cardinality constraint is a restricted sum of

literals by a non-integer k ∈ N0 of the form:

n

X

i=1

liB k, for B ∈ {<, ≤, >, ≥, =}

We say a cardinality constraint Pn

i=1li B k is satisfied under an assignment β if the

resulting integer of the sum Pn

i=1li satisfies the relation B with the right hand side k.

In this context, the evaluation of a literal li under β is considered as integer 0 (false)

or 1 (true) to allow algebraic operations, i.e., the addition of the truth values.

Proposition 4. (Cardinality Constraint Normalization) Any arbitrary cardinality con-

straint Pn

i=1liB k can be normalized to a semantically equivalent conjunction of cardi- nality constraints, each of the form

n

X

i=1 li0 ≥ k0

with k0 ∈ N0 and l0i ∈ {li, ¬li} for all i ∈ {1, . . . , n} by iteratively applying the following steps:

a) (Relation Normalization) If the relation B is not ≤ distinguish the following cases: a) (<) Transform: Pn i=1li < k ≡Pni=1li ≤ k − 1. b) (=) Transform: Pn i=1li = k ≡ Pn i=1li ≤ k ∧ Pn i=1li ≥ k. Repeat the normalization process for the constraint Pn

i=1li ≤ k. c) (>) Transform: Pn i=1li > k ≡ Pn i=1li ≥ k + 1. d) (≤) Transform: Pn i=1li ≤ k ≡Pni=1¬li ≥ n − k. b) (Trivial Cases) a) If k ≤ 0, return >. b) If n < k, return ⊥.

Proof. The equivalences can be shown by applying arithmetic equivalence transforma-

tions (cf. [Barth, 1995]).

To encode a cardinality constraint Pn

i=1li ≤ k as a CNF in Propositional Logic we can

exclude all combinations of k + 1 simultaneously true assigned literals of {l1, . . . , ln}:

^ M ⊆{1,...,n} |M |=k+1 _ i∈M ¬li

This encoding requires no additional auxiliary variables, but requires k+1n clauses. For the worst case of k = dn/2e − 1 the number of clauses is O(2n/qn/2) [Sinz, 2005].

In contrast to the direct approach described above, more compact encodings for car- dinality constraints in CNF have been developed by making use of auxiliary variables. Table 2.5, taken from [Sinz, 2005], gives a brief overview of some encodings and their respective sizes in terms of the number of clauses and auxiliary variables. Additionally, encodings can be distinguished by the time needed to decide about the encoding (column “decided”).

Table 2.5: Comparison of cardinality constraints encodings

Encoding #clauses #aux. vars decided

Naïve k+1n  0 immediately

Sequential unary counter (LTn,kSEQ) [Sinz, 2005] O(n · k) O(n · k) by unit prop. Parallel binary counter (LTn,kPAR) [Sinz, 2005] 7n − 3 blog nc − 6 2n − 2 by search Bailleux & Boufkhad [Bailleux and Boufkhad, 2003] O(n2) O(n · log n) by unit prop.

The special case Pn

i=1li ≤ 1, meaning that at most one literal is allowed to evaluate to

true, plays an important role for many applications. For example, a radio of a vehicle is optional but there must not be more than one radio. The naïve encoding, not using any auxiliary variables, for this constraint results in O(n2) clauses: V

i=1

Vn

j=i(¬li∨ ¬lj).

A clause l1∨ . . . ∨ ln is a special case of the at least one cardinality constraint: l1∨ . . . ∨ ln

n

X

i=1 li ≥ 1

Combining the at least one and the at most one constraints, we ensure that exactly one literal is satisfied. For example, every car has exactly one engine.

In this work, we denote the usage of cardinality constraints within Propositional Logic by cnf(Pn

i=1liB k) and mean that the restricted sum is encoded in CNF by any of the

encoding methods mentioned above.

Pseudo-Boolean Constraints

A more expressive type of constraints than cardinality constraints are pseudo-Boolean

constraints [Roussel and Manquinho, 2009] which allow integer weights for the literals, i.e., the weighted sum of literals is restricted to an integer. Pseudo-Boolean constraints find many applications, e.g., to narrow the search space within weighted MaxSAT, see Chapter 4.

Definition 16. (Pseudo-Boolean Constraint) A (linear) pseudo-Boolean constraint

(PBC) is a restricted sum of weighted literals of the form:

n

X

i=1

wi· li B k

With wi ∈ Z and literal li for all i = {1, . . . , n}, k ∈ Z and B ∈ {<, ≤, >, ≥, =}.

We say a pseudo-Boolean constraintPn

i=1wi· liB k is satisfied under an assignment β if

the resulting integer of the sum Pn

i=1wi · li satisfies the relation B with the right hand

side k. In this context, the evaluation of a literal li under β is considered as integer 0

(false) or 1 (true) to allow algebraic operations.

Proposition 5. (Pseudo-Boolean Constraint Normalization) Any pseudo-Boolean con-

straint Pn

i=1wi · li B k can be normalized to a semantically equivalent conjunction of pseudo-Boolean constraints, each of the form

n0 X i=1 wi0· l0 i ≥ k 0

with wi0 ∈ N0 for all i ∈ {1, . . . , n}, k0 ∈ N0, l0i are literals for all i ∈ {1, . . . , n} by iteratively applying the following steps:

a) (Eliminating Redundant Terms) Remove each term wi· li where wi = 0.

b) (Relation Normalization) If the relation B is not ≤ distinguish the following cases: a) (<) Transform: Pn

i=1wi· li < k ≡ Pni=1wi· li ≤ k − 1. b) (=) Transform: Pn

i=1wi· li = k ≡ Pni=1wi· li ≤ k ∧Pni=1wi· li ≥ k. Repeat relation normalization process for the first PBC.

c) (>) Transform: Pn

i=1wi· li > k ≡ Pni=1wi· li ≥ k + 1. d) (≤) Transform: Pn

i=1wi· li ≤ k ≡Pni=1−wi· li ≥ −k.

c) (Eliminating Negative Weights) For each term wiliwith wi < 0 replace the term wili by −wi¬li and add the term −wi to k.

d) (Trivial Cases)

a) If k ≤ 0, return >. b) If Pn

i=1wi < k, return ⊥.

Proof. The equivalences can be shown by applying arithmetic equivalence transforma-

tions (cf. [Barth, 1995]).

To simplify reading, the negation of a variable x within a pseudo-Boolean constraint is often expressed by an overline x instead of ¬x. Example 11 shows a pseudo-Boolean constraint and its normal form.

Example 11. The following pseudo-Boolean constraint

3x1− 5x2− 10x3 ≥ 2

is satisfiable, e.g., a satisfying example is β = {¬x1, x2, ¬x3}. We transform this PBC

to its normal form as follows:

3x1− 5x2− 10x3 ≥ 2 ≡ −3x1+ 5x2+ 10x3 ≤ −2

≡ 3x1+ 5x2+ 10x3 ≤ 1

There have been several approaches developed on how pseudo-Boolean constraints can be encoded as Boolean formula [Bailleux et al., 2006, Bailleux et al., 2009, Warners, 1998,Aavani et al., 2013]. The authors of [Eén and Sörensson, 2006] give a good overview of different encodings which rely on BDDs, networks of adders or networks of sorters. A cardinality constraint Pn

i=1li B k, B ∈ {<, ≤, >, ≥, =} is a special case of a pseudo-

Boolean constraint with wi = 1 for all i ∈ {1, . . . , n}.

In this work, we denote the usage of pseudo-Boolean constraints within Propositional Logic by cnf (Pn

i=1wi· liB k) and mean that the restricted weighted sum is encoded in

Remark 3. (Pseudo-Boolean Solving) The satisfiability problem of pseudo-Boolean con-

straints (and cardinality constraints) can be solved either by (i) translating pseudo- Boolean constraints into Propositional Logic and solving a Boolean formula (as described in Section 2.2), or (ii) directly by a pseudo-Boolean solver (PBS) which works on the more expressive logic of pseudo-Boolean constraints. Modern pseudo-Boolean solvers use adapted techniques from CDCL SAT solvers such as unit propagation, watched literals, conflict analyses with constraint learning and non-chronological backtracking. See [Chai and Kuehlmann, 2003,Chai and Kuehlmann, 2005,Sheini and Sakallah, 2005] or [Roussel and Manquinho, 2009] for a good overview article. There exist different learning schemes for pseudo-Boolean solving [Santos and Manquinho, 2008,Roussel and Manquinho, 2009]: clause learning, cardinality constraint learning and pseudo-Boolean constraints learning. The satisfiability problem of pseudo-Boolean constraints is NP- complete, even for a set of two normalized pseudo-Boolean constraints only [Roussel and Manquinho, 2009].