GitXplorerGitXplorer
S

Typewriter-Opt

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
a4acc0031ba37e78548963424d81a3562fd35c35

Add the implementation.

committed 3 years ago
Verified
b1f766521aab0ebec888b40641c17daeb64a1dc5

Update README.md

SSeanRBurton committed 3 years ago
Verified
9801b1e66b52ad92365cfa08b0bee763d384d6eb

Update README.md

SSeanRBurton committed 3 years ago
Verified
aa6b7386dc255e1239d5dd69f557b3fe38b6df73

Initial commit

SSeanRBurton committed 3 years ago

README

The README file for this repository.

Typewriter-Opt

Using dynamic programming to solve the problem posed by http://hardmath123.github.io/crown-typewriter.html#comment-toggle to optimality. Given the probability of transitioning between each pair of letters, what is the sequential layout which minimizes the expected transition distance (weighted by the corresponding probabilities)?

If we lay the letters out left to right, then you can think of adding a letter to the layout as doing two things:

  1. Pushing the assigned letters away from the unassigned letters by a distance of 1.
  2. Moving the new letter from the unassigned set to the assigned set.

We can compute the change in cost independent of the order of the assigned letters, so we can use dynamic programming over assigned subsets. This reduces the complexity from n! to 2^n, and makes it possible to prove the optimal solution in less than 30 seconds.