Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- type Var = Int
- type VarSet = IntSet
- type VarMap = IntMap
- validVar :: Var -> Bool
- class IModel a where
- type Model = UArray Var Bool
- type Lit = Int
- type LitSet = IntSet
- type LitMap = IntMap
- litUndef :: Lit
- validLit :: Lit -> Bool
- literal :: Var -> Bool -> Lit
- litNot :: Lit -> Lit
- litVar :: Lit -> Var
- litPolarity :: Lit -> Bool
- evalLit :: IModel m => m -> Lit -> Bool
- type Clause = [Lit]
- normalizeClause :: Clause -> Maybe Clause
- clauseSubsume :: Clause -> Clause -> Bool
- evalClause :: IModel m => m -> Clause -> Bool
- clauseToPBLinAtLeast :: Clause -> PBLinAtLeast
- type AtLeast = ([Lit], Int)
- normalizeAtLeast :: AtLeast -> AtLeast
- evalAtLeast :: IModel m => m -> AtLeast -> Bool
- type PBLinTerm = (Integer, Lit)
- type PBLinSum = [PBLinTerm]
- type PBLinAtLeast = (PBLinSum, Integer)
- type PBLinExactly = (PBLinSum, Integer)
- normalizePBLinSum :: (PBLinSum, Integer) -> (PBLinSum, Integer)
- normalizePBLinAtLeast :: PBLinAtLeast -> PBLinAtLeast
- normalizePBLinExactly :: PBLinExactly -> PBLinExactly
- cutResolve :: PBLinAtLeast -> PBLinAtLeast -> Var -> PBLinAtLeast
- cardinalityReduction :: PBLinAtLeast -> AtLeast
- negatePBLinAtLeast :: PBLinAtLeast -> PBLinAtLeast
- evalPBLinSum :: IModel m => m -> PBLinSum -> Integer
- evalPBLinAtLeast :: IModel m => m -> PBLinAtLeast -> Bool
- evalPBLinExactly :: IModel m => m -> PBLinAtLeast -> Bool
- pbLowerBound :: PBLinSum -> Integer
- pbUpperBound :: PBLinSum -> Integer
- pbSubsume :: PBLinAtLeast -> PBLinAtLeast -> Bool
- type XORClause = ([Lit], Bool)
- normalizeXORClause :: XORClause -> XORClause
- evalXORClause :: IModel m => m -> XORClause -> Bool
Variable
Model
type Model = UArray Var Bool Source
A model is represented as a mapping from variables to its values.
Literal
Positive (resp. negative) literals are represented as positive (resp. negative) integers. (DIMACS format).
litPolarity :: Lit -> Bool Source
Clause
normalizeClause :: Clause -> Maybe Clause Source
Normalizing clause
Nothing
if the clause is trivially true.
clauseSubsume :: Clause -> Clause -> Bool Source
evalClause :: IModel m => m -> Clause -> Bool Source
Cardinality Constraint
normalizeAtLeast :: AtLeast -> AtLeast Source
evalAtLeast :: IModel m => m -> AtLeast -> Bool Source
Pseudo Boolean Constraint
type PBLinAtLeast = (PBLinSum, Integer) Source
type PBLinExactly = (PBLinSum, Integer) Source
normalizePBLinSum :: (PBLinSum, Integer) -> (PBLinSum, Integer) Source
normalizing PB term of the form c1 x1 + c2 x2 ... cn xn + c into d1 x1 + d2 x2 ... dm xm + d where d1,...,dm ≥ 1.
normalizePBLinAtLeast :: PBLinAtLeast -> PBLinAtLeast Source
normalizing PB constraint of the form c1 x1 + c2 cn ... cn xn >= b.
normalizePBLinExactly :: PBLinExactly -> PBLinExactly Source
normalizing PB constraint of the form c1 x1 + c2 cn ... cn xn = b.
cutResolve :: PBLinAtLeast -> PBLinAtLeast -> Var -> PBLinAtLeast Source
evalPBLinSum :: IModel m => m -> PBLinSum -> Integer Source
evalPBLinAtLeast :: IModel m => m -> PBLinAtLeast -> Bool Source
evalPBLinExactly :: IModel m => m -> PBLinAtLeast -> Bool Source
pbLowerBound :: PBLinSum -> Integer Source
pbUpperBound :: PBLinSum -> Integer Source
pbSubsume :: PBLinAtLeast -> PBLinAtLeast -> Bool Source
XOR Clause
type XORClause = ([Lit], Bool) Source
XOR clause
'([l1,l2..ln], b)' means l1 ⊕ l2 ⊕ ⋯ ⊕ ln = b.
Note that:
- True can be represented as ([], False)
- False can be represented as ([], True)
normalizeXORClause :: XORClause -> XORClause Source
Normalize XOR clause
evalXORClause :: IModel m => m -> XORClause -> Bool Source