GithubHelp home page GithubHelp logo

kastnerkyle / satnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from locuslab/satnet

0.0 1.0 0.0 289 KB

Bridging deep learning and logical reasoning using a differentiable satisfiability solver.

License: MIT License

Dockerfile 0.10% Shell 0.06% Python 3.68% Jupyter Notebook 92.99% C++ 1.72% C 0.05% Cuda 1.40%

satnet's Introduction

SATNet • PyPi colab License

Bridging deep learning and logical reasoning using a differentiable satisfiability solver.

This 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 by Po-Wei Wang, Priya L. Donti, Bryan Wilder, and J. Zico Kolter.

What is SATNet

SATNet 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.

How SATNet works

A 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).

Forward pass

Overview of experiments

We 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:

  • Learn the parity function using single-bit supervision (a traditionally hard task for deep networks)
  • Learn how to play 9×9 Sudoku (original and permuted) solely from examples.
  • Solve a "visual Sudoku" problem that maps images of Sudoku puzzles to their associated logical solutions. (A sample "visual Sudoku" input is shown below.)

Installation

Via pip

pip install satnet

From source

git clone https://github.com/locuslab/SATNet
cd SATNet && python setup.py install

Package Dependencies

conda install -c pytorch tqdm

Via Docker image

cd docker
sh ./build.sh
sh ./run.sh

Running experiments

Jupyter Notebook and Google Colab

Jupyter notebook and Google Colab

Run them manually

Getting the datasets

The Sudoku dataset and Parity dataset can be downloaded via

wget -cq powei.tw/sudoku.zip && unzip -qq sudoku.zip
wget -cq powei.tw/parity.zip && unzip -qq parity.zip

Sudoku experiments (original, permuted, and visual)

python exps/sudoku.py
python exps/sudoku.py --perm
python exps/sudoku.py --mnist --batchSz=50

Parity experiments

python exps/parity.py --seq=20
python exps/parity.py --seq=40

satnet's People

Contributors

xflash96 avatar priyald17 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.