Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Modelling.PetriNet.Types
Contents
Description
This module provides types to represent Petri nets.
A Petri net is a mathematical modelling language. It is used to describe distributed systems. Another name for Petri net is place / transition (PT) net.
The Types
module defines basic type class instances and
functions to work on and transform Petri net representations.
Synopsis
- data AdvConfig = AdvConfig {}
- data AlloyConfig = AlloyConfig {}
- data BasicConfig = BasicConfig {
- places :: Int
- transitions :: Int
- atLeastActive :: Int
- flowOverall :: (Int, Int)
- maxTokensPerPlace :: Int
- maxFlowPerEdge :: Int
- tokensOverall :: (Int, Int)
- isConnected :: Maybe Bool
- type Change = PetriChange String
- data ChangeConfig = ChangeConfig {}
- newtype Concurrent a = Concurrent (a, a)
- type Conflict = PetriConflict Place Transition
- data ConflictConfig = ConflictConfig {}
- type Drawable n = (n, DrawSettings)
- data DrawSettings = DrawSettings {
- withPlaceNames :: Bool
- withSvgHighlighting :: Bool
- withTransitionNames :: Bool
- with1Weights :: Bool
- withGraphvizCommand :: GraphvizCommand
- data FindConcurrencyConfig = FindConcurrencyConfig {
- basicConfig :: BasicConfig
- advConfig :: AdvConfig
- changeConfig :: ChangeConfig
- graphConfig :: GraphConfig
- printSolution :: Bool
- alloyConfig :: AlloyConfig
- extraText :: Maybe (Map Language String)
- data FindConflictConfig = FindConflictConfig {}
- data GraphConfig = GraphConfig {
- graphLayouts :: [GraphvizCommand]
- hidePlaceNames :: Bool
- hideTransitionNames :: Bool
- hideWeight1 :: Bool
- data InvalidPetriNetException
- class (PetriNode n, Show (p n String)) => Net p n where
- emptyNet :: p n a
- alterFlow :: Ord a => a -> Int -> a -> p n a -> p n a
- alterNode :: Ord a => a -> Maybe Int -> p n a -> p n a
- deleteFlow :: Ord a => a -> a -> p n a -> p n a
- deleteNode :: Ord a => a -> p n a -> p n a
- flow :: Ord a => a -> a -> p n a -> Maybe Int
- nodes :: Ord a => p n a -> Map a (n a)
- outFlow :: Ord a => a -> p n a -> Map a Int
- mapNet :: Ord b => (a -> b) -> p n a -> p n b
- traverseNet :: (Applicative f, Ord b) => (a -> f b) -> p n a -> f (p n b)
- data Node a
- data Petri = Petri {
- initialMarking :: Marking
- trans :: [Transition]
- data PetriChange a = Change {
- tokenChange :: Map a Int
- flowChange :: Map a (Map a Int)
- data PetriConflict p t = Conflict {
- conflictTrans :: (t, t)
- conflictPlaces :: [p]
- newtype PetriConflict' x = PetriConflict' {
- toPetriConflict :: PetriConflict x x
- newtype PetriLike n a = PetriLike {}
- data PetriMath a = PetriMath {
- netMath :: a
- placesMath :: a
- transitionsMath :: a
- tokenChangeMath :: [(a, a)]
- initialMarkingMath :: a
- placeOrderMath :: Maybe a
- class Show (n String) => PetriNode n where
- initialTokens :: n a -> Int
- isPlaceNode :: n a -> Bool
- isTransitionNode :: n a -> Bool
- mapNode :: Ord b => (a -> b) -> n a -> n b
- traverseNode :: (Applicative f, Ord b) => (a -> f b) -> n a -> f (n b)
- data PickConcurrencyConfig = PickConcurrencyConfig {}
- data PickConflictConfig = PickConflictConfig {}
- data SimpleNode a
- = SimplePlace { }
- | SimpleTransition { }
- type SimplePetriLike = PetriLike SimpleNode
- type SimplePetriNet = SimplePetriLike String
- allDrawSettings :: GraphConfig -> [DrawSettings]
- checkBasicConfig :: BasicConfig -> Maybe String
- checkChangeConfig :: BasicConfig -> ChangeConfig -> Maybe String
- checkGraphLayouts :: Bool -> Int -> GraphConfig -> Maybe String
- checkPetriNodeCount :: (Net p n, Ord a) => (Int, Maybe Int) -> p n a -> Bool
- defaultAdvConfig :: AdvConfig
- defaultAlloyConfig :: AlloyConfig
- defaultBasicConfig :: BasicConfig
- defaultChangeConfig :: ChangeConfig
- defaultFindConcurrencyConfig :: FindConcurrencyConfig
- defaultFindConflictConfig :: FindConflictConfig
- defaultGraphConfig :: GraphConfig
- defaultPickConcurrencyConfig :: PickConcurrencyConfig
- defaultPickConflictConfig :: PickConflictConfig
- drawSettingsWithCommand :: GraphConfig -> GraphvizCommand -> DrawSettings
- lAdvConfig :: Lens' FindConflictConfig AdvConfig
- lAlloyConfig :: Lens' FindConflictConfig AlloyConfig
- lAtLeastActive :: Lens' BasicConfig Int
- lBasicConfig :: Lens' FindConflictConfig BasicConfig
- lChangeConfig :: Lens' FindConflictConfig ChangeConfig
- lConflictConfig :: Lens' FindConflictConfig ConflictConfig
- lConflictPlaces :: forall p t p. Lens (PetriConflict p t) (PetriConflict p t) [p] [p]
- lConflictTrans :: forall p t t. Lens (PetriConflict p t) (PetriConflict p t) (t, t) (t, t)
- lExtraText :: Lens' FindConflictConfig (Maybe (Map Language String))
- lFlowOverall :: Lens' BasicConfig (Int, Int)
- lGraphConfig :: Lens' FindConflictConfig GraphConfig
- lGraphLayouts :: Lens' GraphConfig [GraphvizCommand]
- lHidePlaceNames :: Lens' GraphConfig Bool
- lHideTransitionNames :: Lens' GraphConfig Bool
- lHideWeight1 :: Lens' GraphConfig Bool
- lIsConnected :: Lens' BasicConfig (Maybe Bool)
- lMaxFlowPerEdge :: Lens' BasicConfig Int
- lMaxTokensPerPlace :: Lens' BasicConfig Int
- lPlaces :: Lens' BasicConfig Int
- lPrintSolution :: Lens' FindConflictConfig Bool
- lTokensOverall :: Lens' BasicConfig (Int, Int)
- lTransitions :: Lens' BasicConfig Int
- lUniqueConflictPlace :: Lens' FindConflictConfig (Maybe Bool)
- mapChange :: Ord b => (a -> b) -> PetriChange a -> PetriChange b
- maybeInitial :: PetriNode n => n a -> Maybe Int
- petriLikeToPetri :: (MonadThrow m, Ord a) => PetriLike Node a -> m Petri
- placeNames :: (Net p n, Ord k) => p n k -> [k]
- shuffleNames :: (MonadThrow m, Net p n, Ord a, RandomGen g) => p n a -> RandT g m (p n a, Bimap a a)
- transformNet :: (Net p n, Net p' n', Ord a) => p n a -> p' n' a
- transitionNames :: (Net p n, Ord k) => p n k -> [k]
- transitionPairShow :: (Transition, Transition) -> (ShowTransition, ShowTransition)
Documentation
Constructors
AdvConfig | |
Instances
Generic AdvConfig Source # | |
Read AdvConfig Source # | |
Show AdvConfig Source # | |
type Rep AdvConfig Source # | |
Defined in Modelling.PetriNet.Types type Rep AdvConfig = D1 ('MetaData "AdvConfig" "Modelling.PetriNet.Types" "modelling-tasks-0.0.0.1-5lkaY76HE6k79qLVIy6Ku2" 'False) (C1 ('MetaCons "AdvConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "presenceOfSelfLoops") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)) :*: (S1 ('MetaSel ('Just "presenceOfSinkTransitions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "presenceOfSourceTransitions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool))))) |
data AlloyConfig Source #
Constructors
AlloyConfig | |
Instances
Generic AlloyConfig Source # | |
Defined in Modelling.PetriNet.Types Associated Types type Rep AlloyConfig :: Type -> Type # | |
Read AlloyConfig Source # | |
Defined in Modelling.PetriNet.Types Methods readsPrec :: Int -> ReadS AlloyConfig # readList :: ReadS [AlloyConfig] # readPrec :: ReadPrec AlloyConfig # readListPrec :: ReadPrec [AlloyConfig] # | |
Show AlloyConfig Source # | |
Defined in Modelling.PetriNet.Types Methods showsPrec :: Int -> AlloyConfig -> ShowS # show :: AlloyConfig -> String # showList :: [AlloyConfig] -> ShowS # | |
type Rep AlloyConfig Source # | |
Defined in Modelling.PetriNet.Types type Rep AlloyConfig = D1 ('MetaData "AlloyConfig" "Modelling.PetriNet.Types" "modelling-tasks-0.0.0.1-5lkaY76HE6k79qLVIy6Ku2" 'False) (C1 ('MetaCons "AlloyConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "maxInstances") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Integer)) :*: S1 ('MetaSel ('Just "timeout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)))) |
data BasicConfig Source #
Constructors
BasicConfig | |
Fields
|
Instances
type Change = PetriChange String Source #
A PetriChange
where nodes are labelled by strings.
data ChangeConfig Source #
Constructors
ChangeConfig | |
Fields |
Instances
newtype Concurrent a Source #
Constructors
Concurrent (a, a) |
Instances
type Conflict = PetriConflict Place Transition Source #
A PetriConflict
where nodes are labelled by strings.
data ConflictConfig Source #
Constructors
ConflictConfig | |
Fields
|
Instances
type Drawable n = (n, DrawSettings) Source #
data DrawSettings Source #
Constructors
DrawSettings | |
Fields
|
Instances
data FindConcurrencyConfig Source #
Constructors
FindConcurrencyConfig | |
Fields
|
Instances
data FindConflictConfig Source #
Constructors
FindConflictConfig | |
Fields
|
Instances
data GraphConfig Source #
Constructors
GraphConfig | |
Fields
|
Instances
data InvalidPetriNetException Source #
Constructors
FlowFromATransitionIsZeroOrLess | |
FlowToATransitionIsZeroOrLess | |
PlaceWithNegativeTokenNumber | |
RelatedNodesOfPlacesContainPlaces | |
RelatedNodesOfTransitionsContainTransitions |
Instances
Exception InvalidPetriNetException Source # | |
Defined in Modelling.PetriNet.Types | |
Show InvalidPetriNetException Source # | |
Defined in Modelling.PetriNet.Types Methods showsPrec :: Int -> InvalidPetriNetException -> ShowS # show :: InvalidPetriNetException -> String # showList :: [InvalidPetriNetException] -> ShowS # |
class (PetriNode n, Show (p n String)) => Net p n where Source #
Methods
Inserts flow
into the Net
by connecting the provided source and target
by the given flow.
If no PetriNode
for the given source or target exists within the Net
no flow
is added to the Net
If flow
between source and target exists already it is replaced.
Inserts a PetriNode
into the Net
given the desired key,
- a place node with the desired initial tokes if Just such are provided,
- a transition node otherwise.
If the desired key already exists, the targeted PetriNode
is replaced
without affecting preexisting flow
.
(use deleteNode
first if you desire to clear related flow)
deleteFlow :: Ord a => a -> a -> p n a -> p n a Source #
Removes the flow going from the first given key to the second one..
deleteNode :: Ord a => a -> p n a -> p n a Source #
Removes the PetriNode
associated with the key and all connections going
from or to the removed node.
flow :: Ord a => a -> a -> p n a -> Maybe Int Source #
nodes :: Ord a => p n a -> Map a (n a) Source #
outFlow :: Ord a => a -> p n a -> Map a Int Source #
mapNet :: Ord b => (a -> b) -> p n a -> p n b Source #
traverseNet :: (Applicative f, Ord b) => (a -> f b) -> p n a -> f (p n b) Source #
Instances
A node is part of a Petri like graph (see PetriLike
).
Each node stores its predecessor and successor nodes together with their weight
in the fields $sel:flowIn:PlaceNode
and Node
respectively.
Additionally PlaceNode
s have a value of initial tokens.
Constructors
PlaceNode | |
TransitionNode | |
Instances
PetriNode Node Source # | |
Defined in Modelling.PetriNet.Types | |
Net PetriLike Node Source # | |
Defined in Modelling.PetriNet.Types Methods emptyNet :: PetriLike Node a Source # alterFlow :: Ord a => a -> Int -> a -> PetriLike Node a -> PetriLike Node a Source # alterNode :: Ord a => a -> Maybe Int -> PetriLike Node a -> PetriLike Node a Source # deleteFlow :: Ord a => a -> a -> PetriLike Node a -> PetriLike Node a Source # deleteNode :: Ord a => a -> PetriLike Node a -> PetriLike Node a Source # flow :: Ord a => a -> a -> PetriLike Node a -> Maybe Int Source # nodes :: Ord a => PetriLike Node a -> Map a (Node a) Source # outFlow :: Ord a => a -> PetriLike Node a -> Map a Int Source # mapNet :: Ord b => (a -> b) -> PetriLike Node a -> PetriLike Node b Source # traverseNet :: (Applicative f, Ord b) => (a -> f b) -> PetriLike Node a -> f (PetriLike Node b) Source # | |
(Data a, Ord a) => Data (Node a) Source # | |
Defined in Modelling.PetriNet.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Node a -> c (Node a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Node a) # toConstr :: Node a -> Constr # dataTypeOf :: Node a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Node a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Node a)) # gmapT :: (forall b. Data b => b -> b) -> Node a -> Node a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Node a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Node a -> r # gmapQ :: (forall d. Data d => d -> u) -> Node a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Node a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Node a -> m (Node a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Node a -> m (Node a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Node a -> m (Node a) # | |
Generic (Node a) Source # | |
(Ord a, Read a) => Read (Node a) Source # | |
Show a => Show (Node a) Source # | |
Eq a => Eq (Node a) Source # | |
type Rep (Node a) Source # | |
Defined in Modelling.PetriNet.Types type Rep (Node a) = D1 ('MetaData "Node" "Modelling.PetriNet.Types" "modelling-tasks-0.0.0.1-5lkaY76HE6k79qLVIy6Ku2" 'False) (C1 ('MetaCons "PlaceNode" 'PrefixI 'True) (S1 ('MetaSel ('Just "initial") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "flowIn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map a Int)) :*: S1 ('MetaSel ('Just "flowOut") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map a Int)))) :+: C1 ('MetaCons "TransitionNode" 'PrefixI 'True) (S1 ('MetaSel ('Just "flowIn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map a Int)) :*: S1 ('MetaSel ('Just "flowOut") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map a Int)))) |
Constructors
Petri | |
Fields
|
data PetriChange a Source #
A PetriChange
describes the changes on a PetriLike
graph by mapping PlaceNode
s
to token changes and origins of an edge to a mapping from their targets to flow
changes.
Constructors
Change | |
Fields
|
Instances
data PetriConflict p t Source #
A PetriConflict
describes a conflict between two transitions.
It occurs when the number of tokens at the source place are not enough to fire
both transitions (both are having the same source place).
Constructors
Conflict | |
Fields
|
Instances
newtype PetriConflict' x Source #
Constructors
PetriConflict' | |
Fields
|
Instances
newtype PetriLike n a Source #
A Petri like graph consists of nodes which might have connections between each other.
The PetriLike
graph is a valid Petri net only if
PlaceNode
s are only successors ofTransitionNode
sTransitionNode
s are only successors ofPlaceNode
s- the initial marking is valid (i.e., all initial tokens are nonnegative)
- every weight is greater than zero
Constructors
PetriLike | |
Instances
Stores a mathematical representation of a Petri net based on a five tuple.
Constructors
PetriMath | |
Fields
|
Instances
Foldable PetriMath Source # | |
Defined in Modelling.PetriNet.Types Methods fold :: Monoid m => PetriMath m -> m # foldMap :: Monoid m => (a -> m) -> PetriMath a -> m # foldMap' :: Monoid m => (a -> m) -> PetriMath a -> m # foldr :: (a -> b -> b) -> b -> PetriMath a -> b # foldr' :: (a -> b -> b) -> b -> PetriMath a -> b # foldl :: (b -> a -> b) -> b -> PetriMath a -> b # foldl' :: (b -> a -> b) -> b -> PetriMath a -> b # foldr1 :: (a -> a -> a) -> PetriMath a -> a # foldl1 :: (a -> a -> a) -> PetriMath a -> a # toList :: PetriMath a -> [a] # length :: PetriMath a -> Int # elem :: Eq a => a -> PetriMath a -> Bool # maximum :: Ord a => PetriMath a -> a # minimum :: Ord a => PetriMath a -> a # | |
Traversable PetriMath Source # | |
Defined in Modelling.PetriNet.Types | |
Functor PetriMath Source # | |
Data a => Data (PetriMath a) Source # | |
Defined in Modelling.PetriNet.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PetriMath a -> c (PetriMath a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PetriMath a) # toConstr :: PetriMath a -> Constr # dataTypeOf :: PetriMath a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (PetriMath a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PetriMath a)) # gmapT :: (forall b. Data b => b -> b) -> PetriMath a -> PetriMath a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PetriMath a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PetriMath a -> r # gmapQ :: (forall d. Data d => d -> u) -> PetriMath a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PetriMath a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PetriMath a -> m (PetriMath a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PetriMath a -> m (PetriMath a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PetriMath a -> m (PetriMath a) # | |
Generic (PetriMath a) Source # | |
Read a => Read (PetriMath a) Source # | |
Show a => Show (PetriMath a) Source # | |
type Rep (PetriMath a) Source # | |
Defined in Modelling.PetriNet.Types type Rep (PetriMath a) = D1 ('MetaData "PetriMath" "Modelling.PetriNet.Types" "modelling-tasks-0.0.0.1-5lkaY76HE6k79qLVIy6Ku2" 'False) (C1 ('MetaCons "PetriMath" 'PrefixI 'True) ((S1 ('MetaSel ('Just "netMath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: (S1 ('MetaSel ('Just "placesMath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "transitionsMath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) :*: (S1 ('MetaSel ('Just "tokenChangeMath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(a, a)]) :*: (S1 ('MetaSel ('Just "initialMarkingMath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "placeOrderMath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a)))))) |
class Show (n String) => PetriNode n where Source #
Methods
initialTokens :: n a -> Int Source #
isPlaceNode :: n a -> Bool Source #
isTransitionNode :: n a -> Bool Source #
Whether the PetriNode
is a TransitionNode
.
mapNode :: Ord b => (a -> b) -> n a -> n b Source #
This function acts like fmap
on other Functor
s.
Note that PetriNode
is not necessarily a true Functor
and thus mapNode
is not a true fmap
because an Ord
instance is required for Node
s
first type parameter for mapNode
to work,
furthermore (and that is the original reason), mapNode
usually
uses mapKeys
internally in order to apply the mapping. Thus, the user of
mapNode
is responsible to ensure that the transformation preserves uniqueness
on all used keys.
traverseNode :: (Applicative f, Ord b) => (a -> f b) -> n a -> f (n b) Source #
This function acts like traverse
on Traversable
.
Not that PetriNode
is not necessarily Traversable
itself as it requires
an Ord
instance for the result type within the Applicative
of its first argument, the applicative lifting transformation function.
This behaviour occurs, because the traversal changes the keys of the underlying
Map
.
Transformations on this map require a specific traversal traverseKeyMap
.
The user is responsible to ensure uniqueness of the keys after the traversal. Note, that the order of values could also change if the transformation is not order-preserving.
Instances
PetriNode Node Source # | |
Defined in Modelling.PetriNet.Types | |
PetriNode SimpleNode Source # | |
Defined in Modelling.PetriNet.Types Methods initialTokens :: SimpleNode a -> Int Source # isPlaceNode :: SimpleNode a -> Bool Source # isTransitionNode :: SimpleNode a -> Bool Source # mapNode :: Ord b => (a -> b) -> SimpleNode a -> SimpleNode b Source # traverseNode :: (Applicative f, Ord b) => (a -> f b) -> SimpleNode a -> f (SimpleNode b) Source # |
data PickConcurrencyConfig Source #
Constructors
PickConcurrencyConfig | |
Fields
|
Instances
data PickConflictConfig Source #
Constructors
PickConflictConfig | |
Fields
|
Instances
data SimpleNode a Source #
Constructors
SimplePlace | |
SimpleTransition | |
Instances
type SimplePetriLike = PetriLike SimpleNode Source #
type SimplePetriNet = SimplePetriLike String Source #
allDrawSettings :: GraphConfig -> [DrawSettings] Source #
Provides a list of all DrawSetting
that can be obtained by using
drawSettingsWithCommand
and all possible graphLayout
s of the given config.
checkChangeConfig :: BasicConfig -> ChangeConfig -> Maybe String Source #
checkGraphLayouts :: Bool -> Int -> GraphConfig -> Maybe String Source #
checkPetriNodeCount :: (Net p n, Ord a) => (Int, Maybe Int) -> p n a -> Bool Source #
Check if the count of nodes in a Petri net falls within the given bounds
drawSettingsWithCommand :: GraphConfig -> GraphvizCommand -> DrawSettings Source #
Converts a GraphConfig
into DrawSettings
by choosing
the provided GraphvizCommand
.
Raises a runtime error if the provided GraphvizCommand
is not in the
$sel:graphLayouts:GraphConfig
list of the GraphConfig
.
lAdvConfig :: Lens' FindConflictConfig AdvConfig Source #
lAlloyConfig :: Lens' FindConflictConfig AlloyConfig Source #
lAtLeastActive :: Lens' BasicConfig Int Source #
lBasicConfig :: Lens' FindConflictConfig BasicConfig Source #
lChangeConfig :: Lens' FindConflictConfig ChangeConfig Source #
lConflictPlaces :: forall p t p. Lens (PetriConflict p t) (PetriConflict p t) [p] [p] Source #
lConflictTrans :: forall p t t. Lens (PetriConflict p t) (PetriConflict p t) (t, t) (t, t) Source #
lExtraText :: Lens' FindConflictConfig (Maybe (Map Language String)) Source #
lFlowOverall :: Lens' BasicConfig (Int, Int) Source #
lGraphConfig :: Lens' FindConflictConfig GraphConfig Source #
lGraphLayouts :: Lens' GraphConfig [GraphvizCommand] Source #
lHidePlaceNames :: Lens' GraphConfig Bool Source #
lHideTransitionNames :: Lens' GraphConfig Bool Source #
lHideWeight1 :: Lens' GraphConfig Bool Source #
lIsConnected :: Lens' BasicConfig (Maybe Bool) Source #
lMaxFlowPerEdge :: Lens' BasicConfig Int Source #
lMaxTokensPerPlace :: Lens' BasicConfig Int Source #
lPlaces :: Lens' BasicConfig Int Source #
lPrintSolution :: Lens' FindConflictConfig Bool Source #
lTokensOverall :: Lens' BasicConfig (Int, Int) Source #
lTransitions :: Lens' BasicConfig Int Source #
lUniqueConflictPlace :: Lens' FindConflictConfig (Maybe Bool) Source #
mapChange :: Ord b => (a -> b) -> PetriChange a -> PetriChange b Source #
This function acts like fmap
on other Functor
s.
Note that Change
is not a true Functor
and thus mapChange
is not a true
fmap
because an Ord
instance is required for Change
s first type parameter
for mapChange
to work, furthermore (and that is the original reason),
mapChange
uses mapKeys
internally in order to apply the mapping.
Thus, the user of mapChange
is responsible to ensure that the transformation
preserves uniqueness on all used keys.
petriLikeToPetri :: (MonadThrow m, Ord a) => PetriLike Node a -> m Petri Source #
Transform a PetriLike
graph into a Petri
net.
It first checks if the given Petri net like graph is indeed a valid Petri net
(see also PetriLike
),
- if it is, the Petri net like graph is transformed into a Petri net by
eliminating references to names of places and transitions at all.
Instead
$sel:initialMarking:Petri
is given by a list (where each position represents different places) and transitions ($sel:trans:Petri
) are given by a lists of token change (where, again, each position represents a different place, but the same index within$sel:initialMarking:Petri
and$sel:trans:Petri
represents the same place). - if it is not, an exception is thrown indicating the reason why the given Petri net like graph is not a valid Petri net.
placeNames :: (Net p n, Ord k) => p n k -> [k] Source #
shuffleNames :: (MonadThrow m, Net p n, Ord a, RandomGen g) => p n a -> RandT g m (p n a, Bimap a a) Source #
transitionNames :: (Net p n, Ord k) => p n k -> [k] Source #
Orphan instances
Data GraphvizCommand Source # | |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GraphvizCommand -> c GraphvizCommand # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c GraphvizCommand # toConstr :: GraphvizCommand -> Constr # dataTypeOf :: GraphvizCommand -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c GraphvizCommand) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GraphvizCommand) # gmapT :: (forall b. Data b => b -> b) -> GraphvizCommand -> GraphvizCommand # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GraphvizCommand -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GraphvizCommand -> r # gmapQ :: (forall d. Data d => d -> u) -> GraphvizCommand -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> GraphvizCommand -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> GraphvizCommand -> m GraphvizCommand # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GraphvizCommand -> m GraphvizCommand # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GraphvizCommand -> m GraphvizCommand # |