Quantcast
Channel: Yet Another Math Programming Consultant
Viewing all articles
Browse latest Browse all 809

The von Koch conjecture

$
0
0

Helge von Koch.jpg
Helge von Koch (1870-1924)

Consider a tree graph \(G=(V,E)\) with \(n\) nodes and \(n-1\) arcs. We can label the nodes with unique numbers \(1,\dots,n\) and the arcs with unique numbers \(1,\dots,n-1\) such that each arc has a label equal to the (absolute value) of difference of the labels of the attached nodes. This is also called “Graceful Labeling” [1].

Here is a picture from [2]:

enter image description here

We see that:

  • Each node has a unique label between 1 and 7 (the black numbers),
  • Each arc has a unique label between 1 and 6 (the red numbers),
  • Each arc has a label value equal to the difference in the labels of the associated nodes.

In [3] an interesting MIP formulation is proposed to find such a graceful labeling. There is no objective, i.e. we just look for a feasible solution. The uniqueness of node and arc labels is established by using an assignment block using binary variables (i.e. constraints we recognize from an assignment problem). A formulation can look like:

\[ \bbox[lightcyan,10px,border:3px solid darkblue]{ \begin{align}
\text{Node labels}\\&\sum_i x_{i,v} = 1\>\>\forall v&&\text{assignments of node labels}\\
&\sum_v x_{i,v} = 1 \>\>\forall i\\
&v^x_i  = \sum_v v \cdot x_{i,v}&&\text{value of node labels}\\
\hline
\text{Arc labels}\\&\sum_{(i,j)\in E} y_{i,j,e} = 1\>\forall e&&\text{assignment of arc labels}\\
&\sum_e  y_{i,j,e} = 1 \>\>\forall (i,j)\in E\\
&v^y_{i,j}  = \sum_e e \cdot y_{i,j,e}&&\text{value of arc labels}\\
\hline
\text{Relate arc/node}\\&v^y_{i,j} = | v^x_i - v^x_j | \>\>\forall (i,j)\in E&&\text{absolute value}&\\
\hline
\text{Variables}\\&x_{i,v} \in \{0,1\}&&\text{assign label $v$ to node $i$} \\
&y_{i,j,e} \in \{0,1\}&&\text{assign label $e$ to arc $(i,j)$}\\
&v^x_i \in \{1,\dots,n\}&&\text{value of node labels}\\
&v^y_{i,j} \in \{1,\dots,n-1\}&&\text{value of arc labels}
\end{align}} \]

It makes sense to form the set \(E\) only with arcs \(i<j\) to prevent duplication (if we have an arc \(a \rightarrow b\) we don’t want to check also \(b \rightarrow a\)).

The absolute value equation still needs to be linearized, which we detail next.

Linearizing the absolute value

A standard formulation for \(y=|x|\) uses “\(y= -x\) or \(y=x\)”, i.e.

\[\begin{align} & –x – \delta M \le y \le –x + \delta M\\
& x –(1-\delta) M \le y \le x + (1-\delta) M\\&\delta \in \{0,1\} \end{align} \]

We can slightly improve, by using:

\[\begin{align} & –x \le y \le –x + \delta M\\
& x \le y \le x + (1-\delta) M\\&\delta \in \{0,1\} \end{align} \]

For our model we can get good values for the big-M's:

\[\begin{align}
&v^y_{i,j} \ge v^x_i - v^x_j\\
&v^y_{i,j} \ge v^x_j - v^x_i\\
&v^y_{i,j} \le v^x_j - v^x_i  + 2 n \delta_{i,j} \\
&v^y_{i,j} \le v^x_j - v^x_j  + 2 n (1-\delta_{i,j}) \\
& \delta_{i,j} \in \{0,1\}
\end{align}\]

The solution is not unique. I see:

----     74 VARIABLE vx.L  node labels

a 7,    b 1,    c 4,    d 2,    e 5,    f 3,    g 6


----     74 VARIABLE vy.L  arc labels

            b           c           d           e           f           g

a           6                       5                                   1
b                       3                       4
e                                                           2

Alternative formulations

We can model the absolute value \(v^y_{i,j} = | v^x_i - v^x_j |\) slightly differently by introducing an objective:

\[\begin{align}
\min & \sum_{(i,j)\in E} v^y_{i,j}\\
&v^y_{i,j} \ge v^x_i - v^x_j\\
&v^y_{i,j} \ge v^x_j - v^x_i
\end{align}\]

