Safe Haskell | None |
---|---|
Language | Haskell2010 |
Bucket algorithms for variable elimination with enough flexibility to also work with influence diagrams.
- data Buckets f = Buckets !(EliminationOrder DV) !(Map DV [f])
- type EliminationOrder dv = [dv]
- class IsBucketItem f where
- scalarItem :: f -> Bool
- itemProduct :: [f] -> f
- itemProjectOut :: DV -> f -> f
- itemContainsVariable :: f -> DV -> Bool
- createBuckets :: IsBucketItem f => [f] -> EliminationOrder DV -> EliminationOrder DV -> Buckets f
- getBucket :: DV -> Buckets f -> [f]
- updateBucket :: IsBucketItem f => DV -> f -> Buckets f -> Buckets f
- addBucket :: IsBucketItem f => Buckets f -> f -> Buckets f
- removeFromBucket :: DV -> Buckets f -> Buckets f
- marginalizeOneVariable :: IsBucketItem f => Buckets f -> DV -> Buckets f
Types
Used for bucket elimination. Factor are organized by their first DV
Buckets !(EliminationOrder DV) !(Map DV [f]) |
type EliminationOrder dv = [dv] Source
Elimination order
class IsBucketItem f where Source
Operations needed to process a bucket items
scalarItem :: f -> Bool Source
itemProduct :: [f] -> f Source
itemProjectOut :: DV -> f -> f Source
itemContainsVariable :: f -> DV -> Bool Source
Functions
:: IsBucketItem f | |
=> [f] | Factor to use for computing the marginal one |
-> EliminationOrder DV | Variables to eliminate |
-> EliminationOrder DV | Remaining variables |
-> Buckets f |
:: IsBucketItem f | |
=> DV | Variable that was eliminated |
-> f | New factor resulting from this elimination |
-> Buckets f | |
-> Buckets f |
Update bucket
addBucket :: IsBucketItem f => Buckets f -> f -> Buckets f Source
Add a factor to the right bucket
removeFromBucket :: DV -> Buckets f -> Buckets f Source
Remove a variable from the bucket
marginalizeOneVariable :: IsBucketItem f => Buckets f -> DV -> Buckets f Source