Eliminating non binary constraints
1 / 38

Eliminating non-binary constraints - PowerPoint PPT Presentation

  • Uploaded on

Eliminating non-binary constraints. Toby Walsh Cork Constraint Computation Center. Eliminating non-binary constraints. Two methods Encodings: Replace with binary constraints by introducing new vars Decompositions: (For restricted class of non-binary constraints)

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Eliminating non-binary constraints' - pascha

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Eliminating non binary constraints

Eliminating non-binary constraints

Toby Walsh

Cork Constraint Computation Center

Eliminating non binary constraints1
Eliminating non-binary constraints

  • Two methods

    • Encodings:

      Replace with binary constraints by introducing new vars

    • Decompositions:

      (For restricted class of non-binary constraints)

      Replace with binary constraints on same variables

Meta motivation

  • Theoretical results informative

    • Comparing non-binary constraint propagation with binary

    • Suggests where non-binary constraints are valuable


  • Lots of valuable results!

    Bacchus & van Beek, AAAI-98

    Chen, PhD thesis, UAlberta, 2000

    Dechter, AAAI-90

    Mohr & Masini, ECAI-88

    Regin, AAAI-94

    Stergiou & Walsh, AAAI-99 & IJCAI-99

    Gent, Stergiou & Walsh, Artificial Intelligence 2000

    Bacchus, Chen, van Beek, Walsh, Artificial Intelligence 2002


Let s start with the easy case
Let’s start with the easy case!

Decomposable constraints:

Non-binary constraints that can be represented by binary constraints with introducing new variables

It’s a special case that sometimes occurs about which we can be (theoretically) quite precise

Binary decompositions
Binary decompositions

  • Certain non-binary constraints decompose into binary constraints on same vars

  • Sometimes called “network decomposable”

Binary decompositions1
Binary decompositions

  • Two examples:

    • all-different(x1,x2,x3) is x1\=x2, x1\=x3, x2\=x3

    • monotone(x1,x2,x3) is x1 < x2 < x3

  • One non-example:

    • even(x1+x2+x3)

    • Can you see why not?

Binary decompositions2
Binary decompositions

  • Theoretical comparison direct

    • compare pruning of vars in binary decomposition with that in non-binary

  • Empirical experiments reinforce theory

    • decomposing non-binary constraints can add orders of magnitude to solution cost

Binary decompositions3
Binary decompositions

  • Upper and lower bound on FC

    nFC1 on non-binary > FC on decomposition > nFC0 on non-binary

  • Gaps can be exponential

    Consider n-ary all-different with n-1 values

    nFC1 takes (n-1) branches

    FC on decomposition takes (n-1)! branches

Binary decompositions4
Binary decompositions

  • GAC lower bound

    GAC on non-binary > AC on decomposition

    Gap again can be exponential

    But if we decompose too much, GAC=AC!

  • GAC upper bound

    In general, GAC ~ NIC, GAC ~ PIC ..

    BUT if decomposition to clique, NIC > GAC

Binary decompositions5
Binary decompositions

  • Tighter results provable for stricter classes

  • Tree decomposable constraints

    • constraint graph is tree

  • Triangle preserving constraints

    • non-binary constraints on all triangles

Binary decompositions6
Binary decompositions

  • Tree decomposable constraints

    • e.g. monotone(x1,x2,x3)

    • GAC=AC

    • not surprising as AC enough to solve!

  • Decomposition here doesn’t lose us anything

    • but even one cycle is enough for GAC>AC

Binary decompositions7
Binary decompositions

  • Triangle preserving decomposition

    e.g. all-different(x1,x2,x3), quasigroups, ...

    GAC > PIC, gap can again be exponential

    GAC ~ SAC, strongPC

  • PIC is very strong consistency to be achieving at each node

    • GAC can do even better than this!

    • decomposition carries a very large price

Binary decompositions8
Binary decompositions

  • Experimental results

    • quasigroup completion

    • quasigroup existence

  • Quasigroup is a Latin square

    • completion is completing partially filled square

    • existence is finding one with additional properties

