<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Difference-map_algorithm</id>
	<title>Difference-map algorithm - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Difference-map_algorithm"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Difference-map_algorithm&amp;action=history"/>
	<updated>2026-05-04T00:56:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Difference-map_algorithm&amp;diff=4388237&amp;oldid=prev</id>
		<title>imported&gt;Kvng: add link</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Difference-map_algorithm&amp;diff=4388237&amp;oldid=prev"/>
		<updated>2025-06-16T16:30:12Z</updated>

		<summary type="html">&lt;p&gt;add link&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[File:Iterations 0, 100, 200, 300 and 400 in difference-map reconstruction of [[grayscale image]] from Fourier transform modulus.png|thumb|right|Iterations 0, 100, 200, 300 and 400 in the difference-map reconstruction of a grayscale image from its Fourier transform modulus]]&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;difference-map algorithm&amp;#039;&amp;#039;&amp;#039; is a [[search algorithm]] for general [[constraint satisfaction]] problems. It is a [[meta-algorithm]] in the sense that it is built from more basic algorithms that perform [[Projection (linear algebra)|projections]] onto [[Constraint (mathematics)|constraint]] sets. From a mathematical perspective, the difference-map algorithm is a [[dynamical system]] based on a [[Map (mathematics)|mapping]] of [[Euclidean space]]. Solutions are encoded as [[Fixed point (mathematics)|fixed points]] of the mapping.&lt;br /&gt;
