mios-1.4.0: A Minisat-based SAT solver in Haskell

Safe HaskellSafe
LanguageHaskell2010

SAT.Mios.Types

Contents

Description

Basic data types used throughout mios.

Synopsis

Documentation

Variable

type Var = Int Source #

represents Var.

bottomVar :: Var Source #

Special constant in Var (p.7)

int2var :: Int -> Int Source #

converts a usual Int as literal to an internal Var presentation.

>>> int2var 1
1  -- the first literal is the first variable
>>> int2var 2
2  -- literal @2@ is variable 2
>>> int2var (-2)
2 -- literal @-2@ is corresponding to variable 2

Internal encoded Literal

type Lit = Int Source #

The literal data has an index method which converts the literal to a "small" integer suitable for array indexing. The var method returns the underlying variable of the literal, and the sign method if the literal is signed (False for x and True for -x).

lit2int :: Lit -> Int Source #

converts Lit into Int as int2lit . lit2int == id.

>>> lit2int 2
1
>>> lit2int 3
-1
>>> lit2int 4
2
>>> lit2int 5
-2

int2lit :: Int -> Lit Source #

converts Int into Lit as lit2int . int2lit == id.

>>> int2lit 1
2
>>> int2lit (-1)
3
>>> int2lit 2
4
>>> int2lit (-2)
5

bottomLit :: Lit Source #

Special constant in Lit (p.7)

positiveLit :: Lit -> Bool Source #

returns True if the literal is positive

lit2var :: Lit -> Var Source #

converts Lit into Var.

>>> lit2var 2
1
>>> lit2var 3
1
>>> lit2var 4
2
>>> lit2var 5
2

var2lit :: Var -> Bool -> Lit Source #

converts a Var to the corresponing literal.

>>> var2lit 1 True
2
>>> var2lit 1 False
3
>>> var2lit 2 True
4
>>> var2lit 2 False
5

negateLit :: Lit -> Lit Source #

negates literal

>>> negateLit 2
3
>>> negateLit 3
2
>>> negateLit 4
5
>>> negateLit 5
4

Assignment on the lifted Bool domain

lFalse :: Int Source #

FALSE on the Lifted Bool domain

lTrue :: Int Source #

TRUE on the Lifted Bool domain

lBottom :: Int Source #

UNDEFINED on the Lifted Bool domain

class VarOrder o where Source #

Assisting ADT for the dynamic variable ordering of the solver. The constructor takes references to the assignment vector and the activity vector of the solver. The method select will return the unassigned variable with the highest activity.

Methods

update :: o -> Var -> IO () Source #

should be called when a variable has increased in activity.

undo :: o -> Var -> IO () Source #

should be called when a variable becomes unbound (may be selected again).

select :: o -> IO Var Source #

returns a new, unassigned var as the next decision.

Instances

VarOrder Solver Source #

Interfate to select a decision var based on variable activity.

Methods

update :: Solver -> Var -> IO () Source #

undo :: Solver -> Var -> IO () Source #

select :: Solver -> IO Var Source #

CNF

Solver Configuration

data MiosConfiguration Source #

Solver's parameters; random decision rate was dropped.

Constructors

MiosConfiguration 

Fields

  • variableDecayRate :: !Double

    decay rate for variable activity , clauseDecayRate :: !Double -- ^ decay rate for clause activity

defaultConfiguration :: MiosConfiguration Source #

dafault configuration

  • Minisat-1.14 uses (0.95, 0.999, 0.2 = 20 / 1000).
  • Minisat-2.20 uses (0.95, 0.999, 0).
  • Gulcose-4.0 uses (0.8 , 0.999, 0).
  • Mios-1.2 uses (0.95, 0.999, 0).