<s>
In	O
constraint	B-Application
satisfaction	I-Application
,	O
the	O
AC-3	B-Application
algorithm	I-Application
(	O
short	O
for	O
Arc	O
Consistency	O
Algorithm	O
#3	O
)	O
is	O
one	O
of	O
a	O
series	O
of	O
algorithms	O
used	O
for	O
the	O
solution	O
of	O
constraint	B-Application
satisfaction	I-Application
problems	I-Application
(	O
or	O
CSP	O
's	O
)	O
.	O
</s>
<s>
The	O
earlier	O
AC	O
algorithms	O
are	O
often	O
considered	O
too	O
inefficient	O
,	O
and	O
many	O
of	O
the	O
later	O
ones	O
are	O
difficult	O
to	O
implement	O
,	O
and	O
so	O
AC-3	O
is	O
the	O
one	O
most	O
often	O
taught	O
and	O
used	O
in	O
very	O
simple	O
constraint	B-Application
solvers	O
.	O
</s>
<s>
A	O
variable	O
can	O
take	O
any	O
of	O
several	O
discrete	O
values	O
;	O
the	O
set	O
of	O
values	O
for	O
a	O
particular	O
variable	O
is	O
known	O
as	O
its	O
domain	B-Algorithm
.	O
</s>
<s>
A	O
constraint	B-Application
is	O
a	O
relation	B-Algorithm
that	O
limits	O
or	O
constrains	O
the	O
values	O
a	O
variable	O
may	O
have	O
.	O
</s>
<s>
The	O
constraint	B-Application
may	O
involve	O
the	O
values	O
of	O
other	O
variables	O
.	O
</s>
<s>
The	O
current	O
status	O
of	O
the	O
CSP	O
during	O
the	O
algorithm	O
can	O
be	O
viewed	O
as	O
a	O
directed	O
graph	O
,	O
where	O
the	O
nodes	O
are	O
the	O
variables	O
of	O
the	O
problem	O
,	O
with	O
edges	O
or	O
arcs	O
between	O
variables	O
that	O
are	O
related	O
by	O
symmetric	O
constraints	O
,	O
where	O
each	O
arc	O
in	O
the	O
worklist	O
represents	O
a	O
constraint	B-Application
that	O
needs	O
to	O
be	O
checked	O
for	O
consistency	O
.	O
</s>
<s>
It	O
removes	O
those	O
values	O
from	O
the	O
domain	B-Algorithm
of	O
x	O
which	O
are	O
n't	O
consistent	O
with	O
the	O
constraints	O
between	O
x	O
and	O
y	O
.	O
</s>
<s>
The	O
algorithm	O
keeps	O
a	O
collection	O
of	O
arcs	O
that	O
are	O
yet	O
to	O
be	O
checked	O
;	O
when	O
the	O
domain	B-Algorithm
of	O
a	O
variable	O
has	O
any	O
values	O
removed	O
,	O
all	O
the	O
arcs	O
of	O
constraints	O
pointing	O
to	O
that	O
pruned	O
variable	O
(	O
except	O
the	O
arc	O
of	O
the	O
current	O
constraint	B-Application
)	O
are	O
added	O
to	O
the	O
collection	O
.	O
</s>
<s>
For	O
illustration	O
,	O
here	O
is	O
an	O
example	O
of	O
a	O
very	O
simple	O
constraint	B-Application
problem	O
:	O
</s>
<s>
X	O
(	O
a	O
variable	O
)	O
has	O
the	O
possible	O
values	O
{	O
0	O
,	O
1	O
,	O
2	O
,	O
3	O
,	O
4	O
,	O
5}	O
--	O
the	O
set	O
of	O
these	O
values	O
are	O
the	O
domain	B-Algorithm
of	O
X	O
,	O
or	O
D(X )	O
.	O
</s>
<s>
The	O
variable	O
Y	O
has	O
the	O
domain	B-Algorithm
D(Y )	O
=	O
{	O
0	O
,	O
1	O
,	O
2	O
,	O
3	O
,	O
4	O
,	O
5	O
,	O
6	O
,	O
7	O
,	O
8	O
,	O
9}	O
.	O
</s>
<s>
Notice	O
that	O
the	O
actual	O
constraint	B-Application
graph	O
representing	O
this	O
problem	O
must	O
contain	O
two	O
edges	O
between	O
X	O
and	O
Y	O
since	O
C2	O
is	O
undirected	O
but	O
the	O
graph	O
representation	O
being	O
used	O
by	O
AC-3	O
is	O
directed	O
.	O
</s>
<s>
It	O
does	O
so	O
by	O
first	O
removing	O
the	O
non-even	O
values	O
out	O
of	O
the	O
domain	B-Algorithm
of	O
X	O
as	O
required	O
by	O
C1	O
,	O
leaving	O
D(X )	O
=	O
{	O
0	O
,	O
2	O
,	O
4	O
}	O
.	O
</s>
<s>
Only	O
the	O
pairs	O
(	O
X	O
=	O
0	O
,	O
Y	O
=	O
4	O
)	O
,	O
(	O
X	O
=	O
2	O
,	O
Y	O
=	O
2	O
)	O
,	O
and	O
(	O
X	O
=	O
4	O
,	O
Y	O
=	O
0	O
)	O
match	O
the	O
constraint	B-Application
C2	O
.	O
</s>
<s>
The	O
algorithm	O
has	O
a	O
worst-case	O
time	O
complexity	O
of	O
O(ed3 )	O
and	O
space	O
complexity	O
of	O
O(e )	O
,	O
where	O
e	O
is	O
the	O
number	O
of	O
arcs	O
and	O
d	O
is	O
the	O
size	O
of	O
the	O
largest	O
domain	B-Algorithm
.	O
</s>
