Class MonotonousPlaceGenerationLogic
- java.lang.Object
-
- org.processmining.specpp.componenting.system.link.AbstractBaseClass
-
- org.processmining.specpp.datastructures.tree.base.PlaceGenerationLogic
-
- org.processmining.specpp.datastructures.tree.nodegen.MonotonousPlaceGenerationLogic
-
- All Implemented Interfaces:
java.util.function.Consumer<GenerationConstraint>,Constrainable<GenerationConstraint>,FullComponentSystemUser,ChildGenerationLogicComponent<Place,PlaceState,PlaceNode>,HasComponentCollection,IsGlobalProvider,UsesGlobalComponentSystem,UsesLocalComponentSystem,ChildGenerationLogic<Place,PlaceState,PlaceNode>,ConstrainableChildGenerationLogic<Place,PlaceState,PlaceNode,GenerationConstraint>,TreeNodeGenerator<PlaceNode>,Observer<GenerationConstraint>,Initializable
public class MonotonousPlaceGenerationLogic extends PlaceGenerationLogic
Contains the entire logic for generating child (and in the future parent) local nodes. Relies only on the state of a given node and the global preset- & postset transition orderings to deterministically compute its children while respecting all received constraints. Guarantees to generate all possible nodes that satisfy the incoming constraints, provided that the constraints monotonically shrink the set of future nodes. That is, if constraints loosen the requirements and allow previously excluded nodes to be generated, these may not be correctly returned.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMonotonousPlaceGenerationLogic.Builderstatic classMonotonousPlaceGenerationLogic.ExpansionType
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Tuple2<java.lang.Class<? extends GenerationConstraint>,java.util.function.Consumer<GenerationConstraint>>>constraintHandlersprotected java.util.List<ExpansionStopper>expansionStoppersprotected java.util.List<PotentialExpansionsFilter>potentialExpansionFiltersprotected IntEncodings<Transition>transitionEncodings
-
Constructor Summary
Constructors Constructor Description MonotonousPlaceGenerationLogic(IntEncodings<Transition> transitionEncodings)MonotonousPlaceGenerationLogic(IntEncodings<Transition> transitionEncodings, PlaceGeneratorParameters parameters)Configures this generator's constraint handling.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptConstraint(GenerationConstraint constraint)Receives and internally applies selected generation constraints via at instantiation assigned constraint handlers.protected booleancanHavePostsetChildren(Place place)protected booleancanHavePresetChildren(Place place)protected BitMaskcomputeFilteredPotentialExpansions(Place place, PlaceState state, MonotonousPlaceGenerationLogic.ExpansionType expansionType)Computes potential expansions for the specified expansion type.protected Pair<BitMask>computePotentialExpansions(PlaceNode parent)Computes potential preset and postset expansions using all available constraints.voidcullChildren(PlaceNode node, MonotonousPlaceGenerationLogic.ExpansionType expansionType)Clears the potential expansions of typeexpansionTypeof PlaceNodenode, thus cutting off the corresponding subtree.PlaceNodegenerateChild(PlaceNode parent)PlaceNodegenerateRoot()java.lang.Class<GenerationConstraint>getAcceptedConstraintClass()protected BitMaskgetStaticPotentialExpansions(BitEncodedSet<Transition> transitions)The potential expansions statically determined solely by the transition set ordering.protected voidhandleCullChildrenConstraint(GenerationConstraint constraint)protected voidhandleDepthConstraint(DepthLimiter depthLimiter, GenerationConstraint constraint)protected voidhandleTransitionBlacklistingConstraint(TransitionBlacklister transitionBlacklister, GenerationConstraint constraint)protected voidhandleWiringConstraint(WiringTester wiringTester, GenerationConstraint constraint)booleanhasChildrenLeft(PlaceNode parent)protected voidinitSelf()Hook for subclasses to initialize themselves after the initial constructor call.protected PlaceNodemakeChild(PlaceNode parent, Pair<BitMask> potentialExpansions, MonotonousPlaceGenerationLogic.ExpansionType expansionType)Creates the next child node to the given parent according to the potential expansion sets.protected PlaceStatemakeChildState(Pair<BitMask> potentialExpansions, Place parentPlace, Place childPlace)intpotentialChildrenCount(PlaceNode parent)The number of, at this point, potential children as computed bypotentialChildren.java.lang.Iterable<PlaceNode>potentialFutureChildren(PlaceNode parent)Provides a lazily computed iterator of at this point considered potential children.-
Methods inherited from class org.processmining.specpp.componenting.system.link.AbstractBaseClass
collectTransitiveSubcomponents, getComponentCollection, getSubComponents, globalComponentSystem, init, localComponentSystem, postSubComponentInit, preSubComponentInit, registerSubComponent, unregisterSubComponent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.processmining.specpp.base.Constrainable
observe
-
Methods inherited from interface org.processmining.specpp.componenting.system.FullComponentSystemUser
collectTransitiveSubcomponents, connectLocalComponentSystem, getComponentCollection, registerSubComponent, unregisterSubComponent
-
Methods inherited from interface org.processmining.specpp.traits.Initializable
init
-
Methods inherited from interface org.processmining.specpp.componenting.traits.UsesGlobalComponentSystem
globalComponentSystem
-
Methods inherited from interface org.processmining.specpp.componenting.traits.UsesLocalComponentSystem
bridgeToChildren, localComponentSystem
-
-
-
-
Field Detail
-
constraintHandlers
protected final java.util.List<Tuple2<java.lang.Class<? extends GenerationConstraint>,java.util.function.Consumer<GenerationConstraint>>> constraintHandlers
-
transitionEncodings
protected final IntEncodings<Transition> transitionEncodings
-
potentialExpansionFilters
protected final java.util.List<PotentialExpansionsFilter> potentialExpansionFilters
-
expansionStoppers
protected final java.util.List<ExpansionStopper> expansionStoppers
-
-
Constructor Detail
-
MonotonousPlaceGenerationLogic
public MonotonousPlaceGenerationLogic(IntEncodings<Transition> transitionEncodings)
-
MonotonousPlaceGenerationLogic
public MonotonousPlaceGenerationLogic(IntEncodings<Transition> transitionEncodings, PlaceGeneratorParameters parameters)
Configures this generator's constraint handling. If specified inparameters, handlers for the following constraint classes are added dynamically. Subclassing implementations can define their own handlers, which in turn may use newPotentialExpansionFilters andExpansionStoppers. The following depicts the default flow.DepthConstraintinto thedepthLimiterWiringConstraintinto thewiringTesterBlacklistTransitionConstraintinto thetransitionBlacklisterSubTreeCutoffConstraintintodirectly applied to potentialChildren in the node state- Parameters:
transitionEncodings-parameters-
-
-
Method Detail
-
initSelf
protected void initSelf()
Description copied from class:AbstractBaseClassHook for subclasses to initialize themselves after the initial constructor call. At the time this is called, all fulfillable local & global component system requests will be fulfilled. Unless advanced interaction with the underlying systems is required, this is the only relevant hook for user-defined subclasses.- Specified by:
initSelfin classAbstractBaseClass
-
generateRoot
public PlaceNode generateRoot()
- Returns:
- an empty root node corresponding to the place
(∅|∅)without any existing children
-
makeChild
protected PlaceNode makeChild(PlaceNode parent, Pair<BitMask> potentialExpansions, MonotonousPlaceGenerationLogic.ExpansionType expansionType)
Creates the next child node to the given parent according to the potential expansion sets. Mutates the internal state of the parent to mark the child's existence. The child's potential expansions are set equal to its parent's minus itself, unless the parent was restricted in from pre/postset expansion completely. Then, it will recalculate the potential expansions statically based on the child place.- Parameters:
parent- the parent node whose next child is to be generatedpotentialExpansions- the pair of potential (preset, postset)-expansionsexpansionType- whether to expand theExpansionType.PresetorExpansionType.Postset- Returns:
- the generated child node
-
makeChildState
protected PlaceState makeChildState(Pair<BitMask> potentialExpansions, Place parentPlace, Place childPlace)
-
hasChildrenLeft
public boolean hasChildrenLeft(PlaceNode parent)
- Parameters:
parent-- Returns:
- whether
parenthas any possible children as computed bycomputePotentialExpansions() - See Also:
computePotentialExpansions(PlaceNode)
-
computePotentialExpansions
protected Pair<BitMask> computePotentialExpansions(PlaceNode parent)
Computes potential preset and postset expansions using all available constraints. Internally updates the queried node state with the computed result. By design of the constraint system, potential expansions are monotonically decreasing subsets.- Parameters:
parent- node whose possible expansions are to be computes for- Returns:
- pair(presetExpansions, postsetExpansions)
-
computeFilteredPotentialExpansions
protected BitMask computeFilteredPotentialExpansions(Place place, PlaceState state, MonotonousPlaceGenerationLogic.ExpansionType expansionType)
Computes potential expansions for the specified expansion type. Mutates the state it is querying.- Parameters:
place-state- NodeState which is queried and updatedexpansionType- the expansion type- Returns:
- potential expansions represented by a bitmask
-
getStaticPotentialExpansions
protected BitMask getStaticPotentialExpansions(BitEncodedSet<Transition> transitions)
The potential expansions statically determined solely by the transition set ordering. All transitions greater than the maximum oftransitionsare potential expansions.- Parameters:
transitions- ordered subset of transitions- Returns:
- potential expansions represented by a bitmask
-
canHavePostsetChildren
protected boolean canHavePostsetChildren(Place place)
- Parameters:
place-- Returns:
- whether
placeis allowed to have postset expansion children
-
canHavePresetChildren
protected boolean canHavePresetChildren(Place place)
- Parameters:
place-- Returns:
- whether
placeis allowed to have preset expansion children
-
cullChildren
public void cullChildren(PlaceNode node, MonotonousPlaceGenerationLogic.ExpansionType expansionType)
Clears the potential expansions of typeexpansionTypeof PlaceNodenode, thus cutting off the corresponding subtree.- Parameters:
node-expansionType-
-
potentialChildrenCount
public int potentialChildrenCount(PlaceNode parent)
The number of, at this point, potential children as computed bypotentialChildren.- Parameters:
parent-- Returns:
- See Also:
potentialFutureChildren(PlaceNode)
-
potentialFutureChildren
public java.lang.Iterable<PlaceNode> potentialFutureChildren(PlaceNode parent)
Provides a lazily computed iterator of at this point considered potential children. It may be used by tree expansion heuristics.- Parameters:
parent-- Returns:
-
acceptConstraint
public void acceptConstraint(GenerationConstraint constraint)
Receives and internally applies selected generation constraints via at instantiation assigned constraint handlers.- Parameters:
constraint- the received generation constraint
-
getAcceptedConstraintClass
public java.lang.Class<GenerationConstraint> getAcceptedConstraintClass()
-
handleTransitionBlacklistingConstraint
protected void handleTransitionBlacklistingConstraint(TransitionBlacklister transitionBlacklister, GenerationConstraint constraint)
-
handleWiringConstraint
protected void handleWiringConstraint(WiringTester wiringTester, GenerationConstraint constraint)
-
handleDepthConstraint
protected void handleDepthConstraint(DepthLimiter depthLimiter, GenerationConstraint constraint)
-
handleCullChildrenConstraint
protected void handleCullChildrenConstraint(GenerationConstraint constraint)
-
-