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

Safe HaskellSafe
LanguageHaskell2010

SAT.Mios.Solver

Contents

Description

This is a part of MIOS; main data

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 #

data VarHeap Source #

A heap tree built from two Vec. This implementation is identical wtih that in Minisat-1.14. Note: the zero-th element of heap is used for holding the number of elements. Note: VarHeap itself is not a VarOrder, because it requires a pointer to solver.

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

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

getModel :: Solver -> IO [Int] Source #

returns the model as a list of literal.

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

addClause :: Solver -> Stack -> IO Bool Source #

returns False if a conflict has occured. This function is called only before the solving phase to register the given clauses.

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).

Activities

claBumpActivity :: Solver -> Clause -> IO () Source #

Fig. 14 (p.19)

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

Fig. 14 (p.19) Bumping of clause activity

varDecayActivity :: Solver -> IO () Source #

Fig. 14 (p.19)

claActivityThreshold :: Double Source #

value for rescaling clause activity.

Stats

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.