Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider only subsets, not permutations #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

recmo
Copy link

@recmo recmo commented Jul 27, 2024

Empirically (in large fields), if a solution is satisfying then so are all its permutation and no valid solution has repeated elements. So it is sufficient to iterate over all subsets of length NUM_CELLS of the small range, which is much faster for larger sizes.

Additionally, the iterator is not converted to a list (which leads to a combinatorial sized memory allocation).

Note that the range is left hardcoded and will have to be increased for larger NUM_CELLS.

Empirically, if a solution is satisfying, so are all its permutation.
So it is sufficient to iterate over all subsets of length `NUM_CELLS` of the small range, which is much faster for larger sizes.

Additionally, the iterator is not converted to a list (which leads to a combinatorial sized memory allocation).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant