1. Trang chủ
  2. » Giáo Dục - Đào Tạo

(LUẬN VĂN THẠC SĨ) Au-dela de la consistance de domaine

50 3 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Au-delà de la consistance de domaine
Tác giả Yves Deville, Khong Minh Thanh, Jean Baptiste Mairy
Người hướng dẫn Yves Deville, Jean Baptiste Mairy
Trường học Institut de la Francophonie pour l’Informatique
Chuyên ngành Master 2
Thể loại thesis
Năm xuất bản 2015
Thành phố TIEU LUAN MOI
Định dạng
Số trang 50
Dung lượng 785,95 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Cấu trúc

  • Remerciements

  • Abstract

  • Résumé

  • Table des matières

  • Table des figures

  • Liste des tableaux

  • 1 Introduction

  • 2 Notions de base

    • 2.1 Préliminaires

    • 2.2 Résolution d'un CSP: Propagation et Recherche

      • 2.2.1 Propagation

      • 2.2.2 Recherche

    • 2.3 Consistance de domaine (DC)

    • 2.4 Les consistance plus faibles que DC

      • 2.4.1 Forward Checking (FC)

      • 2.4.2 Bound Consistency (BC)

  • 3 Consistances plus fortes que DC

    • 3.1 Consistances plus fortes que DC pour contraintes binaires

      • 3.1.1 Consistances à base de triangle

      • 3.1.2 Consistance selon le voisinage

      • 3.1.3 Consistance de singleton

      • 3.1.4 Résumé

    • 3.2 Consistances plus fortes que DC pour contraintes non binaires

      • 3.2.1 Restricted Pairwise Consistency (RPWC)

      • 3.2.2 relational Path Inverse Consistency (rPIC)

      • 3.2.3 Max Restrited Pairwise Consistency (Max-RPWC)

      • 3.2.4 Max Restricted 3-wise Consistency (Max-R3WC)

      • 3.2.5 Max Restricted k-wise Consistency (Max-RkWC)

      • 3.2.6 PWC+GAC

      • 3.2.7 kWC+GAC

      • 3.2.8 relational Neighborhood Inverse Consistent (rNIC)

      • 3.2.9 Singleton Generalized Arc Consistency (SGAC)

      • 3.2.10 Résumé

  • 4 Algorithmes de filtrage pour contraintes non binaires

    • 4.1 Algorithme générique

    • 4.2 Max-RPWC-1

    • 4.3 rPIC-1

    • 4.4 RPWC-1

    • 4.5 Max-RPWC-2

    • 4.6 Max-RPWC-3

    • 4.7 Résumé

  • 5 Achitecture d'AbsCon

    • 5.1 Les paquets dans AbsCon

    • 5.2 Représentation d'un CSP

    • 5.3 Résolution d'un CSP

    • 5.4 La propagation dans AbsCon

    • 5.5 DC

    • 5.6 SAC

    • 5.7 PWC+GAC

  • 6 Implémentation et expérimentation

    • 6.1 Implémentation

    • 6.2 Expérimentation

  • 7 Conclusion

  • Bibliographie

Nội dung

Pr´ eliminaires

A constraint satisfaction problem involves finding solutions for a network of constraints, where the assignment of values to variables must meet all specified conditions Each constraint defines a relationship between variables, indicating the permissible combinations of values for a subset of those variables.

D´efinition 2.1 (CSP) Un probl`eme de satisfaction de contrainte (CSP) (X, D(X), C) est compos´e par :

– un domaine D(X) = D(x1)∗ ã ã ã ∗D(xn) qui est le produit Cart´esien des domaines des variables de X,

– un ensemble de contraintesC ={c 1 , , ce} etvars(ci)∈X(1≤i≤e)

Un CSP est binaire ssi ses contraintes sont binaires Pour un CSP, on d´enote : n #X, e= #C, d=max1≤i≤n(#(D(x))) etk comme l’arit´e maximum des contraintes.

A constraint c(x₁, , xₖ) is defined as a relationship involving the variables x₁ through xₖ It is represented by (vars(c), rel(c)), where vars(c) includes the variables and rel(c) specifies the allowed value combinations for these variables The number k represents the arity of the constraint, with a binary constraint being one where k equals 2.

A constraint can be defined extensionally by providing a table for the relation, or intentionally through a formula or expression that describes the relation Two constraints, ci and cj, are considered to intersect if the variables of ci and cj share at least one common variable.

(3,3,2)}est d´efinie extensionnellement, elle autorise des tuples qui n’ont que les valeurs

2 et 3 Dans ce cas,vars(c) = (x 1 , x 2 , x 3 ) et (2,2,3)∈rel(c).

La contrainte allDifferent(x 1 , x 2 , x 3 ) ≡ (x 1 6= x 2 )∧(x 2 6= x 3 )∧(x 3 6= x 1 ) est d´efinie intentionnellement, elle autorise des tuples qui ont des valeurs diff´erentes pour chaque variable.

D´efinition 2.3 (Tuple) Pour une contraintec(x1, , x k )∈C

– Un tuple τ ∈ rel(c) est une liste des valeurs en ordre (a1, , a k ) τ est consid´er´e comme une assignation des variables {(x 1 , a 1 ), ,(x k , a k )}.

– τ ∈rel(c) estvalide ssi toutes les valeurs dans le tuple sont pr´esent´ees dans le domaine des variables correspondantes.

– Pour un sous ensemblevars 0 ofvars(τ),τ[vars 0 ] est un sous tuple deτ qui ne contient que l’assgination aux variables dans vars 0

– Pour deux tuples τ et τ 0 sur vars(c) = (x 1 , , x k ), on peut faire une comparaison lexicographique entre eux : τ < l τ 0 ssi il existe une sous s´equence (x1, , xj) de vars(c) tel que τ[x 1 , , x j ] =τ 0 [x 1 , , x j ] etτ[x j+1 ]< l τ 0 [x j+1 ].

D´efinition 2.4 (Assignation et solution) Etant donn´e un CSP (X, D(X), C),

– Une assignationssurvars(s) ={x 1 , , xk} ⊆Xest pr´esent´ee par{(x 1 , a1), ,(xk, ak)} o`ux i =a i eta i ∈D(x i )(1≤i≤k).

– Une solution partielle est une assignationstelle que∀c∈C, vars(c) ={x 1 , , xk} ⊆ vars(s), c(a 1 , , a k ) est satisfaite Une solution partielle est aussi appel´ee une assi- gnation localement consistante.

– Une solution est une solution partielle s avec vars(s) =X L’ensemble de solutions est d´enot´e sol(X, D(X), C).

R´ esolution d’un CSP : Propagation et Recherche

Propagation

To effectively solve a Constraint Satisfaction Problem (CSP), we utilize propagation Propagation eliminates impossible values from the variable domains, thereby reducing the search space without removing potential solutions It also detects failures and prunes branches of the search tree, saving unnecessary exploration of the search space.

Un propagateur pour la contraint c(x, y) =x≥y+ 2peut enlever les valeurs 1, 2, 3 de x parce que x ≥ y+ 2 ≥4 Les valeurs 3, 4, 5 de y sont ´egalement enlev´ees parce que x≥y+ 3⇒y≤x−3≤2 On obtient un CSP ´equivalent : D(x) ={4,5}, D(y) ={1,2} et c(x, y) =x≥y+ 3.

Different levels of pruning can be achieved, typically defined by a consistency property satisfied by the CSP after propagation An algorithm is employed during resolution to attain this consistency property, removing values that do not meet the criteria If a property allows for the removal of more values, the algorithms associated with it generally exhibit higher time complexity Thus, it is essential to find a balance between the level of pruning and the computational efficiency.

Recherche

CSP problems are often NP-hard, making propagation insufficient for these challenges Once propagation achieves the goal for each node and no longer reduces the variable domains, the search process selects a variable and assigns a value to it to proceed.

Search is defined by a search tree and an algorithm designed to navigate this tree The root node represents the original Constraint Satisfaction Problem (CSP), while the descendants of a given node are generated by partitioning the CSP For instance, in a binary branching scenario, one node may represent a CSP with a specific condition, while another node represents the CSP with an alternative condition A failed node is one where the CSP has an empty domain, indicating no possible solutions, whereas a solution node is defined as one where all variable domains in the CSP have a unique value, and all constraints are satisfied.

