Difference-map algorithm
The difference-map algorithm 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 projections onto constraint sets. From a mathematical perspective, the difference-map algorithm is a dynamical system based on a mapping of Euclidean space. Solutions are encoded as fixed points of the mapping.
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 Sudoku, as well as sphere- and disk-packing problems. 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, they cannot prove that a solution does not exist.
The difference-map algorithm is a generalization of two iterative methods: Fienup's Hybrid input output algorithm for phase retrieval
and the Douglas-Rachford algorithm 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.
Algorithm
The problem to be solved must first be formulated as a set intersection problem in Euclidean space: find an in the intersection of sets and. Another prerequisite is an implementation of the projections and that, given an arbitrary input point, return a point in the constraint set or that is nearest to. One iteration of the algorithm is given by the mapping:The real parameter 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 is recommended because it reduces the number of projection computations per iteration:
A point is a fixed point of the map precisely when. Since the left-hand side is an element of and the RHS is an element of, the equality implies that we have found a common element to the two constraint sets. Note that the fixed point itself need not belong to either or. The set of fixed points will typically have much higher dimension than the set of solutions.
The progress of the algorithm can be monitored by inspecting the norm of the difference of the two projections:
When this vanishes, a point common to both constraint sets has been found and the algorithm can be terminated.
Example: logical satisfiability
Incomplete algorithms, such as stochastic 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 :To each of the eight 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:
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 x11, x21 and x41 correspond to the same boolean variable or its negation, and are called replicas.
It is convenient to associate the values 1 and -1 with TRUE and FALSE rather than the traditional 1 and 0. With this convention, the compatibility between the replicas takes the form of the following linear equations:
The linear subspace where these equations are satisfied is one of the constraint spaces, say A, used by the difference map. To project to this constraint we replace each replica by the signed replica average, or its negative:
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,, or. The corresponding constraint set, B, is thus a set of 34 = 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, the larger of the two original values is replaced by 1. Examples:
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 x that lies in both constraint sets, then we know that the clauses associated with x are all TRUE, and the assignments to the replicas are consistent with a truth assignment to the original boolean variables.
To run the algorithm one first generates an initial point x0, say
Using β = 1, the next step is to compute PB :
This is followed by 2PB - x0,
and then projected onto the other constraint, PA :
Incrementing x0 by the difference of the two projections gives the first iteration of the difference map, D = x1 :
Here is the second iteration, D = x2 :
This is a fixed point: D = x2. The iterate is unchanged because the two projections agree. From PB,
we can read off the satisfying truth assignment: q1 = TRUE, q2 = FALSE, q3 = TRUE.
Chaotic dynamics
In the simple 2-SAT example above, the norm of the difference-map increment Δ decreased monotonically to zero in three iterations. This contrasts the behavior of Δ 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 chaotic, and that the space being searched is a strange attractor.Phase retrieval
In phase retrieval a signal or image is reconstructed from the modulus 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.The projection to the Fourier modulus constraint, say PA, 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 the discrete Fourier transform, as a unitary transformation, preserves distance, and rescaling the modulus is the smallest change that realizes the modulus constraint.
To recover the unknown phases of the Fourier transform the difference map relies on the projection to another constraint, PB. This may take several forms, as the object being reconstructed may be known to be positive, have a bounded support, etc. In the reconstruction of the surface image, for example, the effect of the projection PB was to nullify all values outside a rectangular support, and also to nullify all negative values within the support.