{"id":42191199,"url":"https://github.com/royvanrijn/sattor","last_synced_at":"2026-01-26T23:00:59.618Z","repository":{"id":142773208,"uuid":"190044221","full_name":"royvanrijn/sattor","owner":"royvanrijn","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-18T17:08:41.000Z","size":11104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-18T18:17:47.357Z","etag":null,"topics":["sat","sat-encodings","sat-solver"],"latest_commit_sha":null,"homepage":"","language":"Java","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/royvanrijn.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,"zenodo":null}},"created_at":"2019-06-03T16:41:35.000Z","updated_at":"2025-07-18T17:08:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"b10563d4-b904-44cb-b2a4-2773bb856ee9","html_url":"https://github.com/royvanrijn/sattor","commit_stats":null,"previous_names":["royvanrijn/sattor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/royvanrijn/sattor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royvanrijn%2Fsattor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royvanrijn%2Fsattor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royvanrijn%2Fsattor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royvanrijn%2Fsattor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/royvanrijn","download_url":"https://codeload.github.com/royvanrijn/sattor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royvanrijn%2Fsattor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28791165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["sat","sat-encodings","sat-solver"],"created_at":"2026-01-26T23:00:58.444Z","updated_at":"2026-01-26T23:00:59.609Z","avatar_url":"https://github.com/royvanrijn.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SATTOR\n\nSATTOR is a Java library that helps you to encode problems into SAT encoding (DIMACS format).\n\nFor some reason I've found a lot of information about optimizing and writing actual SAT solvers, but there seems to be a gap in efficiently encoding a problem into SAT.\n\n## How to use\n\n```java\n// Create a formula:\nFormula formula = Formula.create();\n\nString b1 = \"10011\";\nString b2 = \"110110\";\n\n// Create a couple of variables (in a sequence) \nVariableSequence in1 = formula.newVariables(b1.length());\nVariableSequence in2 = formula.newVariables(b2.length());\n\n// Encode a binary adder (part of the library)\nVariableSequence sum = Arithmetic.add(formula, in1, in2);\n\n//Next constraint the input sequences (as two binary number)\nfor(int i = 0;i \u003c b1.length(); i++) {\n    formula.add((b1.charAt(i)=='0'?\"-\":\"\") + in1.get(i) + \" 0\");\n}\n\nfor(int i = 0;i \u003c b2.length(); i++) {\n    formula.add((b2.charAt(i)=='0'?\"-\":\"\") + in2.get(i) + \" 0\");\n}\n\n// And write the DIMACS file:\nformula.writeToFile(\"add_numbers.cnf\");\n```\n\nThis resulting file can be fed into any SAT solver (MiniSAT, Glucose, etc) to obtain a result.\n\n## WIP\n\nThis is just a hobby project, I'm learning more about SAT and it's encoding as I go along. The idea is to solve more (toy) problems and simultaneously expending the library of common tricks/algorithms used in encoding problem.\n\nI've written some blogposts (a while ago) on my website (https://royvanrijn.com) on how SAT solvers work, including how to encode problems.\n\n## Example 1: Peaceable queens\n\nOne of the problems I solved using my SAT encoder was \"Peaceable queens\": How many queens (black and white) can be on an NxN board without being able to see/attack the opponent.\n\nTo do this I needed to implement constraints like \"LTseq\" (counting sequence) from the paper `SAT Encodings of the At-Most-k Constraint`. I've created (fast) constraints like `atMostK`, `atLeastK`, `exactlyK`, etc.\n\nI've even added a `combinedK(seq1, seq2, k)` that counts up to `k` but breaks a symmetry such that there will always be more true variables in `seq1` over `seq2`\n\nThe code for generating the encoded DIMACS SAT input for peaceable queens can be found in `com.royvanrijn.examples`.\n\nMore information about the problem can be found here:\nhttps://royvanrijn.com/blog/2019/05/sat-solving-part-one/\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyvanrijn%2Fsattor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froyvanrijn%2Fsattor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyvanrijn%2Fsattor/lists"}