The algorithm for utilizing the search tree often employs a depth-first search strategy due to its linear complexity concerning the number of variables The CP framework provides support for backtracking, which is essential when propagation detects a failed node by removing values from the variable's domain In such cases, it is necessary to backtrack to the previous node and continue exploring the search tree The exploration concludes when a solution is found.

3 return true; // we found a solution!

Code 2.1: Resolution d’un CSP : propagation + recherche

The code presented outlines a recursive algorithm designed to solve a Constraint Satisfaction Problem (CSP) represented as (X, D(X), C) This algorithm consists of two main steps: propagation and search It takes a CSP as input and determines whether a solution exists Initially, if all variable domains contain a single value, a solution is found If not, propagation is employed to eliminate impossible values If propagation reveals an empty domain, the branch is terminated Subsequently, the search phase begins, where a variable and a corresponding value are selected, potentially guided by heuristics The exploitation algorithm follows a binary branching approach: either x = a or x ≠ a.

Consistance de domaine (DC)

Dans la propagation, la consistance la plus utilis´ee est la consistance de domaine (DC). Cette section pr´esente quelques consistances telles que DC.

D´efinition 2.5 Pour une contrainte c∈C avec x ∈vars(c) Les ensembles de valeur inconsistante et valide pourx dans cpar rapport `a D(X) sont d´efinis comme suit : – Inc(c, x) ={(x, a)|a∈D(x)∧ ∀v∈D(vars(c))x=a :ơc(v)}

– Inc(c) =S x∈vars(c)Inc(c, x) et de mˆeme pour l’autre ensemble.

D´efinition 2.6 Domain consistency (DC) ou la consistance de domaine

– Une contrainte c est domain consistency (DC) par rapport `aD(X) ssi Inc(c) =∅ et

– Un CSP (X, D(X), C) est domain consistency (DC) ssi toutes ses contraintes sont consistantes de domaine par rapport `a D(X).

In the context of binary constraints (k=2), domain consistency (DC) is referred to as arc consistency (AC) For non-binary constraints, DC is known as generalized arc consistency (GAC) Domain consistency is commonly employed in solving constraint satisfaction problems (CSP) A constraint \( c_i \) is considered DC if, for every variable \( x \) in \( vars(c_i) \) and for every value \( a \) in \( D(x) \), there exists a tuple \( \tau \) in the relation \( rel(c_i) \) such that \( \tau[x] \) satisfies the constraint \( c_i \) In this scenario, \( \tau \) serves as a GAC-support for the value \( a \) concerning the constraint \( c_i \).

Exemple 2.3 Etant donn´e D(x) = D(y) = {1,2,3,4,5} et c(x, y) = x ≤ y −2. Alors, on obtient : Inc(c, x) = {(x,4),(x,5)}, Inc(c, y) = {(y,1),(y,2)}, V alid(c) = ∅.

SiD(x) ={1,2,3}etD(y) ={3,4,5}, la contraintecest DC.V alid(c) ={(x,1),(y,5)}.

To achieve DC, several algorithms are available For binary constraints, one of the most efficient algorithms is AC2001, which has a time complexity of O(ed²) and a space complexity of O(ed) For non-binary constraints, GAC2001/3.1 stands out as one of the most effective algorithms, featuring a time complexity of O(ek²dk) and a space complexity of O(ekd).

D´efinition 2.7 (Consistance de domaine global) Un CSP (X, D(X), C) est consistent de domaine global ssi : ∀x k ∈ X,∀a k ∈D(x k ), ∃une solution {(x 1 , a 1 ), ,(x n , a n )} ∈ Sol(X, D(X), C) o`u xk =ak.

The concept of global domain consistency asserts that each variable value is associated with at least one solution Enforcing global domain consistency is an NP-hard problem Instead of addressing all constraints simultaneously, we focus on a subset of constraints locally to achieve consistency within that group This approach involves examining each constraint individually and revising consistency based on that specific constraint In this context, domain consistency (DC) is considered the most effective form of consistency.

Les consistance plus faibles que DC

Forward Checking (FC)

Forward Checking (FC) is defined as a constraint c(x1, , xk) that is considered Forward Checking with respect to D(X) if there exists a variable y in vars(c) such that for every variable x in vars(c) excluding y, if the domain size #D(x) equals 1, then the constraint c is domain consistent (DC) A Constraint Satisfaction Problem (CSP) denoted as (X, D(X), C) is classified as Forward Checking if all its constraints are Forward Checking with respect to D(X).

A Constraint Satisfaction Problem (CSP) is considered to be Forward Checking (FC) if the assigned values form a partial solution, with all but one of the constraints on the assigned variables being Domain Consistent (DC) An algorithm proposed in [6] achieves FC with a time complexity of O(ed) and a space complexity of O(e) Typically, the FC algorithm is faster than the DC algorithm, making FC a viable option when achieving DC is costly.

Exemple 2.4 Etant donn´e la contraintc= 3x−2y−z6= 4 SiD(x) ={1,2,3}, D(y) {1,2}, D(z) ={3}, alors c est FC SiD(x) ={1,2,3}, D(y) ={1}, D(z) ={3}, alors c n’est pas FC L’application de FC : D(x) ={1,2}, D(y) ={1}, D(z) ={3}.

Bound Consistency (BC)

D´efinition 2.9 Etant donn´e un CSP (X, D(X), C), on d´efinit D ∗ (X) = D ∗ (x1) ∗ D ∗ (x n ), avecD ∗ (x) = [min(D(x)), max(D(x))]

D´efinition 2.10 (Bound Consistency) Une contraintec(x 1 , , x k ) est Bound Consis- tency (BC) par rapport `a D(X) ssi ∀x ∈ vars(c), ∀a ∈ {min(D(x)), max(D(x))} : (x, a)∈/ Inc(c, x, D ∗ (X)) Un CSP (X, D(X), C) estBound Consistency (BC)ssi toutes ses contraintes sontBC par rapport `a D(X).

BC is focused on detecting inconsistencies in the minimum and maximum bounds of variable domains It ensures that the minimum and maximum values of a variable's domain can satisfy constraints related to that variable To achieve BC, the author in [6] described an algorithm with a time complexity of O((d∗)²), where d∗ represents the largest size of the domain D∗.

Exemple 2.5 Etant donn´e les domaines : D(x) ={2,3,4}, D(y) =D(z) ={2,4} La contrainte c=x+y+z= 10est BC mais n’est pas DC car (x,3) n’a pas de support.

Consistances plus fortes que DC

La conception de consistance locale est au cœur de la programmation par contraintes.

Local consistency is utilized during the search process to reduce the search space by identifying inconsistencies In this chapter, we explore stronger consistencies than Domain Consistency (DC) for both binary and non-binary constraints We first present the various consistencies for binary constraints and compare them Subsequently, we address consistencies for non-binary constraints, which are actually inspired by the consistencies for binary constraints A comparison of these consistencies is also examined.

Consistances plus fortes que DC pour contraintes binaires

Consistances ` a base de triangle

Restricted Path Consistency (RPC) in a binary Constraint Satisfaction Problem (CSP) defined as (X, D(X), C) is characterized by the condition that for every variable \(x_i\) in \(X\) and each value \(a\) in the domain \(D(x_i)\), if there is a constraint \(c_{ij}(x_i, x_j)\) such that the pair \((x_i, a)\) has a unique support \((x_j, b)\), then for every variable \(x_k\) linked to both \(x_i\) and \(x_j\) by constraints, there exists a value \(c\) in the domain \(D(x_k)\) such that both \(c_{ik}(a, c)\) and \(c_{jk}(b, c)\) hold true.

RPC est strictement plus fort que DC [5] Un CSP que RPC enl`eve plus de valeur que

Figure 3.1 illustrates DC, where the optimal algorithm for RPC is RPC2, as proposed in [7] This algorithm has a time complexity of O(en + ed² + cd²) and a space complexity of O(ed + cd), with 'c' representing the number of variable triples (xi, xj, xk) where cij, cjk, and cki belong to the set C.

