Giter Club home page Giter Club logo

communityattachment's Introduction

Random generators of SAT instances:
- Classical Random k-CNF
- Community Attachment (formulas with modularity)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1. Compile:
$ make

2. Usage:
$ ./random -n <variables> -m <clauses> -k <clauseLength> -s <seed>
$ ./commAttach -n <variables> -m <clauses> -k <clauseLength> -c <communities> -Q <modularity> -s <seed>




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

A small script for computing the number of satisfiable/unsatisfiable instances
across a range of clause/variable ratios (for a fixed number of variables):

# Fix the number of variables:
n=100;
k=3;
for ratio in `seq 3.5 0.1 4.5`;do 
	m=$(echo "scale=0; $n*$ratio/1.0"|bc);
	# Counters SAT and UNSAT:
	let sat=0;
	let unsat=0;
	
	# For every value, generate 20 random formulas with distinct seeds
	for seed in {1..20};do 
	
		# "glucose" is a path to a SAT solver:
		# for instance: https://www.labri.fr/perso/lsimon/downloads/softwares/glucose-syrup-4.1.tgz
		isunsat=$(./random -k $k -n $n -m $m -s $seed | glucose | grep "^s UNSAT" | wc -l | awk '{print($1)}');
		
		# The previous step explicitely:
		# CNF=random_${k}_${n}_${m}_${s}.cnf
		# ./random -n $n -m $m -s $seed > $CNF
		# glucose $CNF > $CNF.glucose.out
		# isunsat=$(grep "^s UNSAT" $CNF.glucose.out | wc -l | awk '{print($1)}')
		
		# Count
		if [ $isunsat == 1 ];then 
			let unsat=$unsat+1; 
		else 
			let sat=$sat+1; 
		fi; 
	done; 
	echo $n $m $sat $unsat; 
done

communityattachment's People

Contributors

jgirald avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

antoniomanuelfr

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.