This will save us a number of binary variables \(\delta\). This is a more standard formulation.

An alternative alternative is to use variable splitting:

\[\begin{align}
\min & \sum_{(i,j)\in E} v^y_{i,j}\\
&v^y_{i,j} = w^+_{i,j}+w^-_{i,j}\\
&w^+_{i,j} - w^-_{i,j}= v^x_i - v^x_j\\
&w^+_{i,j}, w^-_{i,j}\ge 0
\end{align}\]

Note: we should check afterwards if the correct absolute value was found (if not then the conjecture does not hold).

Enumerate solutions

We already established that the solution is not unique. How many solutions are there for this small example problem?

We can add a simple cut:

\[\sum_{i,v} \alpha_{i,v} x_{i,v} \le n-1\]

where \(\alpha_{i,v}=x^*_{i,v}\)  is a previously found solution. This will forbid this solution to be found again. If we solve again we will either find a new, different solution, or we see the model has become infeasible. In the latter case we can conclude there are no more solutions to be found. Note: if we used one of the alternative approaches, I suspect we may see the objective deteriorate instead of the model just becoming infeasible, so we would need to keep track of that.

If we repeat this, we find a surprisingly large number of solutions. Below are the node labels we collected in the solve loop:

----    119 PARAMETER vxall  collected node labels

              a           b           c           d           e           f           g

k1            7           1           4           2           5           3           6
k2            5           7           3           4           1           6           2
k3            1           6           4           5           3           2           7
k4            3           6           2           4           1           7           5
k5            7           3           6           2           5           4           1
k6            1           7           5           4           3           2           6
k7            1           5           2           7           3           4           6
k8            6           2           4           5           7           1           3
k9            7           2           4           3           5           6           1
k10           2           7           5           6           1           4           3
k11           4           7           3           2           1           6           5
k12           3           7           4           2           1           6           5
k13           2           1           6           5           7           3           4
k14           4           7           3           5           1           6           2
k15           7           3           6           1           5           4           2
k16           6           1           3           2           7           4           5
k17           7           2           6           4           3           5           1
k18           5           1           4           3           7           2           6
k19           5           1           4           6           7           2           3
k20           6           7           2           3           1           5           4
k21           1           6           2           4           5           3           7
k22           7           2           6           1           3           5           4
k23           1           6           4           7           3           2           5
k24           1           6           2           7           5           3           4
k25           4           7           2           3           1           5           6
k26           7           1           4           6           5           3           2
k27           7           2           4           1           5           6           3
k28           5           7           3           2           1           6           4
k29           7           1           3           4           5           6           2
k30           1           7           5           6           3           2           4
k31           4           1           5           3           7           2           6
k32           3           7           4           5           1           6           2
k33           1           5           2           6           3           4           7
k34           3           6           2           5           1           7           4
k35           4           1           6           2           7           3           5
k36           2           7           5           3           1           4           6
k37           4           1           5           6           7           2           3
k38           1           7           4           6           3           5           2
k39           6           1           3           5           7           4           2
k40           6           7           2           4           1           5           3
k41           4           7           2           6           1           5           3
k42           6           2           4           3           7           1           5
k43           2           1           6           4           7           3           5
k44           4           1           6           5           7           3           2
k45           7           1           3           2           5           6           4
k46           5           2           6           3           7           1           4
k47           3           1           5           6           7           2           4
k48           5           2           6           4           7           1           3
k49           2           6           4           3           1           7           5
k50           3           1           5           4           7           2           6
k51           1           7           4           2           3           5           6
k52           2           6           4           5           1           7           3

Note that there are \(7!=5040\) ways to order seven different labels, so from that perspective this is indeed a small subset of feasible node labels.

Instead of doing this solve loop ourselves we can also use the Solution Pool technology available in some solvers such as Cplex and Gurobi. This automates this loop (and does it way smarter and more efficient).

References
  1. Graceful Labeling, https://en.wikipedia.org/wiki/Graceful_labeling
  2. The von Koch conjecture, https://codegolf.stackexchange.com/questions/119263/the-von-koch-conjecture
  3. Mike Appleby, https://github.com/appleby/graceful-tree
  4. Helge von Koch, https://en.wikipedia.org/wiki/Helge_von_Koch

Viewing all articles
Browse latest Browse all 809

Trending Articles