Figure 3.1: Un exemple de CSP sur lequel RPC enl` eve plus de valeurs que DC : (x i , 1) n’est pas RPC tandis que ce CSP est DC

D´efinition 3.2 (Path Inverse Consistency (PIC)) Un CSP binaire (X, D(X), C) est path inverse consistent (PIC) ssi ∀x i ∈ X,∀a ∈ D(xi),∀x j , x k ∈ X, il existe b ∈ D(x j ), c∈D(x k ) telle que c ij (a, b)∧c ik (a, c)∧c jk (b, c).

An optimal algorithm for PIC is proposed with a time complexity of O(en + ed² + cd³) and a space complexity of O(ed + cd), where 'c' represents the number of variable triples (xi, xj, xk) with ij, cjk, and cki belonging to set C Notably, PIC is strictly more powerful than RPC.

Un CSP que PIC enl`eve plus de valeur que RPC est montr´e dans la figure 3.2.

Figure 3.2: Un exemple de CSP sur lequel PIC enl` eve plus de valeurs que RPC :

(x i , 1) n’est pas PIC tandis que ce CSP est RPC

Max-restricted path consistency (Max-RPC) is defined for a binary constraint satisfaction problem (CSP) (X, D(X), C) such that for every variable x_i in X and every value a in the domain D(x_i), for each constraint c_ij(x_i, x_j) in C, there exists a value b in D(x_j) that satisfies c_ij(a, b) Furthermore, for every variable x_k in X, there exists a value c in D(x_k) such that the conditions c_ij(a, b), c_ik(a, c), and c_jk(b, c) hold true.

The Max-RPC algorithm, as proposed in [7], offers optimal performance with a time complexity of O(en + ed² + cd³) and a space complexity of O(ed + cd), where c represents the number of variable triples (xi, xj, xk) with cij, cjk, cki ∈ C Max-RPC has been demonstrated to be more powerful than PIC [5] Figure 3.3 illustrates a CSP where Max-RPC removes more values compared to PIC.

Figure 3.3: Un exemple de CSP sur lequel Max-RPC enl` eve plus de valeurs que PIC :

(x i , 1) n’est pas Max-RPC tandis que ce CSP est PIC

Consistance selon le voisinage

Neighborhood Inverse Consistency (NIC) is defined for a binary Constraint Satisfaction Problem (CSP) (X, D(X), C) as follows: A CSP is considered NIC if, for every variable xi in X and for every value a in the domain D(xi), the pair (xi, a) can be extended to a consistent instantiation of all variables in the neighborhood of xi, which includes all variables linked to xi by constraints.

An algorithm for NIC is proposed with a time complexity of O(g²(n + ed)^(d g + 1)) and a space complexity of O(n), where g represents the maximum number of neighboring variables connected by a constraint in the CSP NIC is strictly more powerful than MaxRPC, as illustrated in Figure 3.4.

Figure 3.4: Un exemple de CSP sur lequel NIC enl` eve plus de valeurs que Max-RPC :

(x i , 1) n’est pas NIC tandis que ce CSP est Max-RPC

Consistance de singleton

D´efinition 3.5 Un CSP binaire (X, D(X), C) est singleton arc consistent (SAC) ssi

∀x i ∈X,∀a∈D(x i ), le sous probl`eme (X, D(X) x i =a , C) peut ˆetre rendu DC.

For SAC, the fastest algorithm is SAC-Opt, which has a time complexity of O(end³) but a high space complexity of O(end²) SAC is strictly more powerful than MaxRPC An example of a CSP where SAC provides greater value than MaxRPC is illustrated in section 3.5 Additionally, SAC and NIC are incomparable.

Figure 3.5: Un exemple de CSP sur lequel SAC enl` eve plus de valeur que Max-RPC :

(x i , 2) n’est pas SAC tandis que ce CSP est Max-RPC

R´ esum´ e

We have presented stronger consistencies than DC for binary constraints The comparison of these consistencies is illustrated in Figure 3.6, where arrows indicate that one consistency is stronger than another, while dashes signify that they are incomparable A comprehensive demonstration of this comparison can be found in the article [5].

Figure 3.6: R´ esum´ e de la comparaison entre les consistances

Consistances plus fortes que DC pour contraintes non binaires

Restricted Pairwise Consistency (RPWC)

A non-binary Constraint Satisfaction Problem (CSP) defined as (X, D(X), C) is considered Restricted Pairwise Consistent (RPWC) if, for every variable \( x_i \) in \( X \), all values in the domain \( D(x_i) \) are Generalized Arc Consistent (GAC) Furthermore, for every value \( a \) in \( D(x_i) \) and every constraint \( c_j \) in \( C \) where \( x_i \) is a variable of \( c_j \), if there exists a unique valid tuple \( \tau \) in the relation of \( c_j \) such that \( \tau[x_i] = a \), then for every constraint \( c_k \) in \( C \) that shares variables with \( c_j \), there exists a valid tuple \( \tau' \) in the relation of \( c_k \) that maintains the intersection of the variables from both constraints.

The definition of RPWC is derived from the concept of GAC Initially, GAC is applied, after which RPWC eliminates values from the variable xi that have a single tuple τ (GAC-support) in the constraint cj, where this support cannot extend to a valid tuple τ' in any of the constraints intersecting with cj By definition, RPWC is strictly stronger than GAC An example illustrates this property, and to achieve RPWC, the algorithm RPWC1 is proposed in [10], featuring a time complexity of O(ne²k²dk) and a space complexity of O(ekd).

Exemple 3.1 D(x1) =D(x2) =D(x3) ={1,2,3},c1=allDif f erent(x1, x2, x3),c2 x 1 =x 2 Ce CSP est GAC mais il n’est pas RPWC parce que(x 1 ,1),(x 1 ,2),(x 1 ,3),(x 2 ,1),(x2,2),(x2,3)ne sont pas RPWC.

relational Path Inverse Consistency (rPIC)

D´efinition 3.7(relational Path Inverse Consistency) Un CSP non-binaire (X, D(X), C) est relational path inverse consistent (rPIC) ssi ∀x i ∈ X,∀c j ∈ C, x i ∈ vars(c j ), et

∀c k ∈C, vars(cj)∩vars(ck)6=∅,alors∃τ ∈rel(cj) telle que τ[xi] =a,τ est valide, et

The rPIC algorithm, inspired by PIC, is applied to Constraint Satisfaction Problems (CSP) by examining pairs of constraints, c_j and c_k It checks if a value a from the domain D(x_i), where x_i is a variable in c_j, has a Generalized Arc Consistency (GAC) support τ in c_j that can be extended to a tuple τ_0 in c_k If no such τ exists, the value a is removed rPIC is demonstrated to be strictly stronger than RPWC, particularly when a value has multiple GAC supports (≥2 supports), while it is equivalent to RPWC when a value has only one GAC support An example illustrates that while the CSP may comply with RPWC, it does not meet the criteria for rPIC The proposed algorithm for rPIC has a time complexity of O(e^2 k^2 d^p) and a space complexity of O(e^2 kd), where p represents the maximum number of variables involved in two constraints.

Exemple 3.2 Etant donn´e un CSP : D(x 1 ) = D(x 2 ) = D(x 3 ) = {0,1,2}, D(x 4 ) {0,1}.c1 =allDifferent(x1, x2, x3), c2=allDifferent(x2, x3, x4) Ce CSP est RWPC car les valeurs dans le domaine de variables ont au moins deux GAC-supports Cependant, ce CSP n’est pas rPIC car les GAC-supports de (x1,2) dans c1 : (2, 1, 0), (2, 0, 1) ne peuvent pas s’´etendre `a c2.

Max Restrited Pairwise Consistency (Max-RPWC)

