Message Boards Message Boards


Code & exploration of Minimal Superpermutation problem

Posted 8 years ago
2 Replies
9 Total Likes

You might wonder "what is this image below?". I will tell you in the end, because it is least relevant to the whole thing. But as you reading through try to guess.

enter image description here

Browsing the Robin Houston's blog I happened upon an interesting open problem of superpermutations. Imagine you have $n$ different symbols. What is the shortest string that contains every possible permutation of the symbols? For the $n \le 4$ we have the following results - and each string is a unique solution:

$$ \begin{array}{|l|l|l|} \hline \text{n} & \text{Minimal Superpermutation} & \text{Length} \ \hline 1 & 1 & 1 \ \hline 2 & 121 & 3 \ \hline 3 & 123121321 & 9 \ \hline 4 & 123412314231243121342132413214321 & 33 \ \hline \end{array} $$

They all are palindromes:

(# === StringReverse[#]) & /@ {"123121321",  "123412314231243121342132413214321"}

{True, True}

Here are 8 Minimal Superpermutations for $n=5$. They are very long and only the 1st is a palindrome:

(# === StringReverse[#])&/@{

{True, False, False, False, False, False, False, False}

Robin Houston's blog found an excellent short solution for $n=6$ with length 872, which, if I understand correctly, is not yet proven to be minimal. Robin thus disproved the conjecture that for all $n$ minimal superpermutations have length

$$\sum _{k=1}^n k!$$

which in $n=6$ case would give 873. The solution was found by encoding the problem as an instance of the (asymmetric) Traveling Salesman Problem (TSP).

My questions are (warning, I am not a mathematician ;-) ):

  • What is Wolfram Language code that finds Minimal Superpermutations?
  • Can we use Wolfram Language TSP?
  • Can the search be parallelized somehow?
  • Can we find anything interesting using computations, basically doing experimental mathematics?

Useful references:

So and finally, as promised, the top image comes from turning all 8 solutions of $n=6$ problem into sequence of digits and plotting them. If we denote the list of 8 solutions given above as n6sol, the code is:

ListLinePlot[Range[0, 28, 4] + ToExpression@Characters[n6sol], 
 AspectRatio -> 1/5, ImageSize -> 900, InterpolationOrder -> 2, 
 Axes -> False, Filling -> Table[n -> {n - 1}, {n, 2, 9}]]
POSTED BY: Vitaliy Kaurov
2 Replies

Hi Vitaliy,

a different but similarly intriguing problem is the one of De Bruijn sequences.

There are nice Demonstrations about that: De Bruijn Graph Arcs

Combinatorica had its own function for it: DeBruijnSequence

In Mathematica you can also try:

out = FindEulerianCycle[DeBruijnGraph[3, 1], 24];
(First /@ #) & /@ out

which comes from this website.

You might like the video on this website:

and in particular this one on how to crack a combination lock.



POSTED BY: Marco Thiel

Thanks, Marco, indeed, the relation to De Bruijn sequences is highlighted in this paper:

Non-Uniqueness of Minimal Superpermutations, Nathaniel Johnston

POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract