| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Modelling.PetriNet.Reach.Filter
Description
Module for filtering sequences in Petri net reach/deadlock tasks.
This module provides functions to filter out sequences and solution sets based on various criteria that make instances too simple or too complicated:
- Cyclic patterns: [t3, t2, t1, t4, t3, t2, t1, t4]
- Repetitive subsequences: [t4, t4, t4, t4] as prefix/suffix
- Grouped repeats: [t3, t3, t2, t2, t1, t1, t4, t4]
- Too many shortest solutions
- Insufficient transition coverage in solutions
- Insufficient number of transitions absent from all solutions
- Solutions are (not) all permutations of each other
The filtering only happens on/with minimal solution sequences for a task.
Synopsis
- isCyclicPatternWithAnyOf :: Eq a => [Int] -> [a] -> Bool
- hasRepetitiveSubsequence :: Eq a => Int -> [a] -> Bool
- hasSpaceballsPrefix :: (Enum a, Eq a) => Int -> [a] -> Bool
- hasGroupedRepeats :: Eq a => [a] -> Bool
- hasInsufficientTransitionCoverage :: Ord a => Int -> [a] -> Ratio Int -> Bool
- shouldDiscardSolutions :: (Enum a, Ord a) => FilterConfig -> Int -> [[a]] -> Bool
- data FilterConfig = FilterConfig {
- rejectGroupedRepeats :: !Bool
- repetitiveSubsequenceThreshold :: !(Maybe Int)
- spaceballsPrefixThreshold :: !(Maybe Int)
- forbiddenCycleLengths :: ![Int]
- requireCycleLengthsAny :: ![Int]
- solutionSetLimit :: !(Maybe Int)
- requireSolutionsArePermutations :: !Bool
- absentTransitionsRequirement :: !Int
- transitionCoverageRequirement :: !(Ratio Int)
- defaultFilterConfig :: FilterConfig
- noFiltering :: FilterConfig
Pattern detection
isCyclicPatternWithAnyOf :: Eq a => [Int] -> [a] -> Bool Source #
Check if a sequence follows a cyclic pattern (e.g., [t3,t2,t1,t4,t3,t2,t1,t4])
The pattern is considered cyclic if it can be represented as `take n (cycle pattern)`
where `length pattern` is one of the given cycle lengths
hasRepetitiveSubsequence :: Eq a => Int -> [a] -> Bool Source #
Check if a sequence has repetitive subsequences as prefix or suffix (e.g., [t4,t4,t4,t4] at the beginning or end)
hasSpaceballsPrefix :: (Enum a, Eq a) => Int -> [a] -> Bool Source #
Check if a sequence begins with a Spaceballs PIN pattern
hasGroupedRepeats :: Eq a => [a] -> Bool Source #
Check if a sequence has grouped repeats (e.g., [t3,t3,t3,t1,t1,t1,t4,t4])
This means each unique element appears in consecutive groups of size > 1
hasInsufficientTransitionCoverage :: Ord a => Int -> [a] -> Ratio Int -> Bool Source #
Check if a sequence has insufficient transition coverage
Solution set validation
shouldDiscardSolutions :: (Enum a, Ord a) => FilterConfig -> Int -> [[a]] -> Bool Source #
Configuration
data FilterConfig Source #
Configuration for sequence filtering
Constructors
| FilterConfig | |
Fields
| |
Instances
defaultFilterConfig :: FilterConfig Source #
Default filter configuration that enables all filters