GithubHelp home page GithubHelp logo

zaydh / spur Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 1.0 130 KB

SAT'18 Paper: SPUR - Satisfying Perfectly Uniform Random sampler (Winner Best Student Paper)

Home Page: http://sat2018.azurewebsites.net/

License: MIT License

CMake 0.52% Shell 0.24% C++ 99.24%
satisfiability sat reservoir-sampling gmp cnf

spur's Introduction

SPUR - Satisfying Perfectly Uniform Random Sampler

docs docs

SPUR - Published at the SAT 2018 Conference
Winner of Best Student Paper

Title: Fast Sampling of Perfectly Uniform Satisfying Assignments
Authors: Dimitris Achlioptas, Zayd Hammoudeh, and Panos Theodoropoulos

SPUR is a fast uniform SAT assignment sampler. It was presented at SAT-2018.

Building and Running the Binary

For user convenience, we have included in the root of this repository a build script, build.sh. Running this script will build SPUR from source.

After building the binary files, SPUR can be run by calling from the command line:

build\Release\spur -s <#Samples> -cnf <FormulaFile>

where <#Samples> is the number of samples to collect (>=1) and <FormulaFile> is a path to Boolean CNF formula in DIMACS file format.

The full set of command line options are:

  • -cnf [cnf_file] Path to the CNF file
  • -s [s] Number of models "s" to sample uniformly at random
  • -tp Forces two-pass sampling. (Only applicable when s=1)
  • -out [out_file] Path to write the specified samples
  • -no-sample-write Disable writing the final samples to a file.
  • -count-only Perform only model counting. Disable sampling.
  • -q Quiet mode
  • -v Verbose and trace mode
  • -d Debug mode
  • -t [s] Set time bound to s seconds
  • -cs [n] Set max cache size to n MB

Dependencies

  • Operating System: This software is only tested on Ubuntu Linux and Mac OS High Sierra. Additional operating systems, but functionality is not guaranteed nor implied.
  • C++ Version: C++11
  • Libraries:

Output Format

As explained in our paper, the generated witnesses are represented as tuples. The first item in the tuple is an integer between 1 and the number of samples (inclusive); this number represents the number of witnesses entailed by this tuple.

The second item in the tuple is a variable assignment. Variables are ordered from 1 to N, where N is the total number of variables. Each variable is assigned to either "0", "1", or "*". Observe that the "*" corresponds to an unconstrained variable that can be either "0" or "1".

Example: The tuple "3,10*0*" means that three witnesses are entailed by the assignment where variable one is 0b1, variables two and four are 0b0, while variables three and five can take either value.

Python Libraries Available

Python libraries for running the SPUR binary are available upon request. Email [email protected] to request access. Please include in the email request your name, email address, and institution.

Special Thanks

The SPUR sampler is built on top of sharpSAT, which was developed by Marc Thurley.

spur's People

Contributors

msoos avatar zaydh avatar zaydqualtrics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

meelgroup

spur's Issues

`-count-only` argument causes crash

Describe the bug
Invoking spur with the -count-only argument triggers a core dump.

To reproduce

  1. ./build/Release/spur -d -v -count-only -cnf stroop-2-constrained.cnf

DIMACS formula
stroop-2-constrained.cnf.zip

Expected behavior
I expected to get a solution count, rather than the program crashing.

Error message

➜  spur git:(master) ✗ ./build/Release/spur -d -v -count-only -cnf stroop-2-constrained.cnf 
WARNING: Debug mode has a fixed seed for the MPZ class.
WARNING: Debug mode uses a fixed random number seed.
terminate called after throwing an instance of 'std::length_error'
  what():  vector::reserve
[1]    10072 abort (core dumped)  ./build/Release/spur -d -v -count-only -cnf stroop-2-constrained.cnf

System information

➜  spur git:(master) ✗ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic
➜  spur git:(master) ✗ g++ --version
g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Built current master (2131dba)

A potential bug with CNF Examples while using SPUR

Hi!

Thanks for your excellent work in developing SPUR. However, I recently encountered two issues while utilizing SPUR for model counting. I set the timeout of running the model counter to 600 seconds.

For the first issue, I attempted to process two CNF files using SPUR. The origin.cnf file can be processed soon while the new.cnf file cannot stop withing 600 seconds. The new.cnf is generated by repeating a clause of origin.cnf, the repeated clasue is “-38 37 -80 -56 79 0”. The two files differ by only one clause and and produce completely opposite results. Repeating an existing clause in origin.cnf should not increase the complexity of the solution.

For the second issue, SPUR terminated abnormally while processing test.cnf and printed " bash: line 1: 627970 killed ./spur -cnf test.cnf -count-only ". The printed content indicates that SPUR exhausted the system memory when processing test.cnf and was killed by the system.

I think SPUR may have potential bugs, and I hope this information can assist you to address the potential bugs. These example files are attached here and I also provied three other pairs files of the first issue for your reference.

Looking forward to your response. If you need any additional information or test data, please feel free to let me know. Thank you for your time and effort.

Best regards,

Haiyan and Jifeng
CSTAR group

Timeout utility not working

Probably because sampler_stopwatch_.setTimeBound(config_.time_bound_seconds); is set before updating the config_.time_bound_seconds

Static Compilation setup and Seed Fixing

Hi Zayd:

I was wondering if you can setup the instructions for static compilation and @msoos added the option for a seed to spur for reproducibility (Here is the commit: meelgroup@1ebc536)

The pull request seemed messy, so perhaps its easy for you to just integrate the changes.

--
Kuldeep

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.