Git Product home page Git Product logo

kcbox's Introduction

KCBox

KCBox is a long-term project that aims at developping an open-source toolbox for knowledge compilation (KC) and KC-related reasoning tasks. So far, we have released five tools: PreLite, Panini, ExactMC, FastUS, and PartialKC.

PreLite Description

PreLite is a light version of preprocessor that can simplify a CNF formula in DIMACS format as an equivalent one, and therefore can work with knowledge compilers, such as c2d and D4. For example, (x1 or x2) and (not x1 or not x2 or not x3) can be expressed in DIMACS format as follows:

p cnf 3 2
1 2 0
-1 -2 -3 0

Since PreLite was designed for the first kernelization in ExactMC, if you use this tool, please cite our paper The power of Literal Equivalence in Model Counting

Panini Description

Panini is an efficient compiler. So far, it suppots the compilation from CNF formula in DIMACS format to OBDD, OBDD[AND] (OBDD with conjunctive decomposition), Decision-DNNF, or CCDD (constrained conjunction & decision diagrams ) which are the format of tractable circuits. Panini also implements a family of queries (please refer to A knowledge compilation map for their definitions). If you use this tool to compile formula into OBDD or OBDD[AND] , please cite our paper New Canonical Representations by Augmenting OBDDs with Conjunctive Decomposition. If you use this tool to compile formula into Decision-DNNF or CCDD, please cite our paper CCDD: A Tractable Representation for Model Counting and Uniform Sampling.

ExactMC Description

ExactMC is a scalable exact model counter. It performs counting wrt CCDD that supports linear model counting. This tool also takes in a CNF formula in DIMACS format, and outputs the number of satisfying assignments. ExactMC also supports weighted model counting by searching wrt Decision-DNNF under the format of MC competition. If you use this tool, please cite our paper The power of Literal Equivalence in Model Counting

FastUS Description

FastUS is currently an exactly uniform sampler, and in future we will add the function of non-uniform sampling. The main idea is to first compile the formula into CCDD and then sample wrt the compilation. This tool also takes in a CNF formula in DIMACS format, and outputs a given number of random solutions. If you use this tool, please cite our paper CCDD: A Tractable Representation for Model Counting and Uniform Sampling

PartialKC Description

PartialKC is an anytime model counter with fast convergence performance. The main idea is to perform partial knowledge compilation wrt a KC language called partial constrained conjunction & decision diagrams. This tool also takes in a CNF formula in DIMACS format, and outputs an estimate of its true model count. If you use this tool, please cite our paper Fast Converging Anytime Model Counting

Installation

Prerequisites

sudo apt-get install build-essential cmake
sudo apt-get install zlib1g.dev
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev

Commands

git submodule init && git submodule update
cd cadical && ./configure && make && cd ..
mkdir build && cd build
cp ../scripts/build.sh .
chmod u+x build.sh
./build.sh  ## if you want to build a single tool, please use "./build.sh toolname" instead

Note that please check the file cadical/BUILD.md in case the authors change the way of installing CaDiCaL

Usage

Using Binary

Use KCBox --help to see the usage of the toolkit, and KCBox toolname --help to see the options of a single tool.

Precautions for Source Code

  • Directory solvers contains some other tools that are used for debugging. If they do not work on your computer, please build them yourself.

Contributors

The following researchers have contributed to this project (sorted alphabetically by last name; see history.txt for a rough description of contributions):

Acknowledgment

  • Daniil Chivilikhin
  • Arijit Shaw
  • Zhenghang Xu
  • Suwei Yang
  • github users: schmidcl

kcbox's People

Contributors

kuldeepmeel avatar msoos avatar schmidcl avatar ydotlai avatar

Stargazers

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

Watchers

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

kcbox's Issues

ExactMC/PartialKC fail on an example CNF file with "Assertion `new_max_var < _max_var'"

On the attached example ExactMC and PartialKC (commit 5ee00f6) fail with the following assertion:

Instance name: error.cnf
Thu 23 Mar 2023 01:14:44 PM UTC
Counting models...
Begin preprocess...
Number of original variables: 113
Number of original clauses: 113
s SATISFIABLE
Number of unsimplifiable variables: 4294967183 (113 unit, 0 equ, 113 omit)
Number of unsimplifiable non-unary clauses: 0
Preprocessing Time: 0.000446
Time of SAT: 0.000423
Time of blocking clauses: 1e-06
Time of blocking literals: 1e-06
Time of replacing literal equivalency: 6e-06
KCBox: /home/simcenter/misc/KCBox/src/Primitive_Types/Assignment.h:380: void KCBox::Model_Pool::Shrink_Max_Var(KCBox::Variable, KCBox::Variable*): Assertion `new_max_var < _max_var' failed.
Aborted

Run as follows: KCBox ExactMC error.cnf
The highlighted "Number of unsimplifiable variables" values also seems a bit strange to me, given that the CNF file only has 113 variables.

I'd be glad to help fix the issue and send a pull request, if one of the developers has an idea where to look.

error.tar.gz

Is Preprocessor.cpp a reimplementation of B+E or what extra elements does it have?

Hi,

I have to admit, https://github.com/meelgroup/KCBox/blob/main/src/Preprocessor.cpp is super impressive. I'd like to know if it has elements that are not present in B+E related to equivalent literal replacement? It seems to have a similar set of techniques as B+E: gate-based variable removal, backbone computation, toplevel equivalent literal replacement etc. However, you mention about special (perhaps non-toplevel) equivalent literal replacement in particular in the README, so I'm curious. I thought the non-toplevel eqLit replacement is only done during the knowledge compilation phase?

Thanks,

Mate

Compilers/DNNF_Compiler.h missing

Hi,
I cannot build KCBox because DNNF_Compiler is missing from src/Compilers.

/KCBox/src/Main.cpp:6:10: fatal error: Compilers/DNNF_Compiler.h: No such file or directory
 #include "Compilers/DNNF_Compiler.h"

Also, "src/KC_Languages/DecDNNF.cpp" is missing, which is required by CMakeLists.txt.

Thanks.

-Mahi

The usage of ExactMC

Both the kdepth and the format parameters are IntOption type.
Options

When I execute commands like this "./ExactMC --kdepth 64 ./simple_v3_c2.cnf", I can succeed.
But executing this command "./ExactMC --format 1 ./simple_v3_c2.cnf" is not possible!
format

Could you tell me why?

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.