modelling-tasks-0.0.0.1
Safe HaskellSafe-Inferred
LanguageHaskell2010

Modelling.ActivityDiagram.ActionSequences

Synopsis

Documentation

validActionSequenceWithPetri :: [String] -> Net PetriKey PetriKey -> [(String, PetriKey)] -> Bool Source #

Check if an action sequence is valid, using a pre-computed Petri net.

generateActionSequence :: UMLActivityDiagram -> [String] Source #

Generate a valid action sequence reaching each of the final nodes

generateActionSequencesWithPetri :: PetriLike Node PetriKey -> Maybe (Int, Int) -> [[String]] Source #

Generate valid action sequences, using a pre-computed Petri net. The returned list may be infinite or some of its tails even diverge, if no length constraints are passed.

generateActionSequenceWithPetriAndRepetition :: MonadRandom m => PetriLike Node PetriKey -> (Int, Int) -> Maybe (m [String]) Source #

Generate one valid action sequence with repetition, using a pre-computed Petri net. This version allows cycle exploration to generate sequences with repeated actions. Returns Nothing if no sequence with repetition can be found within the length constraints. Uses randomness to select among sequences with equal maximum repetition distance.

actionRepetitionDistance :: [String] -> Maybe Int Source #

Calculate the maximum distance between any two occurrences of the same action. Returns Nothing if there are no repeated actions.

For example:

immediate repetition:

>>> actionRepetitionDistance ["A", "A"]
Just 0

1 action between repetitions:

>>> actionRepetitionDistance ["A", "B", "A"]
Just 1

2 actions between repetitions:

>>> actionRepetitionDistance ["A", "B", "C", "A"]
Just 2

no repetitions:

>>> actionRepetitionDistance ["A", "B", "C"]
Nothing

computeActionSequenceLevels :: [String] -> Net PetriKey PetriKey -> [(String, PetriKey)] -> [[(State PetriKey, [PetriKey])]] Source #

Common computation for action sequence validation.

isFinalPetriNode :: PetriKey -> Bool Source #

Check if a PetriKey represents a final node transition