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

Safe HaskellTrustworthy
LanguageHaskell2010

SAT.Mios.Vec

Contents

Description

(This is a part of MIOS.) Abstraction Layer for Mutable Vectors

Synopsis

Vector class and type

class VecFamily v a | v -> a where Source #

The interface on vectors.

Minimal complete definition

getNth, setNth

Methods

getNth :: v -> Int -> IO a Source #

returns the n-th value.

setNth :: v -> Int -> a -> IO () Source #

sets the n-th value.

reset :: v -> IO () Source #

erases all elements in it.

swapBetween :: v -> Int -> Int -> IO () Source #

returns the n-th value (index starts from zero in any case). | swaps two elements.

modifyNth :: v -> (a -> a) -> Int -> IO () Source #

calls the update function.

newVec :: Int -> a -> IO v Source #

returns a new vector.

setAll :: v -> a -> IO () Source #

sets all elements.

growBy :: v -> Int -> IO v Source #

extends the size of stack by n; note: values in new elements aren't initialized maybe.

asList :: v -> IO [a] Source #

converts to a list.

Instances
VecFamily ClauseVector Clause Source #

ClauseVector is a vector of Clause.

Instance details

Defined in SAT.Mios.Clause

VecFamily Clause Lit Source #

Clause is a VecFamily of Lit.

Instance details

Defined in SAT.Mios.Clause

Methods

getNth :: Clause -> Int -> IO Lit Source #

setNth :: Clause -> Int -> Lit -> IO () Source #

reset :: Clause -> IO () Source #

swapBetween :: Clause -> Int -> Int -> IO () Source #

modifyNth :: Clause -> (Lit -> Lit) -> Int -> IO () Source #

newVec :: Int -> Lit -> IO Clause Source #

setAll :: Clause -> Lit -> IO () Source #

growBy :: Clause -> Int -> IO Clause Source #

asList :: Clause -> IO [Lit] Source #

VecFamily WatcherList Clause Source #

WatcherList is an Lit-indexed collection of Clause.

Instance details

Defined in SAT.Mios.ClauseManager

VecFamily ClauseExtManager Clause Source #

ClauseExtManager is a collection of Clause

Instance details

Defined in SAT.Mios.ClauseManager

data family Vec a Source #

Another abstraction layer on Vector which reserves zero element for internal use. Note: If you want to use the 0-th element, use UVector Int.

Instances
data Vec Double Source # 
Instance details

Defined in SAT.Mios.Vec

data Vec Int Source # 
Instance details

Defined in SAT.Mios.Vec

SingleStorage

class SingleStorage s t | s -> t where Source #

Interface for single (one-length vector) mutable data

Minimal complete definition

get', set'

Methods

new' :: t -> IO s Source #

allocates and returns an new data.

get' :: s -> IO t Source #

gets the value.

set' :: s -> t -> IO () Source #

sets the value.

modify' :: s -> (t -> t) -> IO () Source #

calls an update function on it.

Instances
SingleStorage Bool' Bool Source # 
Instance details

Defined in SAT.Mios.Vec

Methods

new' :: Bool -> IO Bool' Source #

get' :: Bool' -> IO Bool Source #

set' :: Bool' -> Bool -> IO () Source #

modify' :: Bool' -> (Bool -> Bool) -> IO () Source #

SingleStorage Clause Int Source #

Clause is a SingleStorage on the number of literals in it.

Instance details

Defined in SAT.Mios.Clause

Methods

new' :: Int -> IO Clause Source #

get' :: Clause -> IO Int Source #

set' :: Clause -> Int -> IO () Source #

modify' :: Clause -> (Int -> Int) -> IO () Source #

SingleStorage ClauseExtManager Int Source #

ClauseExtManager is a SingleStorage on the number of clauses in it.

Instance details

Defined in SAT.Mios.ClauseManager

SingleStorage ClauseSimpleManager Int Source #

ClauseSimpleManager is a SingleStorage on the number of clauses in it.

Instance details

Defined in SAT.Mios.ClauseManager

type Bool' = IOVector Bool Source #

Mutable Bool

type Double' = ByteArrayDouble Source #

Mutable Double

type Int' = ByteArrayInt Source #

Mutable Int Note: Int' is identical to Stack

Stack

class SingleStorage s Int => StackFamily s t | s -> t where Source #

Interface on stacks

Methods

newStack :: Int -> IO s Source #

returns a new stack.

pushTo :: s -> t -> IO () Source #

pushs an value to the tail of the stack.

popFrom :: s -> IO () Source #

pops the last element.

lastOf :: s -> IO t Source #

peeks the last element.

shrinkBy :: s -> Int -> IO () Source #

shrinks the stack.

type Stack = Vec Int Source #

Stack of Int, an alias of Vec Int

newStackFromList :: [Int] -> IO Stack Source #

returns a new Stack from [Int].

realLength :: Vec Int -> Int Source #

returns the number of allocated slots

sortStack :: Stack -> IO () Source #

sort the content of a stack, in small-to-large order.