Definition 3.8 (Max Restricted Pairwise Consistency): A non-binary Constraint Satisfaction Problem (CSP) represented as (X, D(X), C) is considered max restricted pairwise consistent (Max-RPWC) if for every variable \( x_i \) in \( X \), every value \( a \) in \( D(x_i) \), and every constraint \( c_j \) in \( C \) that includes \( x_i \) in its variables, there exists a tuple \( \tau \) in the relation of \( c_j \) such that \( \tau[x_i] = a \) and \( \tau \) is valid Furthermore, for every constraint \( c_k \) in \( C \) that shares variables with \( c_j \), there exists a tuple \( \tau' \) in the relation of \( c_k \) where the shared variables between \( c_j \) and \( c_k \) are consistent, and \( \tau' \) is valid In this context, \( \tau' \) serves as the PW-support for \( \tau \).

The definition of RPWC is inspired by the definition of RPC In Max-RPWC, each value a ∈ D(xi), where xi ∈ vars(cj), is examined to determine if it has a GAC-support that extends to all constraints intersected with j If no such support is found, the value is eliminated Max-RPWC is proven to be strictly stronger than rPIC An example illustrates a CSP that is rPIC but not Max-RPWC To implement Max-RPWC, algorithms such as Max-RPWC1, Max-RPWC2, and Max-RPWC3 have been proposed Max-RPWC2 offers better time complexity of O(e²k²dk) but has high space complexity (O(e²kdf)) The time complexities for Max-RPWC1 and Max-RPWC3 are O(e²k²dp), with Max-RPWC3 often proving to be more efficient in practice than Max-RPWC1.

Exemple 3.3 Etant donn´e un CSP : D(x1) = D(x2) = D(x3) = {0,1}, D(x4) D(x 5 ) = {0} Les contraintes c 1 , c 2 , c 3 sont pr´esent´ees dans la figure 3.7 Ce CSP est rPIC mais il n’est pas MaxRPWC Par exemple, la valeur 0 de x1 est rPIC car pour deux contraintes c1, c2, le GAC-support (0,0,0) de(x1,0) dansc1 peut s’´etendre `a

In the context of constraints c1 and c2, the GAC-support of (x1, 0) in c1 can extend to (1, 1, 0) in c3 However, this value does not qualify as Max-RPWC because none of its GAC-supports can simultaneously extend to both c2 and c3.

Max Restricted 3-wise Consistency (Max-R3WC)

A non-binary constraint satisfaction problem (CSP) (X, D(X), C) is defined as max restricted 3-wise consistent (Max-R3WC) if and only if for every variable \( x_i \) in \( X \), every value \( a \) in \( D(x_i) \), and every constraint \( c_j \) in \( C \) that includes \( x_i \), there exists a valid tuple \( \tau \) in the relation of \( c_j \) such that \( \tau[x_i] = a \) Furthermore, for any two constraints \( c_k \) and \( c_l \) in \( C \), there exist valid tuples \( \tau' \) in the relation of \( c_k \) and \( \tau'' \) in the relation of \( c_l \) such that the projections of \( \tau \) on the shared variables with \( c_k \) and \( c_l \) match those of \( \tau' \) and \( \tau'' \) respectively, ensuring consistency across the involved constraints.

For each value \( a \in D(x_i) \), where \( x_i \in vars(c_j) \), we analyze whether this value has a GAC-support that can extend to the two other intersecting constraints, considering Max-RPWC as one of them Notably, Max-R3WC is a stronger constraint than Max-RPWC The Max-R3WC algorithm, referred to as Max-R3WC1, is proposed with a time complexity of \( O(e^3 k^3 d p + p_0) \) and a space complexity of \( O(ekd) \), where \( p + p_0 \) represents the total number of variables involved in the three constraints.

Max Restricted k-wise Consistency (Max-RkWC)

A non-binary Constraint Satisfaction Problem (CSP) (X, D(X), C) is defined as max restricted k-wise consistent (Max-RkWC) if, for every variable xi in X and every value a in D(xi), there exists a valid tuple τ in the relation of constraint cj, where xi is a variable of cj, such that τ[xi] = a Furthermore, for any set of k-1 additional constraints c1, , ck-1, τ can be extended to a valid instantiation over the variables in the union of vars(cm) for m = 1, , k-1, satisfying each constraint cm.

Max-RkWC is an extension of Max-R3WC When applied to the variable xi, it removes the value a ∈ D(xi) such that for the constraints cj involving xi, no GAC-support for (xi, a) can be extended to all sets of k−1 other constraints.

PWC+GAC

D´efinition 3.11(Pairwise Consistency) Un CSP (X, D(X), C) estPairwise Consistent (PWC) ssi ∀τ ∈ rel(ci), τ est valide, alors τ peut s’´etendre `a chacune de contraintes intersect´ees avecci.

D´efinition 3.12 (PWC+GAC) Un CSP (X, D(X), C) estPWC+GAC ssi il est PWC etGAC.

In the PWC+GAC framework, PWC removes tuples from the constraint relation, while GAC is utilized for domain filtering, eliminating values that lack support within a constraint Research indicates that PWC+GAC is more effective than Max-RPWC However, there exists a CSP that qualifies as RPWC but does not meet the criteria for PWC+GAC.

Figure 3.8: PWC+GAC vs Max-RPWC

Exemple 3.4 Etant donn´e un CSP : D(x 1 ) = D(x 2 ) = D(x 3 ) = D(x 4 ) = D(x 5 ) {0,1}, D(x 6 ) = {0} Les trois contraintes c 1 , c 2 , c 3 sont pr´esent´ees dans la figure ci- dessus La valeur 0 de x1 a un GAC-support (0,0,0) dans c1 Ce tuple peut s’´etendre au tuple (0,0,0,0) dansc 2 (x 1 ,0) est donc MaxRPWC (aussi pour les autres valeurs).Cependant, le tuple (0,0,0,0) dans c2 ne peut pas s’´etendre `a c3, ce tuple est enlev´e par PWC+GAC Par cons´equence, on doit enlever (0,0,0) dans c 1 , alors (x 1 ,0) est supprim´ee car elle n’a plus de GAC-support.

kWC+GAC

k-Wise Consistency (kWC) is defined for a constraint satisfaction problem (CSP) (X, D(X), C) such that for every constraint c_j in C and for every tuple τ in rel(c_j), τ is valid Additionally, for any set of k−1 additional constraints c_1, , c_{k−1}, τ can be extended to a valid instantiation of the variables S_{k−1} i=1 vars(c_i) that satisfies each constraint c_i for i = 1, , k−1.

A CSP (X, D(X), C) is defined as kWC+GAC if it satisfies both kWC and GAC conditions The kWC+GAC framework generalizes the PWC+GAC model, where kWC removes tuples that cannot be extended to any set of k−1 additional constraints, while GAC eliminates values from the variable domains Consequently, kWC+GAC is a stronger condition than PWC+GAC.

relational Neighborhood Inverse Consistent (rNIC)

A non-binary CSP (X, D(X), C) is defined as relational neighborhood inverse consistent (rNIC) if, for every variable x_i in X and every value a in D(x_i), there exists a valid tuple τ in the relation of constraint c_j, where x_i is a variable of c_j, such that τ[x_i] = a Furthermore, τ must be extendable to a solution of the subproblem composed of the set of variables X_j, which includes the variables of c_j and those of all intersecting constraints rNIC evaluates each value a in D(x_i) to determine if it has a GAC-support in c_j that can also extend to other intersecting constraints If a value lacks this support, it is removed rNIC is a stronger condition than MaxRPWC, as it simultaneously considers all intersecting constraints rather than treating them separately The proof can be found in reference [3].

Singleton Generalized Arc Consistency (SGAC)

Singleton Generalized Arc Consistency (SGAC) is defined for a Constraint Satisfaction Problem (CSP) (X, D(X), C) as a state where the domain is non-empty For any assignment of a variable, applying Generalized Arc Consistency (GAC) to the subproblem (X, D(X) x=a, C) can achieve GAC.

The concept of SGAC involves assigning a hypothetical value to a variable and applying GAC consistency to this subproblem If the outcome is GAC, the value is considered SGAC; otherwise, it is discarded SGAC is strictly stronger than RPWC, but it is incomparable to rPIC, Max-RPWC, and PWC+GAC Examples demonstrate that rPIC, Max-RPWC, and PWC+GAC do not surpass SGAC in strength.

Etant donn´e un CSP : D(x 1 ) = D(x 2 ) = D(x 3 ) = {0,1}, c 1 = x 1 6= x 2 , c 2 = x 2 6 x3, c3 =x3 6=x4, c4 =x4 = x1 Ce CSP est rPIC, Max-RPWC, PWC+GAC but n’est pas SGAC car le sous probl`eme (X, D(X)x 1 =0, C) ne peut pas ˆetre rendu GAC.

Exemple 3.6 SGAC n’est pas plus fort que rPIC, Max-RPWC, PWC+GAC

Etant donn´e un CSP :D(x 1 ) =D(x 2 ) =D(x 3 ) ={0,1},c 1 (x 1 , x 2 , x 3 ) ={000,011,100,111}, c2(x1, x2, x3) = {001,010,100,111} Ce CSP est SGAC mais n’est pas rPIC, Max- RPWC, PWC+GAC car aucun GAC-supports de (x 1 ,0) dansc 1 ne peut satisfaire c 2

=⇒ SGAC est incomparable avec rPIC, Max-RPWC, PWC+GAC.

Exemple 3.7 SGAC est plus fort que RPWC

Etant donn´e un CSP : D(x 1 ) = D(x 2 ) = D(x 3 ) = {0,1}, c 1 = x 1 6= x 2 , c 2 = x 2 6 x3, c3 =x3 6=x1 Ce CSP est RPWC mais n’est pas SGAC parce que quand on assigne x 1 = 0, le sous probl`eme (X, D(X) x 1 =0 , C) ne peut pas ˆetre rendu GAC.

R´ esum´ e

Figure 3.9: R´ esum´ e de la comparaison entre les consistances bas´ ees sur le domaine pour les contraintes non binaires

We have demonstrated that certain consistencies are stronger than GAC The pruning power of these consistencies is also discussed The figure above illustrates the relationship between them, with arrows indicating which consistency is stronger and crosses indicating that some consistencies, such as SGAC and MaxRPWC, are incomparable.

Algorithmes de filtrage pour contraintes non binaires

In this chapter, we present algorithms for non-binary constraint consistency We begin by outlining a GAC-3-based algorithm for non-binary constraint propagation and demonstrate its application in RPWC, rPIC, and Max-RPWC Next, we introduce two additional algorithms for Max-RPWC that offer improved efficiency The first algorithm provides better time complexity but requires significant space, while the second algorithm balances both time and space complexity effectively.

Algorithme g´ en´ erique

This article presents a generic algorithm for applying consistency techniques such as RPWC, rPIC, and Max-RPWC, based on the GAC-3 algorithm The function DFcons(CSP, DFC, current-var) takes a non-binary CSP, the name of the consistency (RPWC, rPIC, Max-RPWC), and the current variable as inputs The parameter current-var is set to -1 when the algorithm is used standalone for preprocessing a problem with a specified consistency Conversely, during search operations, current-var represents the currently assigned variable The DFcons function utilizes a list Q of constraints to propagate removed values In standalone mode, all constraints are added to Q, while during search, it initializes Q with relevant constraints by calling Enqueue(xj, ci), focusing on constraints involving current-var and those intersecting with cm across more than two variables.

Each constraint in the list Q is removed and examined For each variable xj belonging to constraint ci, consistency is revised using the Revise(xj, ci, DFC) function This function iterates through the values in the domain of xj to eliminate inconsistencies If the domain of xj becomes empty, the process stops Conversely, if the domain remains non-empty and some values are removed, the Enqueue(xj, ci) function is called to queue the constraints that need to be revised in Q The process concludes when Q is empty.

1 function DFcons(CSP, DF C, current-var)

2 if current-var = -1, put all constraints in Q;

6 foreach unassigned variable xj where xj ∈vars(ci)

8 if D(xj) is empty return INCONSISTENCY;

3 put in Q each c l (6=ci) s.t |vars(c l )∩vars(cm)|>1;

The Enqueue(xj, ci) procedure is designed to manage constraints for consistency checks, specifically for RPWC, rPIC, and MaxRPWC When certain values of xj are removed, the associated constraints cm related to xj are added to the queue Q Additionally, any constraints cl that intersect with cm on more than one variable must also be included in the queue, as there may be instances where a tuple τ in rel(cm) serves as the PW-support for another tuple τ' in rel(cl).

Nous d´ecrivons ensuite comment la fonction Revise(xj, ci, DF C) est r´ealis´ee pour ap- pliquer les consistances RPWC, rPIC et MaxRPWC.

Max-RPWC-1

In Revise(x_j, c_i, MaxRPWC), for each value a in D(x_j), we first search for a tuple τ in rel(c_i) that serves as the GAC-support for a Following the GAC2001/3.1 guidelines, we save the pointer lastGAC x_j,a,c_i for each value a in D(x_j), which is backtrackable This pointer refers to the most recently found tuple that can support a and extend to other intersecting constraints with j If the tuple τ is no longer valid, we consider the next tuple in τ in lexicographical order If this new tuple is valid, we then evaluate its potential to extend to the other constraints.

To analyze the expansion of a tuple, Max-RPWC1 examines each constraint cm that intersects with cj on at least one variable The algorithm checks each tuple τ0 in rel(cm) to identify a valid tuple τ0 that serves as PW-support for τ If such a tuple is found in every constraint cm for τ, the new lastGACx j,a,ci is updated, and another value a from D(xj) is considered If no PW-supports for τ exist in a constraint cm, the process halts and starts over with a different tuple in ci Additionally, if no GAC-support for an element can extend to all intersected constraints with ci, that value is deemed not Max-RPWC and is removed Ultimately, the algorithm returns the count of values that have been eliminated.

1 function Revise(xj, ci, M axRP W C)

6 for each cm6=ci s.t |vars(c i )∩vars(cm)|>1

7 if @ valid τ 0 (∈rel(c m )) s.t. τ[vars(ci)∩vars(cm)] =τ 0 [vars(ci)∩vars(cm)]

9 if PW = TRUE lastGACx j ,a,c i ←τ; break;

10 if PW = FALSE remove a from D(xj);

11 return number of deleted values;

Code 4.3: function Revise of Max-RPWC-1

This algorithm has a time complexity of O(e²k²dp) and a space complexity of O(ekd), where p represents the maximum number of variables involved in two constraints The proof is provided in reference [10].

rPIC-1

In the Revise(x j, c i, rP IC) algorithm, for each value a ∈ D(x j), we examine every constraint c m that intersects with c i involving at least two variables The algorithm seeks a tuple τ ∈ rel(c i) that can extend to the constraint c m A backtrackable pointer, lastGAC x j, a, c i, c m, is utilized for each intersecting constraint c m, representing the most recently found tuple in rel(c i) that is GAC-support for a ∈ D(x j) and can extend to c m If this tuple is valid, then a is classified as rPIC; otherwise, a new GAC-support for a is sought starting from lastGAC x j, a, c i, c m If a new valid GAC-support τ is identified, the algorithm checks if it can extend to c m by searching for the PW-support τ 0 of τ If τ 0 is found, lastGAC x j, a, c i, c m is updated; if not, the process is restarted.

` a ligne 5 Dans le cas o`u il n’y a plus de GAC-support pour ain rel(cm), alors on doit enlevera Enfin, l’algorithme retourne le nombre de valeur enlev´ee.

1 function Revise(xj, ci, rP IC)

6 if ∃ valid τ 0 (∈rel(cm)) s.t. τ[vars(c i )∩vars(c m )] =τ 0 [vars(c i )∩vars(c m )]

9 if PW = FALSE remove a from D(x j ); break;

10 return number of deleted values;

Code 4.4: function Revise of rPIC-1

Cet algorithme a une complexit´e temporelle de O(e 2 k 2 d p ) et une complexit´e d’espace en O(e 2 kd) o`up est le nombre maximum de variables impliqu´ees dans deux contraintes[10].

RPWC-1

Nous pr´esentons dans cette partie un algorithme pour RPWC L’id´ee est comme suit.

In each call to `Revise(xj, ci, RPWC)`, two GAC-supports are sought for every value a ∈ D(xj) If only one GAC-support for a is found, it is necessary to determine if this support can be extended to other constraints intersecting with ci Two pointers, lastGAC1xj,a,ci and lastGAC2xj,a,ci, are utilized and are backtrackable These pointers represent the two most recently found GAC-supports for a If lastGAC2xj,a,ci is NIL, it indicates that all potential GAC-supports for a have been considered If lastGAC2xj,a,ci is neither valid nor NIL, a new GAC-support is searched after lastGAC2xj,a,ci If a new GAC-support is found, lastGAC2xj,a,ci is updated; otherwise, it is set to NIL, indicating that all tuples have been examined If lastGAC1xj,a,ci becomes invalid, it is updated to lastGAC2xj,a,ci, and a new GAC-support is sought for the latter If no new GAC-support is found, lastGAC1xj,a,ci is set to NIL This process ensures that lastGAC1xj,a,ci and lastGAC2xj,a,ci are the two most recently identified GAC-supports, maintaining the order of their validity.

3 if lastGAC2x j ,a,c i 6=N IL and lastGAC2x j ,a,c i is not valid

7 if lastGAC2x j ,a,c i 6=N IL and lastGAC1x j ,a,c i is not valid

12 if lastGAC1x j ,a,c i is not valid P W ←F ALSE;

16 if PW = FALSE remove a from D(x j );

17 return number of deleted values;

Code 4.5: function Revise of RPWC-1

Puis, si lastGAC1x j ,a,c i = N IL, c’est `a dire qu’il n’y a pas de GAC-support pour a, on doit donc enlever a (ligne 12 et 16) Autrement, si lastGAC2 x j ,a,c i = N IL, c’est

When there is only one GAC-support for a, the function FindPWsupports(c i , τ) is invoked to determine if this tuple can extend to other constraints intersected with c i Conversely, if lastGAC2 x j ,a,c i is not NIL, it indicates that there are at least two GAC-supports for a, making it RPWC Ultimately, the algorithm returns the count of values removed.

The FindPWsupports(ci, τ) function is designed to test the extensibility of a tuple τ within the relation rel(ci) For each constraint cm that intersects with ci, the function searches for a PW-support τ' in rel(cm) for the tuple τ If a PW-support is not found within a constraint cm, it indicates that τ is not extensible, and the function terminates by returning FALSE Conversely, if a PW-support is found, it confirms that τ is extensible, and the function returns TRUE.

4 if @ valid τ 0 (∈rel(cm)) s.t. τ[vars(ci)∩vars(cm)] =τ 0 [vars(ci)∩vars(cm)]

Code 4.6: function FindPWsupports of RPWC-1

Cet algorithme a une complexit´e temporelle de O(ne 2 k 2 d p ) et une complexit´e d’espace en O(ekd) o`u p est le nombre maximum de variables impliqu´ees dans deux contraintes[10].

Max-RPWC-2

This section discusses an improved algorithm for Max-RPWC, known as Max-RPWC-2, which offers better time complexity but has a higher space complexity Unlike its predecessor, Max-RPWC-1, where testing the extensibility of a newly found tuple τ against intersecting constraints is costly, Max-RPWC-2 optimizes this process It maintains a set of d f pointers for each constraint ci that intersects with another constraint cm Each pointer, lastP W ci,cm,s, corresponds to a sub-tuple s among d f sub-tuples for the variables vars(ci)∩vars(cm) During the algorithm's execution, lastP W ci,cm,s indicates the most recently found valid tuple that extends the sub-tuples, and this pointer is backtrackable, significantly enhancing efficiency.

In each revision, for every value a ∈ D(xj), we seek a valid tuple τ ∈ rel(ci) that serves as a GAC-support for a, mirroring the process in Max-RPWC-1 (lines 2-5) For each constraint cm intersecting with ci, Max-RPWC-2 checks whether all possible extensions of s (where s = τ[vars(ci) ∩ vars(cm)]) in cm have been previously examined If lastPWci,cm,s = NIL, indicating that s has no further extensions in cm, the process must terminate and restart with a different GAC-support for a (line 14) Conversely, if lastPWci,cm,s ≠ NIL, the algorithm searches for an extension for s starting from lastPWci,cm,s in lexicographic order (line 9) If a tuple τ' is found, lastPWci,cm,s is updated (line 10); otherwise, lastPWci,cm,s is set to NIL (line 11).

12) Dans le cas, il n’y a pas de GAC-support pouraqui peut s’´etendre aux contraintes cm intersect´ees avecci,aest supprim´e Enfin, l’algorithme retourne le nombre de valeur enlev´ee.

