m4lvin / mvl-solver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Finite Domain Satisfiablity Solver

Build Status Coverage Status

To learn what is a finite satisfiability problem, go to the wiki page. For a concise description of the progress of the project, have a look at this conference poster. If you want to try out the solver, download the current folder and follow the instructions below. Click here to see some problems you could solve.

This project supported by the Austrian Science Fund (FWF): I836-N23.

Table of contents:

Note: This solver corrects and builds upon the unsound solver created by Hemal A. Lal. See: http://www.d.umn.edu/~lalx0004/research/. Currently it implements non-chronological backtracking with resolution-based learning with the watched literals bookkeeping technique.

Roughly, more than third of the original code was changed. If you run dwdiff -s on the file containing the main functions, you get:

dwdiff -s /original_solver/Formula.cc /src/Formula.cc

old: 2848 words  1608 56% common  153 5% deleted  1087 38% changed
new: 12112 words  1608 13% common  6037 49% inserted  4467 36% changed

Building the Solver

You can easily create executable on Linux using g++ compiler in the following way:

cd ~/your-path-to/mvl-solver/

make

Alternatively download the executable Solver for Linux from the current folder. Below follows the description of the input the solver accepts as well as description of how to use the program to generate a benchmark problem, convert Boolean problem to Finite-domain problem or solve a finite-domain problem in DIMACS CNF format

Extended DIMACS format

The solver accepts the problems in extended DIMACS CNF format, which is an extension of the standard DIMACS CNF format commonly used for Boolean SAT problems. There are 4 possible lines in a DIMACS file:

  1. Comment line: This line contains comments and can be ignored.

    c This is a comment line

  2. Problem line: This line contains information about the problem. It begins with a p. There is exactly one such line for each problem and it should be the first non-comment line in the problem.

    p mvcnf <NumVar> <NumClause>

    where NumVar is the total number of variables in the problem, and NumClause is the number of clauses in the problem.

  3. Domain line: This line contains information about the domain size of a variable. It begins with a d and is followed by the variable and then by the domain size. The variables are represented by numbers from 1 to N where N is the total number of variables in the theory, and the domain by numbers from 0 to M, where M is the size of the domain minus one.

    d <VarName> <DomainSize>

where VarName is the variable name, and DomainSize is the size of the domain of the variable. There should be at most one domain line for each variable.

  1. Clause line: each literal is of the form <VarName>=<DomainValue> or <VarName>!=<DomainValue>. Each clause ends with a 0, which is used as an end-marker.

EXAMPLE

c This is a pigeonhole problem with 3 pigeons and 2 holes
p mvcnf 3 5
d 1 2
d 2 2
d 3 2
2!=0 1!=0 0
3!=0 1!=0 0
3!=0 2!=0 0
2!=1 1!=1 0
3!=1 1!=1 0
3!=1 2!=1 0

Finite Domain Solver with Non-Chronological Backtracking

Use the following format to run the program. The solver accepts problems in extended DIMACS format. Watched algorithm is a more efficient bookkeeping technique for backtracking, see here.

./mvl-solver -solvenc -verbose -restarts <int> -file <string> -time <int>

where :

  mvl-solver     : * name of executable
  -solvenc       : * option stating to solve the finite domain problem
  -file           : * name of the input file
  -verbose        : turns on the verbose mode
  -wl             : enable watched literals algorithm
  -restarts       : restarts threshold, default - no restatrs; incompatible with -wl
  -time           : amount of time allowed for solver to run (in seconds)
  -vsids          : vsids heuristics option

 * - required fields

Example: ./mvl-solver -solvenc -file "example_SAT"

Generating Benchmark Problem

If you want to generate a random benchmark problem, use the following format to run the program:

      -domain <int> -drand <1/0> -bool <1/0> -file <string> ```

where :

mvl-solver | * name of executable -genben | * option stating create benchmark problem -var | * number of variables in benchmark problem -clause | * number of clauses in benchmark problem -clausesize | number of atoms in each clause, [DEFAULT : 3] -sat | states whether this benchmark problem is satisfiable or not [possible value : 1/0] [default : 1/true] -domain | states the domain size of each variables, [DEFAULT : 10] -drand | states whether to assign domain size of each variable randomly [possible value : 1/0] [DEFAULT : 0/false] -bool | states whether the file is in boolean cnf (0) or modified cnf (1) -file | * name of the output file

    • required fields

Example: ``` ./mvl-solver -genben -var 4 -clause 18 -clausesize 2 -sat 1 -domain 2 -bool 1 -file "example_SAT" ```




### Convert Boolean to Finite Domain

Use the following format to run the program. The solver accepts problems in DIMACS format.

``` ./mvl-solver -b2f -file <string> -model <string> ```
where :

mvl-solver : * name of executable -b2f : * option stating to convert file -file : * name of the boolean file -model : * name of the finite file

    • required fields


### Convert Finite Domain to Boolean : Linear Encoding

Use the following format to run the program:

``` ./mvl-solver -linenc -file <string> -model <string> ```

where :

mvl-solver : * name of executable -linenc : * option stating to convert file -file : * name of the boolean file -model : * name of the finite file

    • required fields


### Convert Finite Domain to Boolean : Quadratic Encoding

Use the following format to run the program:

``` ./mvl-solver -quadenc -file <string> -model <string> ```

where :

mvl-solver : * name of executable -quadenc : * option stating to convert file -file : * name of the boolean file -model : * name of the finite file

    • required fields

About


Languages

Language:C++ 85.6%Language:C# 3.5%Language:Python 3.4%Language:C 3.2%Language:Java 2.5%Language:OCaml 1.6%Language:SMT 0.2%Language:Makefile 0.0%Language:Objective-C 0.0%Language:TeX 0.0%Language:Haskell 0.0%Language:Batchfile 0.0%Language:Shell 0.0%