{"id":15033132,"url":"https://github.com/tenderlove/ricosat","last_synced_at":"2025-08-28T05:20:28.875Z","repository":{"id":56892232,"uuid":"82493602","full_name":"tenderlove/ricosat","owner":"tenderlove","description":"A wrapper around PicoSAT for Ruby","archived":false,"fork":false,"pushed_at":"2017-02-25T21:07:15.000Z","size":91,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-09T21:22:51.244Z","etag":null,"topics":["ruby","sat"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tenderlove.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-19T22:18:31.000Z","updated_at":"2019-08-14T11:22:45.000Z","dependencies_parsed_at":"2022-08-20T16:01:01.392Z","dependency_job_id":null,"html_url":"https://github.com/tenderlove/ricosat","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenderlove%2Fricosat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenderlove%2Fricosat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenderlove%2Fricosat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tenderlove%2Fricosat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tenderlove","download_url":"https://codeload.github.com/tenderlove/ricosat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113113,"owners_count":21049785,"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":["ruby","sat"],"created_at":"2024-09-24T20:20:11.902Z","updated_at":"2025-04-09T21:23:24.779Z","avatar_url":"https://github.com/tenderlove.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ricosat\n\n* https://github.com/tenderlove/ricosat\n\n## DESCRIPTION:\n\nRicoSAT is a wrapper around [PicoSAT](http://fmv.jku.at/picosat/).  It lets\nyou use the PicoSAT solver from Ruby!\n\n## FEATURES/PROBLEMS:\n\n* It's a SAT solver!  Not SAT like the tests, but the [Boolean satisfiability problem](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem)\n\n## INSTALLATION:\n\nPicoSAT depends on [gmp](https://gmplib.org) and\n[gperftools](https://github.com/gperftools/gperftools). On a Mac, these can be\ninstalled in one shot with homebrew via `brew install gmp gperftools`.\n\nOnce you have those:\n\n``` ruby\n$ gem install ricosat\n```\n\n## SYNOPSIS:\n\nSolve the problem (A and NOT B):\n\n```ruby\nA = 1\nB = 2\n\nsat = RicoSAT.new\nsat.add(A); sat.add(0)  # Rules must always end with 0\nsat.add(-B); sat.add(0) # Negative means \"not\"\n\ncase sat.solve(-1)\nwhen RicoSAT::SATISFIABLE\n  sat.variables.times.each do |i|\n    p((i + 1) =\u003e sat.deref(i + 1))\n  end\nwhen RicoSAT::UNSATISFIABLE\n  raise \"idk\"\nelse\nend\n```\n\nA is true, and B is false.\n\nSolve the problem (A and NOT A):\n\n```ruby\nA = 1\n\nsat = RicoSAT.new\nsat.enable_trace_generation # Get access to SAT proofs\nsat.add(A); sat.add(0)  # Rules must always end with 0\nsat.add(-A); sat.add(0) # Negative means \"not\"\n\ncase sat.solve(-1)\nwhen RicoSAT::SATISFIABLE\n  raise \"should not work\"\nwhen RicoSAT::UNSATISFIABLE\n  sat.added_original_clauses.times do |i|\n    if sat.coreclause(i) == 1\n      p [:clause, i, sat.corelit(1)]\n    end\n  end\n  sat.write_extended_trace $stdout\nelse\nend\n```\n\nIt's not solvable!\n\n## INSTALL:\n\n* gem install ricosat\n\n## LICENSE:\n\n(The MIT License)\n\nCopyright (c) 2017 Aaron Patterson\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftenderlove%2Fricosat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftenderlove%2Fricosat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftenderlove%2Fricosat/lists"}