{"id":19382837,"url":"https://github.com/locuslab/satnet","last_synced_at":"2025-04-04T20:15:12.288Z","repository":{"id":41844525,"uuid":"186476162","full_name":"locuslab/SATNet","owner":"locuslab","description":"Bridging deep learning and logical reasoning using a differentiable satisfiability solver.","archived":false,"fork":false,"pushed_at":"2022-11-22T09:22:51.000Z","size":495,"stargazers_count":410,"open_issues_count":6,"forks_count":52,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-03-28T19:06:38.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/locuslab.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}},"created_at":"2019-05-13T18:41:09.000Z","updated_at":"2025-02-25T14:35:08.000Z","dependencies_parsed_at":"2023-01-21T21:01:51.851Z","dependency_job_id":null,"html_url":"https://github.com/locuslab/SATNet","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/locuslab%2FSATNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2FSATNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2FSATNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locuslab%2FSATNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locuslab","download_url":"https://codeload.github.com/locuslab/SATNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242681,"owners_count":20907134,"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-10T09:23:29.476Z","updated_at":"2025-04-04T20:15:12.267Z","avatar_url":"https://github.com/locuslab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SATNet • [![PyPi][pypi-image]][pypi] [![colab][colab-image]][colab] [![License][license-image]][license] \n\n[license-image]: https://img.shields.io/badge/License-MIT-yellow.svg\n[license]: LICENSE\n\n[pypi-image]: https://img.shields.io/pypi/v/satnet.svg\n[pypi]: https://pypi.python.org/pypi/satnet\n\n[colab-image]: https://colab.research.google.com/assets/colab-badge.svg\n[colab]: https://colab.research.google.com/drive/1dRfepPLEE8N6BBZhXz8bbLDcPnRKaOcJ#forceEdit=true\u0026offline=true\u0026sandboxMode=true\n\n*Bridging deep learning and logical reasoning using a differentiable satisfiability solver.*\n\nThis repository contains the source code to reproduce the experiments in the ICML 2019 paper [SATNet: Bridging deep learning and logical reasoning using a differentiable satisfiability solver](https://arxiv.org/abs/1905.12149) by [Po-Wei Wang](https://powei.tw/), [Priya L. Donti](https://priyadonti.com/), [Bryan Wilder](http://teamcore.usc.edu/people/bryanwilder/default.htm), and [J. Zico Kolter](http://zicokolter.com/).\n\n\n## What is SATNet\n\nSATNet is a differentiable (smoothed) maximum satisfiability (MAXSAT) solver that can be integrated into the loop of larger deep learning systems. This (approximate) solver is based upon a fast coordinate descent approach to solving the semidefinite program (SDP) associated with the MAXSAT problem.\n\n#### How SATNet works\n\nA SATNet layer takes as input the discrete or probabilistic assignments of known MAXSAT variables, and outputs guesses for the assignments of unknown variables via a MAXSAT SDP relaxation with weights *S*. A schematic depicting the forward pass of this layer is shown below. To obtain the backward pass, we analytically differentiate through the SDP relaxation (see the paper for more details).\n\n![Forward pass](images/poster_forward.png)\n\n#### Overview of experiments\n\nWe show that by integrating SATNet into end-to-end learning systems, we can learn the logical structure of challenging problems in a minimally supervised fashion. In particular, we show that we can:\n* Learn the **parity function** using single-bit supervision (a traditionally hard task for deep networks) \n* Learn how to play **9×9 Sudoku (original and permuted)** solely from examples. \n* Solve a **\"visual Sudoku\"** problem that maps images of Sudoku puzzles to their associated logical solutions. (A sample \"visual Sudoku\" input is shown below.)\n\n\u003cdiv style=\"text-align:center\"\u003e\u003cimg src=\"images/mnist_sudoku.png\" /\u003e\u003c/div\u003e\n\u003c!-- ![MNIST Sudoku](images/mnist_sudoku.png) --\u003e\n\n\n## Installation\n\n### Via pip\n```bash\npip install satnet\n```\n\n\n### From source\n```bash\ngit clone https://github.com/locuslab/SATNet\ncd SATNet \u0026\u0026 python setup.py install\n```\n\n#### Package Dependencies\n```\nconda install -c pytorch tqdm\n```\nThe package also depends on the nvcc compiler. If it doesn't exist (try nvcc from commandline), you can install it via\n```\nconda install -c conda-forge cudatoolkit-dev\n```\n\n\n\n### Via Docker image\n```bash\ncd docker\nsh ./build.sh\nsh ./run.sh\n```\n\n## Running experiments\n### Jupyter Notebook and Google Colab\n[Jupyter notebook](https://github.com/locuslab/SATNet/blob/master/notebooks/Learning%20and%20Solving%20Sudoku%20via%20SATNet.ipynb)\nand [Google Colab](https://colab.research.google.com/drive/1dRfepPLEE8N6BBZhXz8bbLDcPnRKaOcJ#forceEdit=true\u0026offline=true\u0026sandboxMode=true)\n\n### Run them manually\n\n#### Getting the datasets\nThe [Sudoku dataset](https://powei.tw/sudoku.zip) and [Parity dataset](https://powei.tw/parity.zip) can be downloaded via\n\n```bash\nwget -cq powei.tw/sudoku.zip \u0026\u0026 unzip -qq sudoku.zip\nwget -cq powei.tw/parity.zip \u0026\u0026 unzip -qq parity.zip\n```\n#### Sudoku experiments (original, permuted, and visual)\n```bash\npython exps/sudoku.py\npython exps/sudoku.py --perm\npython exps/sudoku.py --mnist --batchSz=50\n```\n\n#### Parity experiments\n```bash\npython exps/parity.py --seq=20\npython exps/parity.py --seq=40\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Fsatnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocuslab%2Fsatnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocuslab%2Fsatnet/lists"}