{"id":20483332,"url":"https://github.com/styczynski/go-sat-solver","last_synced_at":"2025-03-05T16:16:03.016Z","repository":{"id":57637316,"uuid":"267804055","full_name":"styczynski/go-sat-solver","owner":"styczynski","description":"SAT solver written in Go (based on Minisat)","archived":false,"fork":false,"pushed_at":"2021-11-17T21:35:42.000Z","size":4755,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T04:22:23.944Z","etag":null,"topics":["go","online-sat","sat","sat-solver"],"latest_commit_sha":null,"homepage":"http://styczynski.in/go-sat-solver/","language":"Go","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/styczynski.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-05-29T08:17:17.000Z","updated_at":"2025-01-01T12:57:30.000Z","dependencies_parsed_at":"2022-08-30T09:41:20.223Z","dependency_job_id":null,"html_url":"https://github.com/styczynski/go-sat-solver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fgo-sat-solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fgo-sat-solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fgo-sat-solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fgo-sat-solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styczynski","download_url":"https://codeload.github.com/styczynski/go-sat-solver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242058198,"owners_count":20065066,"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":["go","online-sat","sat","sat-solver"],"created_at":"2024-11-15T16:17:03.188Z","updated_at":"2025-03-05T16:16:02.982Z","avatar_url":"https://github.com/styczynski.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Go SAT solver](http://styczynski.in/go-sat-solver/) [![Build Status](https://travis-ci.com/styczynski/go-sat-solver.svg?branch=master)](https://travis-ci.com/styczynski/go-sat-solver) ![Go](https://github.com/styczynski/go-sat-solver/workflows/Go/badge.svg) ![Docker Image Version (latest semver)](https://img.shields.io/docker/v/styczynski/go-sat-solver?label=docker%20version)\n\nThis isn't the most effective implementation. This code was written as an assignment for a Logic Course at MIM UW (2020).\nThe implementation should be fairly bug-less.\n\n[See online (WASM) version](http://styczynski.in/go-sat-solver/)\n\n## Run using Docker\n\nIf you have [Docker](https://docs.docker.com/get-docker/) installed you can [run the solver](https://hub.docker.com/r/styczynski/go-sat-solver) simply using:\n```bash\n    $ docker run -i styczynski/go-sat-solver:1.0.0 \u003c input_formula.txt\n```\n\nPlease read the rest of the README to learn how to work with input formats.\n\n## Quickstart\n\nYou have to [install go](https://golang.org/doc/install) on your machine \n\n```\n   $ GO111MODULE=on go get -u github.com/styczynski/go-sat-solver\n   $ go-sat-solver input.txt # Run the executable\n```\n\nIf the shell cannot find the executable you may want to do `export PATH=$PATH:/usr/local/go/bin`.\n\n## Build or Install using make\n\n* `make install` - adds the binary to `$GOPATH/bin`\n* `make build` - builds the binary\n\nThe `Makefile` builds the binary and adds the short git commit id and the version to the final build.\n\n## Usage\n\nThe solver can the executed using `go-sat-solver [input files]` command.\nThe default input format is `haskell`-like ADT syntax:\n```\n    X := And (X) (X) | Or (X) (X) | Iff (X) (X) | Implies (X) (X) | Not (X) | Var \"string\" | T | F\n```\n\nUse no parameters or `\"-\"` to load from standard input:\n```bash\n    $ go-sat-solver \u003c file.in\n    $ cat file.in | go-sat-solver -\n    $ go-sat-solver file.in\n```\nThe presented commands are equivalent.\n\nYou may want to load other types of files for example DIMACS CNF:\n```bash\n    $ go-sat-solver -f cnf input.cnf\n```\n\nOr use other solver than the default one (currently `cnf` and `naive` options are supported):\n```bash\n    $ go-sat-solver -s naive input.txt\n```\n\n## About the solver itself\n\nThe solver was firstly a DPLL-style solver but further improvements led to CDCL-like solver. \nI was using Minisat source code as a reference.\nThe solver supports the following features:\n* [Unit propagation](https://en.wikipedia.org/wiki/Unit_propagation)\n* [Adaptive VSIDS](https://arxiv.org/pdf/1506.08905.pdf)\n* [TWL](http://people.mpi-inf.mpg.de/~mfleury/sat_twl.pdf)\n* [Clause learning](https://www.cs.princeton.edu/courses/archive/fall13/cos402/readings/SAT_learning_clauses.pdf)\n* [Variable elimination techniques](http://fmv.jku.at/papers/EenBiere-SAT05.pdf)\n\nThe learned clauses are not optimized based on adaptive VSIDS, but this feature is planned in the future.\n\nThis solver is suitable for any serious application, but you shall consider using other Go solvers, or native C/C++ solvers for a better performance.\n\n## Web interface\n\nSolver has its web [interface available](http://styczynski.in/go-sat-solver/) (this was done using compilation of Go to WASM).\n\nYou can compile the frontend in a following way:\n```bash\n    $ make wasm\n    $ make build-web\n```\n\n## Running tests\n\nYou can run testing scripts that examines the solver on inputs from `/tests/` directory using the following command:\n```bash\n    $ go run ./cmd/tester/tester.go ./tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fgo-sat-solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyczynski%2Fgo-sat-solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fgo-sat-solver/lists"}