&lt;br /&gt;
Although originally conceived as a general method for solving the [[phase problem]], the difference-map algorithm has been used for the [[boolean satisfiability problem]], [[protein structure prediction]], [[Ramsey numbers]], [[diophantine equations]], and &amp;#039;&amp;#039;[[Sudoku]]&amp;#039;&amp;#039;,&amp;lt;ref&amp;gt;{{cite journal |last1=Elser |first1=V. |last2=Rankenburg |first2=I. |last3=Thibault |first3=P. |title=Searching with iterated maps |journal=Proceedings of the National Academy of Sciences |date=9 January 2007 |volume=104 |issue=2 |pages=418–423 |doi=10.1073/pnas.0606359104 |pmid=17202267 |pmc=1766399 |doi-access=free }}&amp;lt;/ref&amp;gt; as well as sphere- and disk-packing problems.&amp;lt;ref&amp;gt;{{cite journal |last1=Gravel |first1=Simon |last2=Elser |first2=Veit |title=Divide and concur: A general approach to constraint satisfaction |journal=Physical Review E |date=22 September 2008 |volume=78 |issue=3 |pages=036706 |doi=10.1103/PhysRevE.78.036706 |pmid=18851188 |arxiv=0801.0222 |bibcode=2008PhRvE..78c6706G |s2cid=27814394 }}&amp;lt;/ref&amp;gt; Since these applications include [[NP-complete]] problems, the scope of the difference map is that of an [[incomplete algorithm]]. Whereas incomplete algorithms can efficiently verify solutions (once a candidate is found), they cannot prove that a solution does not exist.&lt;br /&gt;
&lt;br /&gt;
The difference-map algorithm is a generalization of two [[iterative methods]]: Fienup&amp;#039;s [[Hybrid input output (HIO) algorithm for phase retrieval]]&amp;lt;ref&amp;gt;{{cite journal |last1=Fienup |first1=J. R. |title=Phase retrieval algorithms: a comparison |journal=Applied Optics |date=1 August 1982 |volume=21 |issue=15 |pages=2758–2769 |doi=10.1364/AO.21.002758 |pmid=20396114 |bibcode=1982ApOpt..21.2758F |s2cid=10777701 |s2cid-access=free }}&amp;lt;/ref&amp;gt; and the [[Douglas-Rachford algorithm]]&amp;lt;ref&amp;gt;{{cite journal |last1=Bauschke |first1=Heinz H. |last2=Combettes |first2=Patrick L. |last3=Luke |first3=D. Russell |title=Phase retrieval, error reduction algorithm, and Fienup variants: a view from convex optimization |journal=Journal of the Optical Society of America A |date=1 July 2002 |volume=19 |issue=7 |pages=1334–1345 |doi=10.1364/JOSAA.19.001334 |pmid=12095200 |bibcode=2002JOSAA..19.1334B |citeseerx=10.1.1.75.1070 }}&amp;lt;/ref&amp;gt; for [[convex optimization]]. Iterative methods, in general, have a long history in phase retrieval and convex optimization. The use of this style of algorithm for hard, non-convex problems is a more recent development.&lt;br /&gt;
&lt;br /&gt;
==Algorithm==&lt;br /&gt;
&lt;br /&gt;
The problem to be solved must first be formulated as a [[set intersection]] problem in Euclidean space: find an &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in the intersection of sets &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;. Another prerequisite is an implementation of the projections &amp;lt;math&amp;gt;P_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_B&amp;lt;/math&amp;gt; that, given an arbitrary input point &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;, return a point in the constraint set &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; that is nearest to &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;. One iteration of the algorithm is given by the mapping:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{align}&lt;br /&gt;
x \mapsto D(x) &amp;amp;= x + \beta \left[ P_A \left( f_B(x)\right) - P_B \left( f_A(x)\right)\right], \\&lt;br /&gt;
f_A(x) &amp;amp;= P_A(x) - \frac{1}{\beta}\left( P_A(x) - x\right), \\&lt;br /&gt;
f_B(x) &amp;amp;= P_B(x) + \frac{1}{\beta}\left( P_B(x) - x\right)&lt;br /&gt;
\end{align}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The real parameter &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; should not be equal to 0 but can have either sign; optimal values depend on the application and are determined through experimentation. As a first guess, the choice &amp;lt;math&amp;gt;\beta = 1&amp;lt;/math&amp;gt; (or &amp;lt;math&amp;gt;\beta = -1&amp;lt;/math&amp;gt;) is recommended because it reduces the number of projection computations per iteration:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;D(x) = x + P_A\left( 2P_B(x) - x\right)-P_B(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A point  &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; is a fixed point of the map &amp;lt;math&amp;gt;x \mapsto D(x)&amp;lt;/math&amp;gt; precisely when &amp;lt;math&amp;gt;P_A\left(f_B(x)\right) = P_B\left(f_A(x)\right)&amp;lt;/math&amp;gt;. Since the left-hand side is an element of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and the RHS is an element of &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;, the equality implies that we have found a common element to the two constraint sets. Note that the fixed point &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; itself need not belong to either &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;. The set of fixed points will typically have much higher dimension than the set of solutions.&lt;br /&gt;
&lt;br /&gt;
The progress of the algorithm can be monitored by inspecting the norm of the difference of the two projections:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Delta = \left| P_A \left( f_B(x)\right) - P_B \left( f_A(x)\right)\right|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When this vanishes, a point common to both constraint sets has been found and the algorithm can be terminated.&amp;lt;!-- The set of fixed points in a particular application will normally have a large [[dimension]], even when the solution set is a single point. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example: logical satisfiability ==&lt;br /&gt;
Incomplete algorithms, such as stochastic [[Local search (optimization)|local search]], are widely used for finding satisfying truth assignments to boolean formulas. As an example of solving an instance of [[2-SAT]] with the difference-map algorithm, consider the following formula (~ indicates NOT):&lt;br /&gt;
:(&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; or &amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;) and (~&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; or &amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) and (~&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; or ~&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) and (&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; or ~&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
To each of the eight [[Literal (mathematical logic)|literals]] in this formula we assign one real variable in an eight-dimensional Euclidean space. The structure of the 2-SAT formula can be recovered when these variables are arranged in a table:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;  style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt;&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt;)&lt;br /&gt;
|&lt;br /&gt;
|&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;22&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;31&amp;lt;/sub&amp;gt;)&lt;br /&gt;
|(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;32&amp;lt;/sub&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;41&amp;lt;/sub&amp;gt;&lt;br /&gt;
|(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;42&amp;lt;/sub&amp;gt;)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Rows are the clauses in the 2-SAT formula and literals corresponding to the same boolean variable are arranged in columns, with negation indicated by parentheses. For example, the real variables &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt;, &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt; and &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;41&amp;lt;/sub&amp;gt; correspond to the same boolean variable (&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;) or its negation, and are called &amp;#039;&amp;#039;&amp;#039;replicas&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
It is convenient to associate the values 1 and -1 with &amp;#039;&amp;#039;TRUE&amp;#039;&amp;#039; and &amp;#039;&amp;#039;FALSE&amp;#039;&amp;#039; rather than the traditional 1 and 0. With this convention, the compatibility between the replicas takes the form of the following linear equations:&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt; = -&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt; = &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;41&amp;lt;/sub&amp;gt;&lt;br /&gt;
:&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt; = -&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;31&amp;lt;/sub&amp;gt; = -&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;42&amp;lt;/sub&amp;gt;&lt;br /&gt;
:&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;22&amp;lt;/sub&amp;gt; = -&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;32&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The linear subspace where these equations are satisfied is one of the constraint spaces, say &amp;#039;&amp;#039;A&amp;#039;&amp;#039;, used by the difference map. To project to this constraint we replace each replica by the signed replica average, or its negative:&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;a&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; = (&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt; - &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt; + &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;41&amp;lt;/sub&amp;gt;) / 3&lt;br /&gt;
:&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt; &amp;amp;rarr; &amp;#039;&amp;#039;a&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;amp;nbsp; &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;21&amp;lt;/sub&amp;gt; &amp;amp;rarr; -&amp;#039;&amp;#039;a&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;        &amp;amp;nbsp; &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;41&amp;lt;/sub&amp;gt; &amp;amp;rarr; &amp;#039;&amp;#039;a&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second difference-map constraint applies to the rows of the table, the clauses. In a satisfying assignment, the two variables in each row must be assigned the values (1, 1), (1, -1), or (-1, 1). The corresponding constraint set, &amp;#039;&amp;#039;B&amp;#039;&amp;#039;, is thus a set of 3&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; = 81 points. In projecting to this constraint the following operation is applied to each row. First, the two real values are rounded to 1 or -1; then, if the outcome is (-1, -1), the larger of the two original values is replaced by 1. Examples:&lt;br /&gt;
&lt;br /&gt;
:(-.2, 1.2) &amp;amp;rarr; (-1, 1)&lt;br /&gt;
:(-.2, -.8) &amp;amp;rarr; (1, -1)&lt;br /&gt;
&lt;br /&gt;
It is a straightforward exercise to check that both of the projection operations described minimize the Euclidean distance between input and output values. Moreover, if the algorithm succeeds in finding a point &amp;#039;&amp;#039;x&amp;#039;&amp;#039; that lies in both constraint sets, then we know that (i) the clauses associated with &amp;#039;&amp;#039;x&amp;#039;&amp;#039; are all &amp;#039;&amp;#039;TRUE&amp;#039;&amp;#039;, and (ii) the assignments to the replicas are consistent with a truth assignment to the original boolean variables.&lt;br /&gt;
&lt;br /&gt;
To run the algorithm one first generates an initial point &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, say&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-0.5&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-0.8&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(-0.4)&lt;br /&gt;
|&lt;br /&gt;
| -0.6&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(0.3)&lt;br /&gt;
|(-0.8)&lt;br /&gt;
|-&lt;br /&gt;
|0.5&lt;br /&gt;
|(0.1)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Using β = 1, the next step is to compute &amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;) :&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|1&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-1&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(1)&lt;br /&gt;
|&lt;br /&gt;
| -1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(1)&lt;br /&gt;
|(-1)&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|(1)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is followed by 2&amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;) - &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|2.5&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-1.2&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(2.4)&lt;br /&gt;
|&lt;br /&gt;
| -1.4&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(1.7)&lt;br /&gt;
|(-1.2)&lt;br /&gt;
|-&lt;br /&gt;
|1.5&lt;br /&gt;
|(1.9)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
and then projected onto the other constraint, &amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;A&amp;lt;/sub&amp;gt;(2&amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;) - &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;) :&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|0.53333&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-1.6&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(-0.53333)&lt;br /&gt;
|&lt;br /&gt;
| -0.1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(1.6)&lt;br /&gt;
|(0.1)&lt;br /&gt;
|-&lt;br /&gt;
|0.53333&lt;br /&gt;
|(1.6)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Incrementing &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; by the difference of the two projections gives the first iteration of the difference map, &amp;#039;&amp;#039;D&amp;#039;&amp;#039;(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;) = &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-0.96666&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-1.4&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(-1.93333)&lt;br /&gt;
|&lt;br /&gt;
| 0.3&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(0.9)&lt;br /&gt;
|(0.3)&lt;br /&gt;
|-&lt;br /&gt;
|0.03333&lt;br /&gt;
|(0.7)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Here is the second iteration, &amp;#039;&amp;#039;D&amp;#039;&amp;#039;(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;) = &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-0.3&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-1.4&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(-2.6)&lt;br /&gt;
|&lt;br /&gt;
| -0.7&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(0.9)&lt;br /&gt;
|(-0.7)&lt;br /&gt;
|-&lt;br /&gt;
|0.7&lt;br /&gt;
|(0.7)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This is a fixed point: &amp;#039;&amp;#039;D&amp;#039;&amp;#039;(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;) = &amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;. The iterate is unchanged because the two projections agree. From &amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;&amp;#039;&amp;#039;B&amp;#039;&amp;#039;&amp;lt;/sub&amp;gt;(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;),&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color:white;text-align: center;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|1&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|-1&lt;br /&gt;
|width=&amp;quot;80pt&amp;quot;|&lt;br /&gt;
|-&lt;br /&gt;
|(-1)&lt;br /&gt;
|&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|(1)&lt;br /&gt;
|(-1)&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|(1)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
we can read off the satisfying truth assignment: &amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; = &amp;#039;&amp;#039;TRUE&amp;#039;&amp;#039;, &amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = &amp;#039;&amp;#039;FALSE&amp;#039;&amp;#039;, &amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; = &amp;#039;&amp;#039;TRUE&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
== Chaotic dynamics ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Time series of norm of difference-map increment Δ, during solving random 3-SAT instance.png|right|thumb|Time series of the norm of the difference-map increment &amp;#039;&amp;#039;&amp;amp;Delta;&amp;#039;&amp;#039; in the course of solving a random 3-SAT instance with 1000 variables and 4200 clauses.]]&lt;br /&gt;
&lt;br /&gt;
In the simple 2-SAT example above, the norm of the difference-map increment &amp;#039;&amp;#039;Δ&amp;#039;&amp;#039; decreased monotonically to zero in three iterations. This contrasts with the behavior of &amp;#039;&amp;#039;Δ&amp;#039;&amp;#039; when the difference map is given a hard instance of [[3-SAT]], where it fluctuates strongly prior to the discovery of the fixed point. As a dynamical system the difference map is believed to be [[Chaos theory|chaotic]], and that the space being searched is a [[strange attractor]].&lt;br /&gt;
&lt;br /&gt;
== Phase retrieval ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diffraction data.png|left|thumb|Fourier transform modulus (diffraction pattern) of the grayscale image shown being reconstructed at the top of the page.]]&lt;br /&gt;
&lt;br /&gt;
In phase retrieval a signal or image is reconstructed from the [[Absolute value|modulus]] (absolute value, magnitude) of its [[discrete Fourier transform]]. For example, the source of the modulus data may be the [[Fraunhofer diffraction]] pattern formed when an object is illuminated with [[coherent light]].&lt;br /&gt;
&lt;br /&gt;
The projection to the Fourier modulus constraint, say &amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;&amp;#039;&amp;#039;A&amp;#039;&amp;#039;&amp;lt;/sub&amp;gt;, is accomplished by first computing the discrete Fourier transform of the signal or image, rescaling the moduli to agree with the data, and then inverse transforming the result. This is a projection, in the sense that the Euclidean distance to the constraint is minimized, because (i) the discrete Fourier transform, as a [[unitary transformation]], preserves distance, and (ii) rescaling the modulus (without modifying the phase) is the smallest change that realizes the modulus constraint.&lt;br /&gt;
&lt;br /&gt;
To recover the unknown phases of the Fourier transform the difference map relies on the projection to another constraint, &amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;&amp;#039;&amp;#039;B&amp;#039;&amp;#039;&amp;lt;/sub&amp;gt;. This may take several forms, as the object being reconstructed may be known to be positive, have a bounded [[Support (mathematics)|support]], etc. In the reconstruction of the surface image, for example, the effect of the projection &amp;#039;&amp;#039;P&amp;#039;&amp;#039;&amp;lt;sub&amp;gt;&amp;#039;&amp;#039;B&amp;#039;&amp;#039;&amp;lt;/sub&amp;gt; was to nullify all values outside a rectangular support, and also to nullify all negative values within the support.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://barisdemiroz.github.io/sudoku/sudokusolver_demo.html Sudoku Solver] - A Sudoku solver based on Difference Map algorithm.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
{{reflist|2}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Search algorithms]]&lt;br /&gt;
[[Category:Constraint programming]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Kvng</name></author>
	</entry>
</feed>