<s>
The	O
difference-map	B-Application
algorithm	I-Application
is	O
a	O
search	B-Application
algorithm	I-Application
for	O
general	O
constraint	B-Application
satisfaction	I-Application
problems	O
.	O
</s>
<s>
It	O
is	O
a	O
meta-algorithm	B-Algorithm
in	O
the	O
sense	O
that	O
it	O
is	O
built	O
from	O
more	O
basic	O
algorithms	O
that	O
perform	O
projections	B-Algorithm
onto	O
constraint	B-Application
sets	O
.	O
</s>
<s>
From	O
a	O
mathematical	O
perspective	O
,	O
the	O
difference-map	B-Application
algorithm	I-Application
is	O
a	O
dynamical	O
system	O
based	O
on	O
a	O
mapping	B-Algorithm
of	O
Euclidean	O
space	O
.	O
</s>
<s>
Solutions	O
are	O
encoded	O
as	O
fixed	O
points	O
of	O
the	O
mapping	B-Algorithm
.	O
</s>
<s>
Although	O
originally	O
conceived	O
as	O
a	O
general	O
method	O
for	O
solving	O
the	O
phase	O
problem	O
,	O
the	O
difference-map	B-Application
algorithm	I-Application
has	O
been	O
used	O
for	O
the	O
boolean	B-Algorithm
satisfiability	I-Algorithm
problem	I-Algorithm
,	O
protein	O
structure	O
prediction	O
,	O
Ramsey	O
numbers	O
,	O
diophantine	O
equations	O
,	O
and	O
Sudoku	O
,	O
as	O
well	O
as	O
sphere	O
-	O
and	O
disk-packing	O
problems	O
.	O
</s>
<s>
The	O
difference-map	B-Application
algorithm	I-Application
is	O
a	O
generalization	O
of	O
two	O
iterative	B-Algorithm
methods	I-Algorithm
:	O
Fienup	O
's	O
Hybrid	O
input	O
output	O
(	O
HIO	O
)	O
algorithm	O
for	O
phase	O
retrieval	O
and	O
the	O
Douglas-Rachford	O
algorithm	O
for	O
convex	O
optimization	O
.	O
</s>
<s>
Iterative	B-Algorithm
methods	I-Algorithm
,	O
in	O
general	O
,	O
have	O
a	O
long	O
history	O
in	O
phase	O
retrieval	O
and	O
convex	O
optimization	O
.	O
</s>
<s>
Another	O
prerequisite	O
is	O
an	O
implementation	O
of	O
the	O
projections	B-Algorithm
and	O
that	O
,	O
given	O
an	O
arbitrary	O
input	O
point	O
,	O
return	O
a	O
point	O
in	O
the	O
constraint	B-Application
set	O
or	O
that	O
is	O
nearest	O
to	O
.	O
</s>
<s>
One	O
iteration	O
of	O
the	O
algorithm	O
is	O
given	O
by	O
the	O
mapping	B-Algorithm
:	O
</s>
<s>
As	O
a	O
first	O
guess	O
,	O
the	O
choice	O
(	O
or	O
)	O
is	O
recommended	O
because	O
it	O
reduces	O
the	O
number	O
of	O
projection	B-Algorithm
computations	O
per	O
iteration	O
:	O
</s>
<s>
Since	O
the	O
left-hand	O
side	O
is	O
an	O
element	O
of	O
and	O
the	O
RHS	O
is	O
an	O
element	O
of	O
,	O
the	O
equality	O
implies	O
that	O
we	O
have	O
found	O
a	O
common	O
element	O
to	O
the	O
two	O
constraint	B-Application
sets	O
.	O
</s>
<s>
The	O
progress	O
of	O
the	O
algorithm	O
can	O
be	O
monitored	O
by	O
inspecting	O
the	O
norm	O
of	O
the	O
difference	O
of	O
the	O
two	O
projections	B-Algorithm
:	O
</s>
<s>
When	O
this	O
vanishes	O
,	O
a	O
point	O
common	O
to	O
both	O
constraint	B-Application
sets	O
has	O
been	O
found	O
and	O
the	O
algorithm	O
can	O
be	O
terminated	O
.	O
</s>
<s>
Incomplete	O
algorithms	O
,	O
such	O
as	O
stochastic	B-Algorithm
local	I-Algorithm
search	I-Algorithm
,	O
are	O
widely	O
used	O
for	O
finding	O
satisfying	O
truth	O
assignments	O
to	O
boolean	O
formulas	O
.	O
</s>
<s>
As	O
an	O
example	O
of	O
solving	O
an	O
instance	O
of	O
2-SAT	B-Application
with	O
the	O
difference-map	B-Application
algorithm	I-Application
,	O
consider	O
the	O
following	O
formula	O
(	O
~	O
indicates	O
NOT	O
)	O
:	O
</s>
<s>
The	O
structure	O
of	O
the	O
2-SAT	B-Application
formula	O
can	O
be	O
recovered	O
when	O
these	O
variables	O
are	O
arranged	O
in	O
a	O
table	O
:	O
</s>
<s>
Rows	O
are	O
the	O
clauses	O
in	O
the	O
2-SAT	B-Application
formula	O
and	O
literals	O
corresponding	O
to	O
the	O
same	O
boolean	O
variable	O
are	O
arranged	O
in	O
columns	O
,	O
with	O
negation	O
indicated	O
by	O
parentheses	O
.	O
</s>
<s>
The	O
linear	O
subspace	O
where	O
these	O
equations	O
are	O
satisfied	O
is	O
one	O
of	O
the	O
constraint	B-Application
spaces	O
,	O
say	O
A	O
,	O
used	O
by	O
the	O
difference	O
map	O
.	O
</s>
<s>
To	O
project	O
to	O
this	O
constraint	B-Application
we	O
replace	O
each	O
replica	O
by	O
the	O
signed	O
replica	O
average	O
,	O
or	O
its	O
negative	O
:	O
</s>
<s>
The	O
second	O
difference-map	O
constraint	B-Application
applies	O
to	O
the	O
rows	O
of	O
the	O
table	O
,	O
the	O
clauses	O
.	O
</s>
<s>
The	O
corresponding	O
constraint	B-Application
set	O
,	O
B	O
,	O
is	O
thus	O
a	O
set	O
of	O
34	O
=	O
81	O
points	O
.	O
</s>
<s>
In	O
projecting	O
to	O
this	O
constraint	B-Application
the	O
following	O
operation	O
is	O
applied	O
to	O
each	O
row	O
.	O
</s>
<s>
It	O
is	O
a	O
straightforward	O
exercise	O
to	O
check	O
that	O
both	O
of	O
the	O
projection	B-Algorithm
operations	O
described	O
minimize	O
the	O
Euclidean	O
distance	O
between	O
input	O
and	O
output	O
values	O
.	O
</s>
<s>
Moreover	O
,	O
if	O
the	O
algorithm	O
succeeds	O
in	O
finding	O
a	O
point	O
x	O
that	O
lies	O
in	O
both	O
constraint	B-Application
sets	O
,	O
then	O
we	O
know	O
that	O
(	O
i	O
)	O
the	O
clauses	O
associated	O
with	O
x	O
are	O
all	O
TRUE	O
,	O
and	O
(	O
ii	O
)	O
the	O
assignments	O
to	O
the	O
replicas	O
are	O
consistent	O
with	O
a	O
truth	O
assignment	O
to	O
the	O
original	O
boolean	O
variables	O
.	O
</s>
<s>
and	O
then	O
projected	O
onto	O
the	O
other	O
constraint	B-Application
,	O
PA(2PB(x0 )	O
-	O
x0	O
)	O
:	O
</s>
<s>
Incrementing	O
x0	O
by	O
the	O
difference	O
of	O
the	O
two	O
projections	B-Algorithm
gives	O
the	O
first	O
iteration	O
of	O
the	O
difference	O
map	O
,	O
D(x0 )	O
=	O
x1	O
:	O
</s>
<s>
The	O
iterate	O
is	O
unchanged	O
because	O
the	O
two	O
projections	B-Algorithm
agree	O
.	O
</s>
<s>
In	O
the	O
simple	O
2-SAT	B-Application
example	O
above	O
,	O
the	O
norm	O
of	O
the	O
difference-map	O
increment	O
Δ	O
decreased	O
monotonically	O
to	O
zero	O
in	O
three	O
iterations	O
.	O
</s>
<s>
In	O
phase	O
retrieval	O
a	O
signal	O
or	O
image	O
is	O
reconstructed	O
from	O
the	O
modulus	O
(	O
absolute	O
value	O
,	O
magnitude	O
)	O
of	O
its	O
discrete	B-Algorithm
Fourier	I-Algorithm
transform	I-Algorithm
.	O
</s>
<s>
The	O
projection	B-Algorithm
to	O
the	O
Fourier	O
modulus	O
constraint	B-Application
,	O
say	O
PA	O
,	O
is	O
accomplished	O
by	O
first	O
computing	O
the	O
discrete	B-Algorithm
Fourier	I-Algorithm
transform	I-Algorithm
of	O
the	O
signal	O
or	O
image	O
,	O
rescaling	O
the	O
moduli	O
to	O
agree	O
with	O
the	O
data	O
,	O
and	O
then	O
inverse	O
transforming	O
the	O
result	O
.	O
</s>
<s>
This	O
is	O
a	O
projection	B-Algorithm
,	O
in	O
the	O
sense	O
that	O
the	O
Euclidean	O
distance	O
to	O
the	O
constraint	B-Application
is	O
minimized	O
,	O
because	O
(	O
i	O
)	O
the	O
discrete	B-Algorithm
Fourier	I-Algorithm
transform	I-Algorithm
,	O
as	O
a	O
unitary	B-Algorithm
transformation	I-Algorithm
,	O
preserves	O
distance	O
,	O
and	O
(	O
ii	O
)	O
rescaling	O
the	O
modulus	O
(	O
without	O
modifying	O
the	O
phase	O
)	O
is	O
the	O
smallest	O
change	O
that	O
realizes	O
the	O
modulus	O
constraint	B-Application
.	O
</s>
<s>
To	O
recover	O
the	O
unknown	O
phases	O
of	O
the	O
Fourier	O
transform	O
the	O
difference	O
map	O
relies	O
on	O
the	O
projection	B-Algorithm
to	O
another	O
constraint	B-Application
,	O
PB	O
.	O
</s>
<s>
In	O
the	O
reconstruction	O
of	O
the	O
surface	O
image	O
,	O
for	O
example	O
,	O
the	O
effect	O
of	O
the	O
projection	B-Algorithm
PB	O
was	O
to	O
nullify	O
all	O
values	O
outside	O
a	O
rectangular	O
support	O
,	O
and	O
also	O
to	O
nullify	O
all	O
negative	O
values	O
within	O
the	O
support	O
.	O
</s>
