{"id":13749074,"url":"https://github.com/crillab/pblib-rs","last_synced_at":"2025-05-09T11:32:02.834Z","repository":{"id":210695745,"uuid":"727182996","full_name":"crillab/pblib-rs","owner":"crillab","description":"Rust safe bindings for pblib.","archived":false,"fork":false,"pushed_at":"2023-12-04T11:24:52.000Z","size":5374,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-03T01:51:23.633Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crillab.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}},"created_at":"2023-12-04T10:59:13.000Z","updated_at":"2025-04-02T18:28:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfc4ffea-425f-43fc-bd47-8fee05e5c3a6","html_url":"https://github.com/crillab/pblib-rs","commit_stats":null,"previous_names":["crillab/pblib-rs"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crillab%2Fpblib-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crillab%2Fpblib-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crillab%2Fpblib-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crillab%2Fpblib-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crillab","download_url":"https://codeload.github.com/crillab/pblib-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253240350,"owners_count":21876593,"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","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-08-03T07:00:54.903Z","updated_at":"2025-05-09T11:31:57.820Z","avatar_url":"https://github.com/crillab.png","language":"C++","funding_links":[],"categories":["Projects"],"sub_categories":["Libraries"],"readme":"# pblib-rs\n\nRust safe bindings for pblib.\n\nThe source code of pblib is taken from the fork maintained by Radomír Černoch [on Github](https://github.com/master-keying/pblib).\nThis crate currently provides bindings to a partial set of the initial library functions.\nSee the original documentation (that can be retrieved from the fork's README page) if you need more information on the encodings.\n\nThe entry point of the API is the `PB2CNF` structure.\nYou should begin by taking a look at its documentation is you want to use pblib-rs.\n\n## TL;DR\n\nCardinality constraints:\n\n```rust\nuse pblib_rs::PB2CNF;\n\n// we encode x1 + x2 + x3 \u003e= 2\nlet literals = vec![1, 2, 3];\nlet pb2cnf = PB2CNF::new();\n// the threshold is 2 and the first variable not in use is 4\nlet encoding = pb2cnf.encode_at_least_k(literals, 2, 4);\nprintln!(\"the encoding uses {} variables\", encoding.next_free_var_id() - 4);\nprintln!(\"the encoding uses {} clauses\", encoding.clauses().len());\nencoding.clauses().iter().enumerate().for_each(|(i,c)| println!(\"clause {i} is {:?}\", c));\n```\n\nPseudo-Boolean constraints:\n\n```rust\nuse pblib_rs::PB2CNF;\n\n// we encode 8*x1 + 4*x2 + 2*x3 + 1*x4 \u003e= 6\nlet weights = vec![8, 4, 2, 1];\nlet literals = vec![1, 2, 3, 4];\nlet pb2cnf = PB2CNF::new();\n// the threshold is 6 and the first variable not in use is 5\nlet encoding = pb2cnf.encode_geq(weights.clone(), literals, 6, 5);\nprintln!(\"the encoding uses {} variables\", encoding.next_free_var_id() - 4);\nprintln!(\"the encoding uses {} clauses\", encoding.clauses().len());\nencoding.clauses().iter().enumerate().for_each(|(i,c)| println!(\"clause {i} is {:?}\", c));\n```\n\n## License\n\npblib-rs is developed at CRIL (Univ. Artois \u0026 CNRS).\nIt is made available under the terms of the GNU Lesser GPLv3 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrillab%2Fpblib-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrillab%2Fpblib-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrillab%2Fpblib-rs/lists"}