1 function Revise(xj, ci, M axRP W C)

6 foreach cm 6=ci s.t |vars(c i )∩vars(cm)|>1

9 if ∃ valid τ 0 (∈rel(c m ))≥ l lastP W c i ,c m ,s and τ 0 [vars(ci)∩vars(cm)] =s

15 if PW = TRUE, lastGAC x j ,a,c i ←τ; break;

16 if PW = FALSE, remove a from D(xj);

17 return number of deleted values;

Code 4.7: function Revise of Max-RPWC-2

In Example 4.1, given a CSP illustrated in Figure 4.1 with variables X = {x1, x2, x3, x4} and constraints C = {c1, c2}, the constraints c1 and c2 intersect on the variables x1 and x2 The bold tuples represent those allowed by the constraints and are considered valid, while the italicized tuples are not permitted It is assumed that the values of x1 need to be tested for Max-RPWC, and Max-RPWC-1 must evaluate all 5 tuples of c2 for each value of x1.

Figure 4.1 illustrates the application of Max-RPWC-1 and Max-RPWC-2 on a non-binary CSP with variable x1 Max-RPWC-2 evaluates only five tuples for the value 0 of x1, as after assessing x1 = 0, the lastP Wc i,c m,s (where s = {0,0}) identifies the tuple {0,0,4} in c2 For other values of x1, Max-RPWC-2 only verifies this specific tuple.

