mios-1.5.4: A Minisat-based CDCL SAT solver in Haskell

Safe HaskellSafe
LanguageHaskell2010

SAT.Mios.Solver

Contents

Description

(This is a part of MIOS.) Solver, the main data structure

Synopsis

Solver

data Solver Source #

Fig. 2.(p.9) Internal State of the solver

Constructors

Solver 

Fields

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 #

newSolver :: MiosConfiguration -> CNFDescription -> IO Solver Source #

returns an everything-is-initialized solver from the arguments.

Misc Accessors

nAssigns :: Solver -> IO Int Source #

returns the number of current assigments.

nClauses :: Solver -> IO Int Source #

returns the number of constraints (clauses).

nLearnts :: Solver -> IO Int Source #

returns the number of learnt clauses.

decisionLevel :: Solver -> IO Int Source #

returns the current decision level.

valueVar :: Solver -> Var -> IO Int Source #

returns the assignment (:: LiftedBool = [-1, 0, -1]) from Var.

valueLit :: Solver -> Lit -> IO Int Source #

returns the assignment (:: LiftedBool = [-1, 0, -1]) from Lit.

locked :: Solver -> Clause -> IO Bool Source #

Fig. 7. (p.11) returns True if the clause is locked (used as a reason). Learnt clauses only

State Modifiers

setAssign :: Solver -> Int -> LiftedBool -> IO () Source #

assigns a value to the n-th variable

enqueue :: Solver -> Lit -> Clause -> IO Bool Source #

Fig. 9 (p.14) Puts a new fact on the propagation queue, as well as immediately updating the variable's value in the assignment vector. If a conflict arises, False is returned and the propagation queue is cleared. The parameter from contains a reference to the constraint from which p was propagated (defaults to Nothing if omitted).

assume :: Solver -> Lit -> IO Bool Source #

Fig. 12 (p.17) returns False if immediate conflict.

Pre-condition: propagation queue is empty

cancelUntil :: Solver -> Int -> IO () Source #

#M22: Revert to the states at given level (keeping all assignment at level but not beyond).

Stats

data StatIndex Source #

stat index

Constructors

NumOfBackjump

the number of backjump

NumOfRestart

the number of restart

NumOfBlockRestart

the number of blacking start

NumOfGeometricRestart

the number of classic restart

NumOfPropagation

the number of propagation

NumOfReduction

the number of reduction

NumOfClause

the number of alive given clauses

NumOfLearnt

the number of alive learnt clauses

NumOfVariable

the number of alive variables

NumOfAssigned

the number of assigned variables

EndOfStatIndex

Don't use this dummy.

getStat :: Solver -> StatIndex -> IO Int Source #

returns the value of StatIndex.

setStat :: Solver -> StatIndex -> Int -> IO () Source #

sets to StatIndex.

incrementStat :: Solver -> StatIndex -> Int -> IO () Source #

increments a stat data corresponding to StatIndex.

getStats :: Solver -> IO [(StatIndex, Int)] Source #

returns the statistics as a list.

dumpSolver :: DumpMode -> Solver -> IO () Source #

print statatistic data to stdio. This should be called after each restart.