remove a variable from a problem
remove all but one ⇒ easy to solve
S = all solutions of the problem
solution = evaluation of all variables
some variable x may not be of interest
remove x from all solutions in S
that easy?
only after obtaining all solutions!
removing a variable from the solution is easy
(given the solutions)
remove the variable from the problem =
obtain the same solutions modifying the problem itself
always possible
often: problem increases in size
easy (and wrong solution):
remove x from all constraints that contain it
why not?
removing a variable x looks easy:
just remove the variable!
what about the constraints the containts that contain x?
remove the constraint?
remove the variable from the constraint?
C =
〈〈x,y〉,
{〈2,3〉, 〈4,6〉, 〈1,5〉}〉
D =
〈〈y,z〉,
{〈3,1〉, 〈2,6〉}〉
|
|
C contains x ⇒ remove it
only other constraint D
y=2, z=3 allowed as a solution
only solution of original problem:
x=2, y=3, z=6
(this is a different problem)
C =
〈〈x,y〉,
{〈2,3〉, 〈4,6〉, 〈1,5〉}〉
D =
〈〈x,z〉,
{〈3,1〉, 〈2,6〉, 〈1,1〉}〉
|
|
try: remove x from the table
also the column of value!
C =
〈〈y〉,
{〈3〉, 〈6〉, 〈5〉}〉
D =
〈〈z〉,
{〈1〉, 〈6〉, 〈1〉}〉
|
|
admits solution y=6, z=1
only solutions of the original problem:
{x=2, y=3, z=6}
and
{x=1, y=5, z=1}
(go back to the original problem and check!)
(formally, 1 and 1 are merged)
cannot remove the constraints with x
they also constraint other variables
cannot remove x from the constraint
it links the values of the other variables
still: remove variables by expanding its effects
in the example:
original solutions:
{x=2, y=3, z=6}
and
{x=1, y=5, z=1}
new solutions:
{y=3, z=6}
and
{y=5, z=1}
none else!
x limits the values of the other variables
formalize as a constraint
C(X\{x},R) on all other variables
R contains all tuples that can be extended to x
to form a solution of the original problem
no need to involve all variables
only those in a constraint with x
example: constraint is only on y and z
not no w, k, …
N = 〈 〈y,z〉, { 〈3,6〉, 〈5,1〉 } 〉
combine all constraints on x in a single constraint
tuples: values allowed by all of them
in the example: constraint on x, y, z
remove x from that constraint
can be done if exactly one constraint contain x
combine C and D
variables x,y,z
values that satisfy both C and D at the same time
C =
〈〈x,y〉,
{〈2,3〉, 〈4,6〉, 〈1,5〉}〉
D =
〈〈x,z〉,
{〈3,1〉, 〈2,6〉, 〈1,1〉}〉
|
|
C+D = 〈〈x,y,z〉, {〈2,3,6〉, 〈1,5,1〉}〉
| x | y | z |
|---|---|---|
| 2 | 3 | 6 |
| 1 | 5 | 1 |
why:
〈2,3〉 satisfies C,
〈2,6〉 satisfies D
⇒
〈2,3,6〉 satisfies C+D
〈1,5〉 satisfies C,
〈1,1〉 satisfies D
⇒
〈1,5,1〉 satisfies C+D
now remove x!
a way for removing one variable at time
only one variable left ⇒ problem is easy to solve
variables are sorted: x1 < … < xn
constraints are partitioned in n classes:
class i: all constraints where
xi is the maximal variable
simplifies the elimination mechanism
first bucket removed is n
all constraints that contain xn
how: merge in a single constraint
remove xn
resulting constraints goes in the appropriate bucket
if it contains xn-1, goes in bucket n-1
if it contains xn-2, goes in bucket n-2
…
after removing variable xn:
buckets 1, …, n-1 left
repeat on bucket n-1
when on bucket 1:
all constraints on variable x1
common values: solution
bucket elimination = remove a variable
same solutions!
apart from the removed variable
why other algorithms?
why using other algorithms if bucket elimination works?
removing a variable may produce a large constraint
removing one of its variables may produce an even larger one, etc.
example:
|
|
|
merge and remove x:
| y | z | w |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| 1 | 1 | 1 |