The Max-RPWC-2 algorithm exhibits a time complexity of O(e²k²dk) and a space complexity of O(ekdf), where 'f' represents the maximum number of variables intersecting in two constraints Compared to GAC2001/3.1, which has a time complexity of O(ek²dk), Max-RPWC-2 demonstrates better time efficiency; however, it requires more space This makes it less practical in scenarios where the number of intersecting variables in two constraints is substantial.

Max-RPWC-3

Max-RPWC-2 offers improved time complexity compared to Max-RPWC-1; however, it requires significant memory for large problems In this section, we introduce the third algorithm for Max-RPWC, known as Max-RPWC-3 This algorithm reduces the number of extension tests compared to Max-RPWC-1 and utilizes less memory than Max-RPWC-2.

In addition to the pointer lastGAC x j ,a,c i, Max-RPWC-3 employs another pointer PW x j ,a,c i ,c m for each constraint cm that intersects with ci, and for each a in D(xj) This pointer represents the most recent PW-support for lastGAC x j ,a,c i within rel(c m ).

Max-RPWC-3 first seeks a GAC-support similar to Max-RPWC-1 If the lastGAC is still valid, it checks the validity of the PW-support for the intersected constraints If any of these constraints are no longer valid, Max-RPWC-3 looks for an alternative PW-support to minimize extension tests If the lastGAC is invalid, the algorithm searches for a new GAC-support and assesses its extensibility to other constraints If no GAC-support can extend to the constraints, the algorithm removes the corresponding value Ultimately, the number of removed values is returned.

8 else t← first tuple in rel(c m );

9 if @ valid τ 0 (∈rel(cm))≥ l t s.t. τ[vars(c i )∩vars(c m )] =τ 0 [vars(c i )∩vars(c m )]

12 if PW = TRUE, lastGAC x j ,a,c i ←τ; break;

13 if PW = FALSE, remove a from D(xj);

14 return number of deleted values;

Code 4.8: function Revise of Max-RPWC-3

Cet algorithme a une complexit´e temporelle de O(e 2 k 2 d p ) et une complexit´e d’espace en O(e 2 kd) o`up est le nombre maximum de variables impliqu´ees dans deux contraintes

Max-RPWC3 has the same time complexity as Max-RPWC1; however, it is generally more efficient in practice This is especially true when the PW-support τ₀ of τ is removed, as it then proceeds to the next tuple of τ₀.

R´ esum´ e

Algorithme Complexit´e de temps Complexit´e d’espace

MaxRPWC-1 O(e 2 k 2 d p ) O(ekd)MaxRPWC-2 O(e 2 k 2 d k ) O(ekd f )MaxRPWC-3 O(e 2 k 2 d p ) O(e 2 kd)Table 4.1: R´ esum´ e des algorithmes avec leur complexit´ e de temps et d’espace

In this chapter, we discussed algorithms for RPWC consistency, including rPIC and Max-RPWC Three algorithms were proposed for Max-RPWC: Max-RPWC-1, Max-RPWC-2, and Max-RPWC-3 Among these, Max-RPWC-2 offers good time complexity but requires significant memory, while Max-RPWC-3 strikes a balance between time and space efficiency The table below summarizes the studied algorithms along with their time and space complexities.

In this chapter, we will introduce the architecture of the AbsCon solver, designed to tackle both binary and non-binary Constraint Satisfaction Problems (CSPs) Implemented in Java, AbsCon is platform-independent and integrates search heuristics along with propagation techniques We will first discuss the architecture of AbsCon, followed by an explanation of how a CSP is resolved within the framework Finally, we will explore the propagation processes for various consistencies, including Domain Consistency (DC), Strong Arc Consistency (SAC), and Path-Weighted Generalized Arc Consistency (PWC+GAC).

Les paquets dans AbsCon

Dans AbsCon, nous trouvons les paquets principaux ci-dessous :

– abscon : pour lancer le programme, initialiser le probl`eme, le solveur