Binary decompositions9
Binary decompositions

  • Modelling the quasigroup problem

    • n^2 vars, each with domain of size n

  • Non-binary model

    • 2n all-different constraints (one for each row and column

  • Binary decomposition

    • 2n cliques of not-equals constraints

Binary decompositions10
Binary decompositions

  • Quasigroup completion

    • Gomes & Selman report “heavy-tailed” distributions

  • Maintaining AC on binary decomposition

    • problems often take long time to solve

  • Maintaining GAC on all-different

    • almost all problems trivial

Binary decompositions11
Binary decompositions

  • Quasigroup existence

    • best paper at IJCAI-93

    • of interest to design theory

  • Open results first proved by computer

    • in some cases, only ever proved by computer

  • Maintaining GAC very competitive

    • compared to specialized model finders like FINDER, SEM

Binary encodings
Binary encodings

  • Not all non-binary constraint decompose into binary constraints

    • on the same set of variables

  • Consider again

    • even(x1+x2+x3)

  • But binary CSPs NP-complete

Binary encodings1
Binary encodings

  • Every non-binary constraint can be encoded into binary constraints

    • using polynomial number of additional (hidden) variables

  • Two popular encodings

    • hidden variable encoding

    • dual encoding

Binary encodings2
Binary encodings

  • Hidden variable encoding

    • add hidden var for each non-binary constraint

  • Dual encoding

    • add hidden var for each non-binary constraint

    • throw away original variables

Binary encodings3
Binary encodings

  • Dual encoding

    • consider c1:even(x1+x2), c2:odd(x2+x3)




R21=<00,01> or




Binary encodings4
Binary encodings

  • Hidden variable encoding

    • consider c1:even(x1+x2), c2:odd(x2+x3)











r1=<0*,0> or


r2=<*0,0> or






Binary encodings5
Binary encodings

  • Hidden var encoding -> dual encoding

    • compose relations, discard original vars



R21 = r2 + r1








Binary encodings6
Binary encodings

  • Double encoding

    • dual + hidden var encoding

    • original vars + hidden vars

    • all constraints of dual and of hidden

  • Also called “combined encoding”

Binary encodings7
Binary encodings

  • Theoretical analysis complicated by:

    • encoding “builds” in GAC for hidden vars

    • must translate between (original and hidden) vars

    • pruning in dual can infer large arity nogoods in original

Binary encodings8
Binary encodings

  • Hidden var encoding

    FC on hidden ~ nFC0 on original

    each can be exponentially better than the other

  • FC+ propogates through hidden vars

    FC+ on hidden = nFC1 on original

Binary encodings9
Binary encodings

  • Hidden var encoding

    AC on hidden = GAC on original

  • Before looking for efficient (specialized) GAC algorithm

    • try AC on hidden var encoding

Binary encodings10
Binary encodings

  • No point doing NIC on hidden var encoding

    NIC on hidden = AC on hidden

    due to star shaped topology of constraint graph

  • Higher consistencies remain distinct

    strongPC on hidden > SAC on hidden

    > NIC, AC on hidden

Binary encodings11
Binary encodings

  • Dual encoding

    FC on dual ~ nFC0 on original

    each can be exponentially better than the other

  • Dual better for tight constraints

    • domains for hidden vars then small

Binary encodings12
Binary encodings

  • Dual encoding

    AC on dual > GAC on original

  • BUT domains of hidden vars very large when non-binary constraints loose

    • AC on dual prohibitively expensive

Binary encodings13
Binary encodings

  • Dual v hidden encoding

    BT on dual = FC on hidden

    AC on dual > AC on hidden

    SAC on dual > SAC on hidden

    strongPC on dual = strongPC on hidden

  • Path consistency is enough to get through the hidden star!

Binary encodings14
Binary encodings

  • Experimental results

    • crossword puzzles

    • Golomb rulers

    • random CSPs

    • random 3-SAT

Binary encodings15
Binary encodings

  • Crossword puzzles

  • “Original” model

    • vars for letters, domains {A-Z}

  • Dual model

    • vars for words, domains = dictionary

  • Dual at least 1,000 times faster on larger problems

Binary encodings16
Binary encodings

  • Golomb ruler

    • set of ticks, xi on a ruler

    • all inter-tick distances, dij different

  • Ternary constraints, dij=xi-xj

    • encoded using hidden var/double encoding

  • Competitive with non-binary model

    • runs on any binary CSP solver!

Binary encodings17
Binary encodings

  • Random CSPs and SAT

    • Bacchus and van Beek plot contours to show constraint tightness where encoding pays

    • gives good predictions for performance on structured problems like crosswords, …

    • number of satisfying tuples in constraint is most important factor in such predictions


  • Non-binary v binary decompositions

    • GAC on non-binary can be stronger than PIC on decomposition

  • Non-binary v binary encodings

    • GAC on non-binary = AC on hidden

    • AC on dual > GAC on non-binary


  • Non-binary v binary decompositions

    • decomposition can add significantly to search cost

  • Non-binary v binary encodings

    • encoding pays in practice on tight constraints

Future directions
Future directions?

  • Mixed models

    • e.g. dual encoding for only some of the (non-binary) constraints

  • Optimization

    • objective function typically non-binary