Closed jonadsimon closed 2 years ago
Added in https://github.com/jonadsimon/wonder-words-generator/commit/f4ad0a40111eb84fdabebc2dc6b7b3c32cdc7499
It's MUCH faster than the Minizinc version Only needs ~10 passes over the words to complete, takes a fraction of a second Easy to specify ordered constraints prioritizing optimizing the min over the optimizing the mean, but still considering both
Turned out no hashing was needed because sequence of updates induce a strict ordering on the states, so no revisiting is possible
Relying on the Minizinc optimizer for this preprocessing step is slow and wasteful since it can be just as easily accomplished by using a bubble-sort kind of approach within the largest word-length class which is present in the dataset.
Pseudocode:
Note: can't use code as-is because requires mutating
words_present
in-place. Will need to replace with while-loop logic. Should also use an additional out-loop to do the sweep. Also need to keep track of whether state has been visited before by e.g. hashing a sorted/concatenated version of the list.