In [1] an optimization model is proposed for the following problem:
Using a list of 5-letter words, try to find a set of 5 words such that each letter is used at most once.
Data
The list of 5-letter words is from the wordle [2] game. Words with duplicate letters are removed. A partial list is:
---- 1035 SET w words: large list of 5-letter words abdom, abend, abets, abhor, abide, abies, abyes, abilo, abime, abysm, abled, abler, ables ablet, ablow, abmho, abner, abnet, abode, abody, abohm, aboil, abord, abort, abote, about above, abret, abrim, abrin, abris, abrus, absey, absit, abstr, abune, abuse, abush, abuts acedy, acerb, ached, achen, acher, aches, achor, acidy, acids, acier, acies, acyls, acing ackey, acker, aclys, acmes, acned, acnes, acoin, acold, acone, acorn, acost, acoup, acred acres, acrid, acryl, acron, acrux, acted, actin, acton, actor, actos, actus, acute, adcon
The total number of 5-letter words in this list is: 10,175.
For our model, we need to know if character \(c\) is present in word \(w\). For this, we form a 2-dimensional set \(\color{darkblue}{\mathit{inWord}}_{w,c}\). A partial view looks like this:
---- 1053 SET inWord character c is in word w
a b c d e f g h i j
abdom YES YES YES
abend YES YES YES YES
abets YES YES YES
abhor YES YES YES
abide YES YES YES YES YES
abies YES YES YES YES
Model
A simple model to find a maximum subset of words that have unique letters can be:
Covering Model |
---|
\[\begin{align}\max& \sum_w \color{darkred}x_w \\ & \sum_{w|\color{darkblue}{\mathit{inWord}}(w,c)} \color{darkred}x_w \le 1 && \forall c \\ & \color{darkred}x_w \in \{0,1\} \end{align}\] |
---- 1082 VARIABLE x.L select word brick 1.000, fldxt 1.000, nymph 1.000, quags 1.000, vejoz 1.000 ---- 1082 VARIABLE count.L = 5.000 number of selected words
All solutions
According to Parker, executing the Parker algorithm on a laptop took about a month.
References
- Christopher D. Long, https://github.com/octonion/puzzles/tree/baba3c605ceb83155fd427c00f8812290a66bb7e/twitter/parker
- Wordle, https://www.nytimes.com/games/wordle/index.html
- K best solutions for an assignment problem, https://yetanothermathprogrammingconsultant.blogspot.com/2018/04/k-best-solutions-for-assignment-problem.html
- Benjamin Paassen, https://gitlab.com/bpaassen/five_clique
Appendix: GAMS model
$ontext |
No comments:
Post a Comment