{"id":19268394,"url":"https://github.com/permutatriangle/permstruct","last_synced_at":"2025-09-23T13:44:30.489Z","repository":{"id":77608746,"uuid":"42444760","full_name":"PermutaTriangle/PermStruct","owner":"PermutaTriangle","description":null,"archived":false,"fork":false,"pushed_at":"2017-03-24T12:26:03.000Z","size":15635,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-23T19:46:04.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PermutaTriangle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-14T11:31:09.000Z","updated_at":"2016-10-25T10:38:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"b527a983-08df-41eb-8b74-ac2ba71d92e5","html_url":"https://github.com/PermutaTriangle/PermStruct","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PermutaTriangle/PermStruct","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PermutaTriangle%2FPermStruct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PermutaTriangle%2FPermStruct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PermutaTriangle%2FPermStruct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PermutaTriangle%2FPermStruct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PermutaTriangle","download_url":"https://codeload.github.com/PermutaTriangle/PermStruct/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PermutaTriangle%2FPermStruct/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276588219,"owners_count":25668822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-23T02:00:09.130Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T20:16:08.879Z","updated_at":"2025-09-23T13:44:30.435Z","avatar_url":"https://github.com/PermutaTriangle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The PermStruct Algorithm\n\n[![Build Status](https://travis-ci.org/PermutaTriangle/PermStruct.svg?branch=master)](https://travis-ci.org/PermutaTriangle/PermStruct)\n\nPermStruct is an algorithm for discovering descriptions of permutation sets in\nterms of so-called generating rules. These descriptions can then be used to\nderive generating functions for the permutation sets.\n\n## Installing\n\nTo install PermStruct on your system, start by installing the\n[Permuta](https://github.com/PermutaTriangle/Permuta) library. PermStruct was\nbuilt on an older version of Permuta so you will need to swap to the branch\ncalled \"struct\". Then run the following commands:\n```\n$ sudo ./setup.py install\n```\nIf you have [Gurobi](http://www.gurobi.com) installed then you are done. If you\ndo not have it run:\n```\n$ make -C exact_cover\n$ sudo make -C exact_cover install\n```\n\nYou can also possible to install PermStruct in development mode, in which case you\nrun the following instead:\n```\n$ sudo ./setup.py develop\n```\n\nTo run the unit tests, you can run the following command:\n```\n$ ./setup.py test\n```\n\n## Usage\nOnce you've installed PermStruct, it can be imported into a Python script like\nany other Python library:\n```\nimport permstruct\n```\n\nAs an example we run the algorithm on permutations avoiding the pattern 231.\nWe start by defining the basis `patts` and then run the algorithm.\n```\npatts = [Permutation([2,3,1])]\nstruct(patts)\n```\nWhen the input is just the basis the algorithm will infer other settings from\nthe longest pattern in the basis, `k = 3` here:\n\n* `size=k + 1` (the maximum size of the rules to try)\n* `perm_bound=max(size + 1, k + 2)` (the longest permutations to use from Av(patts))\n* `verify_bound=perm_bound + 2` (the longest permutations from Av(patts) to use to verify the cover found)\n* `subpatts_len=None` (the longest subpattern to use from the basis; `None` implies we use all subpatterns)\n* `subpatts_num=None` (the maximum number of subpatterns to use from the basis)\n* `subpatts_type=SubPatternType.EVERY` (the type of subpattern to use from the basis)\n* `ask_verify_higher=True` (whether to ask about verifying with longer permutations)\n\nIf the algorithm is too slow it good to try to decrease the size of the rules\n(`size`). If the algorithm does not find a cover it is often good to try\nincreasing the rule size. If the algorithm finds a cover that is not verified it\nis good to increase the `perm_bound`.\n\n## PyPy\nIf you have PyPy installed you can do all of the above in PyPy.\n\n## License\nBSD-3: see the [LICENSE](https://github.com/PermutaTriangle/PermStruct/blob/master/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermutatriangle%2Fpermstruct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpermutatriangle%2Fpermstruct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermutatriangle%2Fpermstruct/lists"}