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

a bijectionist's toolkit #35060

Merged
merged 64 commits into from
Mar 13, 2023
Merged

a bijectionist's toolkit #35060

merged 64 commits into from
Mar 13, 2023

Conversation

mantepse
Copy link
Collaborator

We provide a toolkit for the combinatorialist to help find functions ("statistics") s: A -> Z and bijections A -> B given sequences of finite sets A and B that satisfy various constraints.

Closes #33238

📝 Checklist

  • I have made sure that the title is self-explanatory and the description concisely explains the PR.
  • I have linked an issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

…initialize_new_bmilp, _veto_current_solution
Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Feb 14, 2023

Sorry, accidentally hit the wrong button.

@mantepse
Copy link
Collaborator Author

Thank you so much! This ticket means a lot to me!

@mantepse mantepse added this to the sage-10.0 milestone Feb 28, 2023
@vbraun
Copy link
Member

vbraun commented Mar 11, 2023

On 32-bit:

**********************************************************************
File "src/sage/combinat/bijectionist.py", line 1578, in sage.combinat.bijectionist.Bijectionist._forced_constant_blocks
Failed example:
    for p in bij.constant_blocks(): print(list(p))
Expected:
    [[2, 1, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [4, 2, 3, 1]]
    [[3, 2, 1], [1, 3, 2], [2, 1, 3]]
    [[2, 4, 3, 1], [3, 2, 4, 1], [2, 3, 1, 4], [1, 3, 4, 2]]
    [[1, 4, 2, 3], [3, 1, 2, 4], [4, 2, 1, 3], [4, 1, 3, 2]]
    [[1, 4, 3, 2], [3, 2, 1, 4]]
    [[2, 1, 4, 3], [4, 3, 2, 1]]
    [[2, 4, 1, 3], [3, 4, 2, 1], [4, 3, 1, 2], [3, 1, 4, 2]]
Got:
    [[1, 2, 4, 3], [4, 2, 3, 1], [1, 3, 2, 4], [2, 1, 3, 4]]
    [[2, 1, 3], [3, 2, 1], [1, 3, 2]]
    [[1, 3, 4, 2], [2, 3, 1, 4], [3, 2, 4, 1], [2, 4, 3, 1]]
    [[3, 1, 2, 4], [4, 2, 1, 3], [4, 1, 3, 2], [1, 4, 2, 3]]
    [[3, 2, 1, 4], [1, 4, 3, 2]]
    [[2, 1, 4, 3], [4, 3, 2, 1]]
    [[3, 4, 2, 1], [2, 4, 1, 3], [4, 3, 1, 2], [3, 1, 4, 2]]
**********************************************************************
File "src/sage/combinat/bijectionist.py", line 1587, in sage.combinat.bijectionist.Bijectionist._forced_constant_blocks
Failed example:
    for p in bij.constant_blocks(optimal=True): sorted(p, key=len)
Expected:
    [[1], [1, 2], [1, 2, 3], [1, 2, 3, 4]]
    [[1, 3, 2],
     [2, 1, 3],
     [3, 2, 1],
     [2, 3, 4, 1],
     [1, 3, 4, 2],
     [2, 1, 3, 4],
     [1, 3, 2, 4],
     [2, 3, 1, 4],
     [1, 2, 4, 3],
     [3, 2, 4, 1],
     [2, 1, 4, 3],
     [2, 4, 3, 1],
     [4, 2, 3, 1],
     [4, 3, 2, 1],
     [1, 4, 3, 2],
     [3, 2, 1, 4]]
    [[1, 4, 2, 3],
     [4, 2, 1, 3],
     [2, 4, 1, 3],
     [4, 3, 1, 2],
     [4, 1, 3, 2],
     [3, 4, 2, 1],
     [3, 1, 2, 4],
     [3, 1, 4, 2]]
Got:
    [[1], [1, 2], [1, 2, 3], [1, 2, 3, 4]]
    [[3, 2, 1],
     [1, 3, 2],
     [2, 1, 3],
     [2, 1, 4, 3],
     [1, 3, 2, 4],
     [2, 4, 3, 1],
     [1, 3, 4, 2],
     [2, 3, 1, 4],
     [3, 2, 1, 4],
     [4, 2, 3, 1],
     [1, 4, 3, 2],
     [2, 1, 3, 4],
     [1, 2, 4, 3],
     [3, 2, 4, 1],
     [4, 3, 2, 1],
     [2, 3, 4, 1]]
    [[3, 1, 2, 4],
     [4, 1, 3, 2],
     [4, 3, 1, 2],
     [1, 4, 2, 3],
     [3, 4, 2, 1],
     [4, 2, 1, 3],
     [2, 4, 1, 3],
     [3, 1, 4, 2]]
**********************************************************************
1 item had failures:
   2 of  65 in sage.combinat.bijectionist.Bijectionist._forced_constant_blocks
    [579 tests, 2 failures, 69.84 s]
----------------------------------------------------------------------
sage -t --long --random-seed=0 src/sage/combinat/bijectionist.py  # 2 doctests failed
----------------------------------------------------------------------

@mantepse
Copy link
Collaborator Author

@vbraun, I hope this solved the issue, but I have no way to test on 32 bit, I am sorry about that.

@github-actions
Copy link

Documentation preview for this PR is ready! 🎉
Built with commit: a72bd65

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this sorting should solve the issue.

@vbraun vbraun merged commit d6c38e5 into sagemath:develop Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

a bijectionist's toolkit
5 participants