Git Product home page Git Product logo

barbarik's Introduction

License: MIT

Barbarik, a testing framework for samplers

'Barbarik' is a framework developed to test whether a sampler samples from a target distribution. To read more about Barbarik, have a look at our papers AAAI'19, NeurIPS'20, and NeurIPS'22.

Getting Started

To test QuickSampler:

git clone --depth 1 https://github.com/meelgroup/barbarik.git
cd barbarik
git submodule update --init --recursive
python3 barbarik.py --seed 1 --sampler 2 tests/uniform/blasted_case110.cnf

See python3 barbarik.py --help for the different samplers supported.

Samplers used

You can choose any of the samplers in the "samplers" directory, see --help:

  • UniGen2 - an almost-uniform sampler, version 2
  • ApproxMC3-with-sampling - an almost-uniform sampler (This is a beta version of UniGen3 -- which will be released soon. If you use ApproxMC3 binary, please cite UniGen paper to avoid any confusion.)
  • SPUR - Perfectly Uniform Satisfying Assignments
  • Quick Sampler
  • STS

Custom Samplers

To run a custom sampler, make appropriate changes to the code -- look for the following tag in barbarik.py file: # @CHANGE_HERE : please make changes in the below block of code

How to Cite

If you use Barbarik, please cite the following papers : AAAI'19, NeurIPS'20, and NeurIPS'22.

Contributors

  1. Kuldeep S. Meel
  2. Sourav Chakraborty
  3. Shayak Chakraborty
  4. Yash Pote
  5. Mate Soos
  6. Priyanka Golia

barbarik's People

Contributors

chakrabortyshayak avatar kuldeepmeel avatar msoos avatar priyanka-golia avatar yashpote avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

priyanka-golia

barbarik's Issues

Problems to run barbarik

Hi,

I've just downloaded barbarik. Following your instructions, I've tried to run it:

./barbarik.py --seed 1 --sampler SAMPLER_TYPE blasted_case110.cnf

Then, the following error message appeared:

Experiment: 0     of     1
constantFactor:38   boundFactor: 10.219408528680095   logBoundFactor: 3.3532397943494647  
tj: 1789   totalLoops: 2     beta: 0.8181818181818182 epsilon: 0.6 
numSolutions: 389   loThresh:56     hiThresh: 332
Traceback (most recent call last):
  File "./barbarik.py", line 734, in <module>
    barbarik()
  File "./barbarik.py", line 710, in barbarik
    ok, breakExperiment = exp.one_experiment(experiment, j, i, numExperiments, tj)
  File "./barbarik.py", line 606, in one_experiment
    **chainFormulaSetup = chainFormulaSetup(sampleSol, unifSol, self.numSolutions)**
**UnboundLocalError: local variable 'chainFormulaSetup' referenced before assignment**

The python version installed in my Ubuntu computer is 3.7.3

Thank you so much.

Best regards,
Ruben

Case for unique solution sampler

I have a question on the case of unique solution.
If a sampler only outputs unique solutions(which means one valid solution can only appears once in the output), whether barbarik works correctly? In other words, whether the output data of barbarik is meaningful?
Thanks : )

No module named WAPS

From your last commit you said you deleted the WAPS directory. When I try to run
python3 barbarik.py --seed 1 --sampler 2 tests/uniform/blasted_case110.cnf

it get the error:

python3 barbarik.py --seed 1 --sampler 2 tests/uniform/blasted_case110.cnf 
Traceback (most recent call last):
  File "/Users/victor.miller/Programming/Git/barbarik/barbarik.py", line 10, in <module>
    from interfaces.cnf import *
  File "/Users/victor.miller/Programming/Git/barbarik/interfaces/cnf.py", line 8, in <module>
    from WAPS.waps import sampler as samp
ModuleNotFoundError: No module named 'WAPS'

Combine with Barbarik2.

The Barbarik2 algorithm is designed to work on all weighted samplers and hence subsumes Barbarik. Thus we can replace the code of Barbarik with Barbarik2.

Code Issue

Those code seems to make the for loop end in the first loop each time. Is this a bug or not?

barbarik/Verifier.py

Lines 430 to 433 in f412674

if (solMap[key] >= loThresh and solMap[key] <= hiThresh):
return True
else:
return False

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.