GithubHelp home page GithubHelp logo

power-law-random-sat-generator's Introduction

Power-Law Random SAT Generator

Preface

Generator for random SAT instances as proposed in the paper Towards industrial-like random SAT instances (IJCAI 2009) by Carlos Ansótegui, Maria Luisa Bonet, and Jordi Levy. This generator has been used for generating the experimental results in the papers Phase Transitions for Scale-Free SAT Formulas (AAAI 2017) by Tobias Friedrich, Anton Krohmer, Ralf Rothenberger, and Andrew M. Sutton and Bounds on the Satisfiability Threshold for Power Law Distributed Random SAT (ESA 2017) by Tobias Friedrich, Anton Krohmer, Ralf Rothenberger, Thomas Sauerwald, and Andrew M. Sutton.

Installation

Just call

> make

No configuration or specifics needed.

Usage

The generator can generate three kinds of instances.

  • Random k-SAT: The classical model, where each k-clause is drawn with uniform probability.
  • Power-Law k-SAT: One of the new models proposed by Ansótegui et al., where the variables for each k-clause are drawn according to a power-law probability distribution.
  • Double Power Law: Another new model proposed by Ansótegui et al., where clause lengths are drawn according to a power-law distribution. Then variables per clause are drawn according to a (possibly different) power-law probability distribution.

Example

> CreateSAT -g p -v 100 -c 426 -k 3 -p 2.5 -f test -u 1

Creates a random 3-CNF with 100 variables and 426 clauses. Variable frequencies are power-law distributed with power-law exponent 2.5 Variables are unique per clause. Formula is written in cnf format to test.cnf in the base directory.

Options

-g d|p|u
        choose between power-law distributed variables (p) or double power-law (d) or uniform (u)
-v <number of variables>
-c <number of clauses / scaling factor>
-k <clause length>
        for double power-law this is the average clause length
-p <power-law exponent of variables>
-b <power-law exponent of clauses>
        only for double power-law
-f <output file>
        in cnf-format, the ending will be added automatically
-u 0|1
        should variables be unique per clause(1) or not(0)
-q
        start quietly
-s
        seed value (int), system time is used if none is given

power-law-random-sat-generator's People

Contributors

abramconnelly avatar ralfrothenberger avatar

Stargazers

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

Watchers

 avatar

power-law-random-sat-generator's Issues

Minor bug - "-u 0" does not work

The code has:

	bool U=true;
	[...]
	if (helper::cmdOptionExists(argv, argv+argc,"-u")) {
		char* u=helper::getCmdOption(argv, argv+argc, "-u");
		if(strcmp(u,"1")==0) U=true;
	}

which of course means that U is always true, regardless of the options specified.

Compilation error

$ make
g++ -std=c++11 -o CreateSAT CreateSAT.cpp Formula.cpp
CreateSAT.cpp:1:29: fatal error: SatGeneration.hpp: No such file or directory
 #include "SatGeneration.hpp"
                             ^
compilation terminated.
makefile:2: recipe for target 'create' failed
make: *** [create] Error 1

Changing SatGeneration.hpp to SATGeneration.hpp solves the issue but exposes another:

$ make
g++ -std=c++11 -o CreateSAT CreateSAT.cpp Formula.cpp
In file included from CreateSAT.cpp:1:0:
SATGeneration.hpp:6:18: fatal error: Math.h: No such file or directory
 #include <Math.h>
                  ^
compilation terminated.
makefile:2: recipe for target 'create' failed
make: *** [create] Error 1

Changing Math.h to math.h allows for compilation.

Major bug? Integer division instead of floating point in weight calculation.

Your code computes VWeights[i]=pow((variables/(i+1)),betaNorm) using integer division. As a result, the weights do not match the intended weights in your paper. E.g. I generated 10000 instances using your generator with -g p -v 15 -c 65 -n 10000 -u 1 arguments, and here are the variable counts:

 321607 1
 228282 2
 194102 3
 149418 5
 149233 4
 121197 6
 120637 7
  83570 10
  83365 8
  83361 14
  83254 9
  83191 12
  83098 15
  82994 11
  82691 13

starting with i+1=8, variables/(i+1) is 1, which is why the counts are about the same for variables 8 though 15...

Unless I am missing something, I am guessing this potentially invalidates the experimental results from your papers using the code?

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.