– problem.* : contenir les classe pour pr´esenter un probl`eme, tous les probl`emes doivent ´ etendre la classe ”Problem”

– variable : pour d´efinir les variables du probl`eme

– variable.domain : pour d´efinir le domaine de variables

– contraint.* : pour repr´esenter les contraintes

– search.*, heuristic.* : les heuristiques, les algorithmes pour la recherche

– propagation.* : pour la propagation, il y a plusieurs types de propagation : AC, FC,SAC,

Repr´ esentation d’un CSP

Pour repr´esenter un CSP sous AbsCon Les classes utilis´ees sont Problem, Variable,Domain and Constraint Un UML diagramme est donn´e par la figure 5.1.

Figure 5.1: AbsCon : Repr´ esentation d’un CSP [1]

In AbsCon, a problem is defined by two arrays that specify a set of variables and constraints The abstract class Problem allows for the creation of subclasses that represent specific problems Users must override two methods, specifyVariables() and specifyConstraints(), to define the variables and constraints Each variable is characterized by a domain and an array that outlines the constraints associated with it Additionally, the Variable class references a ValueChooser object that implements a value selection heuristic A domain linked to a variable consists of an array detailing the allowed values, while a constraint is defined by an array of related variables and a set of methods that can be invoked during propagation.

R´ esolution d’un CSP

Figure 5.2: AbsCon : R´ esolution d’un CSP [1]

Nous d´ecrivons dans cette section les classes utilis´ees pour r´esoudre un CSP Ce sont :Solver, VariableChooser, ValueChooser etPropagator.

The Solver class, located in the search.* package, implements the Depth First Search (DFS) algorithm with Backtracking When a Solver object is created, it is associated with a specific Constraint Satisfaction Problem (CSP) This object manages the assignment set and attempts a new assignment at each step The next variable to assign is selected by a VariableChooser, while the next value is determined by a ValueChooser After each new assignment, propagation is carried out by a Propagation object The resolution process stops when a solution is found or when the entire search space has been explored.

The VariableChooser class, located in the heuristics.* package, implements heuristics for selecting variable values, including methods such as Lexicographic, SmallestDomain (dom), and SmallestDomainOnDegree (dom/deg) The Propagation class, found in the propagation.* package, handles the propagation method and is associated with the Constraint class to test consistency The propagation.* package manages the addition or removal of constraints in the revision queue as needed Each constraint includes a method for revising consistency, which is used to eliminate inconsistent values In AbsCon, various consistency techniques have been implemented, including Domain Consistency (DC), forward checking, Strong Arc Consistency (SAC), Path Consistency (PWC), and Generalized Arc Consistency (GAC).

La propagation dans AbsCon

In this section, we discuss the propagation within AbsCon The propagation packets are located in the propagation.* files To develop a new propagation, one must derive from the base class Propagation This class contains essential methods that are utilized during the resolution process.

– enforce() : cette m´ethode est utilis´ee au d´epart, pour obtenir la consistance avant de faire la recherche.

– enforceAfterAssignmentOf(Variable) : pendant la recherche, apr`es chaque assignation de variable, cette m´ethode est utilis´ee pour obtenir la consistance en r´evisant les contraintes portant sur cette variable.

The method enforceAfterRefutationOf(Variable) is invoked to maintain consistency when an assignment fails during the search process Initially, the value associated with the failed assignment is removed, followed by a revision of the constraints related to that variable To achieve consistency across the three previous methods, propagate() is called, which is further elaborated upon in the following description.

2 // OUT : reviser tous les variables dans la queue et enlever les inconsistances

In AbsCon, propagation is variable-oriented, meaning the queue Q used for propagation contains variables When a variable x is selected from Q, all constraints related to x are invoked for filtering (ci.filterFrom(x)) The ci.filterFrom(x) method revises the consistency for all variables in ci If it detects an inconsistent value, that value is removed, and the variable is added back to the queue The following sections will introduce several propagation algorithms used in AbsCon.

DC

The propagation of DC (or AC) is defined within the AC class under the propagation package This class extends the Propagation class To obtain the DC, the following functions are called.

The enforce() method is invoked at the beginning of the process, prior to the search, to ensure consistency It places all variables into a queue and subsequently calls the propagate() method to enforce domain consistency (DC).

The `enforceAfterAssignmentOf(Variable)` method is invoked during the search process following each assignment The assigned variable is placed in a queue, and the `propagate()` method is subsequently called to ensure consistency.

The enforceAfterRefutationOf(Variable) method is invoked during the search process when an assignment fails In this case, the value is removed, the variable is placed in the queue, and the propagate() method is subsequently called for the domain consistency (DC).

SAC

La classeSAC ´etend la classe StrongConsistency qui ´etend la classe AC Elle est dans le paquetpropagation.*.

A Constraint Satisfaction Problem (CSP) is Strongly Arc-Consistent (SAC) if, for every variable \( x_i \in X \) and every value \( a \in D(x_i) \), assigning \( x_i = a \) allows the subproblem \( (X, D(X) \setminus \{x_i = a\}, C) \) to become Arc-Consistent (AC) The concept of Strong Consistency introduces the method `enforceMore()` to enhance the existing methods `enforce()`, `enforceAfterAssignmentOf(Variable)`, and `enforceAfterRefutationOf(Variable)` The `enforceMore()` method evaluates the consistency of each unassigned variable using the `makeSingletonTestOn(Variable)` method from the SAC class This method tests the SAC by assigning a value to a variable, and if the subproblem cannot be made AC, the assigned value is removed The propagation process continues until no changes occur, at which point the `enforceMore()` method is restarted whenever changes are detected.

PWC+GAC

The PWC+GAC algorithm is implemented through two classes: PWCGAC and ConstrainedHardExtensionPWCGAC The PWCGAC class is responsible for managing propagation, while the ConstrainedHardExtensionPWCGAC class presents the constraints These special constraints are aware of their neighboring constraints and are invoked by the PWCGAC class during propagation to revise the consistency of the PWC+GAC algorithm.

The PWCGAC class extends the AC class, enabling the propagation of necessary constraints to achieve consistency When PWCGAC propagation is initiated, it identifies intersections between ConstraintHardExtensionPWCGAC constraints and incorporates them into the existing constraints This process is essential for assessing the extensibility of tuples During propagation, the propagate() method is invoked, which subsequently calls the ConstraintHardExtensionPWCGAC.runPropagator(Variable) method to revise PWC+GAC consistency The concept behind this method is detailed below.

2 // OUT:enlever les tuples invalides, ne pas s’etendre aux autres tuples

3 // enlever les valeurs inconsistantes du domaine de variable

5 if τ is not valid or τ can not extend to others constraints

7 update domain of variables in c

In this chapter, we have outlined the structure of AbsCon, the resolution of a Constraint Satisfaction Problem (CSP), and the propagation techniques used within CSPs This section provides a foundational understanding of the processes involved in AbsCon and sets the stage for implementing strong consistency algorithms in the following chapter.

Impl´ ementation et exp´ erimentation

In this chapter, we discuss our implementation of algorithms for strong consistency, specifically focusing on RPWC-1, rPIC-1, Max-RPWC-1, and Max-RPWC-3 Additionally, we present the experimental results along with an analysis of these findings.

Impl´ ementation

As introduced in Chapter 4, the necessary constraints are utilized during propagation and within the Revise(xj, ci, DFC) function, where the constraints intersecting with ci are also engaged Considering the AbsCon architecture, we establish two main classes for propagation.

DFC is the general class for RPWC, rPIC, and Max-RPWC consistencies This class manages propagation by adding and removing variables from the propagation queue and invoking constraints associated with these variables to revise consistency Additionally, it enables the identification of neighboring constraints.

