Best reference I could find is this one. However, I could not quite understand this one since there is no numerical example.
What I am trying to achieve with one sentence
How can I answer the following question by using constraint programming:
The Euclidean distances between a point $p_4$ and points $p_1(0,0)$, $p_2(0,5)$ and $p_3(5,0)$ are $5.00$, $3.16$ and $4.47$ respectively. Where is $p_4$ on the $xy$-plane?
without using quadratic constraints?
Very short version of the question
There are five points placed on a 2D plane.
We only know the pairwise distance between these points.
\begin{matrix} d_{12} &= 5.00\\ d_{13} &= 5.00\\ d_{14} &= 5.00\\ d_{15} &= 5.00\\ d_{23} &= 7.71\\ d_{24} &= 3.16\\ d_{25} &= 4.47\\ d_{34} &= 4.47\\ d_{35} &= 3.16\\ d_{45} &= 1.41\\ \end{matrix}
In addition, we know the coordinates of first three points.
\begin{matrix} p_1 &= &(0,0)\\ p_2 &= &(0,5)\\ p_3 &= &(5,0)\\ \end{matrix}
And we want to find the coordinates of remaining two:
\begin{matrix} p_4 &= &(3,4)\\ p_5 &= &(4,3)\\ \end{matrix}
How can I formulate this problem without using quadratic constraints? Note that in order to impose the Euclidean distance between two points, we need to use square of differences.
Detailed version of the question
I am trying to formulate the graph embedding problem as constraint satisfaction problem.
Graph embedding is simply assigning coordinates to the vertices of a graph by considering edge weights, where the weight $w_{ij}$ of an edge $\{i,j\}$ determines the Euclidean distance between the nodes $i$ and $j$.
My decision variables are two arrays, $X$ and $Y$. $X_i$ and $Y_i$ are the $x$ and $y$ coordinates of node $i$.
The mathematical model can be written as:
given: $G = (V,E)$
decision variables: $X = \{x_1, \dots, x_{|V|}\}$; $Y = \{y_1, \dots, y_{|V|}\}$
subject to: $\forall \{i,j\} \in E$; $(x_i-x_j)^2 + (y_i-y_j)^2 = w_{ij}^2$
As discussed here,
$(x_i-x_j)^2 + (y_i-y_j)^2 = w_{ij}^2$
is a non-convex constraint. Is there any way to formulate this problem using convex constraints?
I came up with something:
Assuming that the coordinates and the edge weights will be integers;
I add two more decision variables: $O^X = {{O^X}{12}, {O^X}{13}, \dots, {O^X}{21}, {O^X}{23}, {O^X}{|V|(|V|-1)}} $ and $O^Y = {{O^Y}{12}, {O^Y}{13}, \dots, {O^Y}{21}, {O^Y}{23}, {O^Y}{|V|(|V|-1)}}$ where ${O^X}_{ij}$ is the offset of the $x$ coordinate of a node $j$ with respect to node $i$. The same goes with $y$ coordinates as well.
For instance, if $x_i = 3$, $y_i = 4$, ${O^X}{ij} = 2$, ${O^Y}{ij}j = -1$ then $x_j = 5$ and $y_j = 3$.
As for the constraints, I have written:
\begin{matrix} \forall {i,j} \in E;\ x_j = x_i + {O^X}{ij}\ y_j = y_i + {O^Y}{ij}\ |{O^X}{ij}| + |{O^Y}{ij}| = w_{ij} \end{matrix}
My logic behind that approach is as follows:
Since all the coordinates are integers, we are able to assume that we place the graph on a grid. If the Euclidean distance between $i$ and $j$ is $2$, and $i$ is on $(x,y)$ point, then $j$ should be on one of the following:
\begin{matrix} (x-2,&y+0)\ (x-1,&y-1)\ (x-1,&y+1)\ (x+0,&y-2)\ (x+0,&y+2)\ (x+1,&y-1)\ (x+1,&y+1)\ (x+2,&y+0) \end{matrix}
Of course, this is just an approximation to the actual solution.
However, the tool I work with (IBM ILOG CPLEX) does not give a solution.
I think I am mistaken somewhere.
Note: The above model (entitled as "I came up with something" is not what I am trying to achieve. However, I could not find a better way to impose convex constraints.