{"id":18319890,"url":"https://github.com/bitwalker/picosat_elixir","last_synced_at":"2025-04-05T22:31:40.911Z","repository":{"id":36497664,"uuid":"227910148","full_name":"bitwalker/picosat_elixir","owner":"bitwalker","description":"Elixir + Erlang bindings for the PicoSAT solver","archived":false,"fork":false,"pushed_at":"2024-03-01T16:46:04.000Z","size":76,"stargazers_count":21,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-08T20:42:54.310Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitwalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-12-13T19:40:54.000Z","updated_at":"2024-03-14T15:36:16.000Z","dependencies_parsed_at":"2024-11-05T18:14:38.681Z","dependency_job_id":"b20da883-53a5-43f1-b98b-4dbfb2476e85","html_url":"https://github.com/bitwalker/picosat_elixir","commit_stats":{"total_commits":24,"total_committers":5,"mean_commits":4.8,"dds":"0.16666666666666663","last_synced_commit":"f0acfced2a58c00fb1dd4680ac86ed4ce841f655"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fpicosat_elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fpicosat_elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fpicosat_elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Fpicosat_elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitwalker","download_url":"https://codeload.github.com/bitwalker/picosat_elixir/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411237,"owners_count":20934650,"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-11-05T18:14:36.139Z","updated_at":"2025-04-05T22:31:40.550Z","avatar_url":"https://github.com/bitwalker.png","language":"C","readme":"# Picosat\n\nPicoSAT is a satisfiability (SAT) solver for boolean variables in boolean expressions. \n\nA SAT solver can determine if it is possible to find assignments to boolean variables that would \nmake a given set of expressions true. If it's satisfiable, it can also show a set of assignments \nthat make the expression true. Many problems can be broken down into a large SAT problem \n(perhaps with thousands of variables), so SAT solvers have a variety of uses.\n\nLike many SAT solvers, PicoSAT requires input in [CNF (conjunctive normal form)](https://en.wikipedia.org/wiki/Conjunctive_normal_form).\nCNF is built from these building blocks:\n\n  \n* _R term_: A term is either a boolean variable (in this library, expressed as an integer value), \ne.g, `4` or a negated boolean variable, e.g., `-4`. \n* _R clause_: A clause is a set of one or more terms, connected with OR (written here as |); boolean variables may not repeat inside a clause. \n* _R expression_: An expression is a set of one or more clauses, each connected by AND (written here as \u0026).\n\nAny boolean expression can be converted into CNF.\n\nThe output of the solver is in terms of satisfiability, either an expression is _satisfiable_, or _not satisfiable_;\nan expression which cannot be solved for is considered _unknown_.\n\nIf satisfiable, the value returned is a list of the variable settings that satisfy all formulas.\nFor example, the result `{:ok, [1, -2, -3, -4, 5]}` shows that there is a solution with variables\n`1` and `5` set to true, `2-4` set to false.\n\nAn example of an unsatisfiable formula is `[[-1], [1]]` which states that variable `1` must always be true,\nand always be false at the same time, which is obviously impossible.\n\nPicoSAT was written by Armin Biere, and this documentation is derived from the PicoSAT man page written\nby David A. Wheeler.\n\n## Example\n\nConsider a group of people (Bob, Alice, Paul, Jane) who want to eat dinner. They have three restaurants to choose\nfrom, and they will only be able to sate their hunger if they can all agree on at least one place to eat.\n\nWe define variables for each restaurant, `1` through `3`. A vote for the restaurant is a positive number, and\na vote against is negative.\n\nSo each person gives their votes to a neutral third party (the solver), and their votes are either for,\nor against, one or more restaurants. Given a vote of `[1, 2, -3]`, this is saying that the person is fine with\neither restaurant `1`, or `2`, but not `3`.\n\nLet's see what happens for the following votes:\n\n(x₁ ∨ x₂ ∨ ¬x₃) ∧ (x₂ ∨ x₃) ∧ (¬x₂) ∧ (¬x₁ ∨ x₃) \n\n```elixir\niex\u003e votes = [ [1, 2, -3], [2, 3], [-2], [-1, 3] ]\n...\u003e Picosat.solve(votes)\n{:ok, [1, -2, 3]}\n```\n\nNice! We have a solution, this tells us that visiting restaurant `1` and `3` but not `2` will satisfy everyone.\n\nHappy solving!\n\n## Installation\n\nPicoSAT can be installed by adding `picosat_elixir` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:picosat_elixir, \"~\u003e 0.2.0\"}\n  ]\nend\n```\n\n## Building on Windows\n\nBuilding on windows requires the Microsoft build tools (for C++/C) and `mix deps.compile` being run in a shell where the environment is set up correctly. This can be done by running the `vcvarsall.bat` script provided by the framework. The quickest way to get that is to paste this (replace the visual studio installation path accordingly) into the `run` dialog (\u003ckbd\u003eWin\u003c/kbd\u003e+\u003ckbd\u003eR\u003c/kbd\u003e).\n\n```bat\ncmd /K \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" amd64\n```\n\n## License\n\nApache 2.0, see `LICENSE.md`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Fpicosat_elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitwalker%2Fpicosat_elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Fpicosat_elixir/lists"}