The ConstraintHardExtensionDFC class represents constraints in Constraint Satisfaction Problems (CSP) and is designed to revise consistency for various algorithms such as RPWC and rPIC Each algorithm is identified by a unique name, changing to RPWC1, rPIC1, etc When a constraint is invoked, the method runPropagator(Variable) is called, functioning similarly to the Revise(xj, ci, DFC) method, which updates the consistency (RPWC, rPIC, etc.) for each value of a variable.

The runPropagator(Variable) method is designed to address constraints when invoked It triggers the function ci.runPropagator(Variable), which revises consistency for each of its variables This method incorporates the Revise(xj, ci, DFC) function, implemented according to the algorithms outlined in Chapter 4, including RPWC1 and rPIC1.

3 // Reviser la consistance pour chaque valeur dans le domaine de xj

5 // update domain of all variable in ci, return false if a domain of variable is empty

Dans ce travail, nous avons impl´ement´e les algorithmes : RPWC-1, rPIC-1, Max-RPWC-

The Max-RPWC-3 algorithm was developed as the Max-RPWC-2 algorithm was not implemented due to its high space complexity To ensure the accuracy of our implementation, we validated our results against algorithms already implemented in AbsCon, including the GAC (STR2 algorithm) and the forPWC+GAC algorithm.

Exp´ erimentation

The experiment was conducted using the AbsCon solver on a PC with 4GB RAM, an Intel Core i5-2520M processor, and Ubuntu operating system The problems analyzed were Renault and random-fcd, which are utilized in CSP solver competitions The number of intersecting variables in the constraints of these problems ranged from 2 to 10 We compared several algorithms, including RPWC1, rPIC1, MaxRPWC1, MaxRPWC3, GAC (STR2 algorithm), and PWC+GAC (already implemented in AbsCon) The evaluation criteria focused on CPU time (in seconds) and nodes explored For the search process, the dom/ddeg heuristic was employed to select the variable, while a lexicographical order was used to choose the variable's value The dom/ddeg heuristic was preferred for its effectiveness in comparing the pruning power of the algorithms.

Table 6.1 presents the results for the modified Renault problem instances, displaying the execution time (in seconds) and the number of nodes (n) in each cell The constraint arity ranges from 2 to 10 When analyzing the number of discovered nodes (n), it is evident that the GAC algorithm must traverse the maximum number of nodes, followed by other algorithms.

RPWC1, rPIC1, Max-RPWC1, Max-RPWC3 L’algorithme PWC+GAC passe le mini- mum nombre de noeud par rapport aux autres algorithmes Ce r´esultat correspond bien

The pruning power of each consistency level significantly reduces the number of nodes processed, with PWC demonstrating the highest efficiency by traversing the fewest nodes This effectiveness is particularly evident in the renault-3 and renault-5 instances However, in terms of execution time, the algorithms RPWC1, rPIC1, Max-RPWC1, and Max-RPWC3 are less competitive, often performing slower than GAC (STR2), except in the renault-3 and renault-5 instances This discrepancy can be attributed to the complexity of the algorithms, as they require more time to execute at each node compared to GAC (STR2) Notably, between Max-RPWC1 and Max-RPWC3, the latter generally exhibits faster performance.

1.86, 111 Table 6.1: R´ esultat exp´ erimental sur les instances du probl` eme modified renault

We conducted experiments on instances of the random-fcd problem, generated by the RB model Difficult instances were selected for testing, with results displayed in Table 6.2 Each algorithm's execution time was limited to 2000 seconds; any algorithm exceeding this limit was halted In terms of pruning efficiency, PWC+GAC outperformed others, followed by MaxRPWC, rPIC, RPWC, with GAC being the least effective Despite having stronger pruning capabilities than GAC, the time complexity of the RPWC, rPIC, Max-RPWC1, and Max-RPWC3 algorithms remains significant, preventing them from solving all instances Notably, Max-RPWC3 consistently outperformed Max-RPWC1, and PWC+GAC proved competitive with GAC(STR2), being faster in some instances.

Table 6.2: R´ esultat exp´ erimental sur les instances du probl` eme random-fcd

The experimental results indicate that the Max-RPWC3 algorithm shows promise in practical applications, often outperforming Max-RPWC1 and rPIC1 in speed In certain instances, Max-RPWC3 even surpasses GAC (STR2) in efficiency Additionally, the PWC+GAC algorithm, already implemented in AbsCon, proves to be competitive with other algorithms, demonstrating the fastest performance in several instances and exhibiting superior pruning power compared to the others analyzed in this study.

In this study, we explored the propagation and existing strong consistency techniques for constraint satisfaction problems (CSPs) For binary CSPs, we examined RPC, PIC, MaxRPC, SAC, and NIC consistencies In the case of non-binary CSPs, the consistencies RPC, PIC, MaxRPC, and NIC were extended to RPWC, rPIC, MaxRPWC, and rNIC.

The pruning power of various consistencies is analyzed, revealing that for non-binary constraints, MaxRPWC outperforms rPIC, which is superior to RPWC, and RPWC is stronger than GAC This paper examines the algorithms for RPWC, rPIC, and MaxRPWC, highlighting MaxRPWC3 as particularly noteworthy due to its pruning efficiency and time complexity.

In our practical study, we first examined the AbsCon solver, which already implements several propagation algorithms such as GAC (STR2), SAC, and PWC+GAC We then implemented additional algorithms, including RPWC1, rPIC1, MaxRPWC1, and MaxRPWC3, to analyze the benefits of using strong consistencies Our practical results indicate that strong consistencies can significantly reduce the search space, and in some cases, these algorithms outperform GAC in speed However, the complexity of these algorithms can be high; if they fail to sufficiently reduce the search space, they may perform slower than GAC Among the implemented algorithms, MaxRPWC3 shows promise, while the PWC+GAC algorithm is the fastest among the strong consistency algorithms.

To enhance the MaxRPWC3 algorithm, we first need to improve its implementation, particularly the backtracking component for the pointer lastPWxj,aci,cm Additionally, an efficient method for testing the extensibility of tuples in a constraint should be developed by storing the indexes of their PW-supports Given that PWC+GAC performs well in most problems, we propose exploring the generalization of PWC+GAC consistency In certain scenarios, revising strong consistency for all constraints can be costly; therefore, we will focus on revising consistency for a subset of constraints within a CSP This approach may reduce the search space and lower costs The next step involves considering the combination of these consistencies.

[1] Sylvain Merchez, Christophe Lecoutre, and Fr´ed´eric Boussemart Abscon : A pro- totype to solve csps with abstraction In Principles and Practice of Constraint Programming—CP 2001, pages 730–744 Springer, 2001.

[2] Francesca Rossi, Peter Van Beek, and Toby Walsh Handbook of constraint pro- gramming Elsevier, 2006.

[3] Kostas Stergiou Strong domain filtering consistencies for non-binary constraint satisfaction problems International Journal on Artificial Intelligence Tools, 17

[4] Christian Bessi`ere, Jean-Charles R´egin, Roland HC Yap, and Yuanlin Zhang An optimal coarse-grained arc consistency algorithm Artificial Intelligence, 165(2) : 165–185, 2005.

[5] Romuald Debruyne and Christian Bessiere Domain filtering consistencies Journal of Artificial Intelligence Research, 14 :205–230, 2001.

[6] Christian Bessiere Constraint propagation Handbook of constraint programming, pages 29–83, 2006.

[7] Romuald Debruyne and Christian Bessiere From restricted path consistency to max-restricted path consistency In Principles and Practice of Constraint Programming-CP97, pages 312–326 Springer, 1997.

[8] Romuald Debruyne A property of path inverse consistency leading to an optimal pic algorithm InECAI, pages 88–92, 2000.

[9] Eugene C Freuder and Charles D Elfe Neighborhood inverse consistency prepro- cessing InAAAI/IAAI, Vol 1, pages 202–208, 1996.

[10] Christian Bessiere, Kostas Stergiou, and Toby Walsh Domain filtering consistencies for non-binary constraints Artificial Intelligence, 172(6) :800–822, 2008.

[11] URLhttp://www.cril.univ-artois.fr/~lecoutre/benchmarks.html.

Ngày đăng: 03/07/2022, 08:41

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm