Class MonotonousPlaceGenerationLogic

    • Constructor Detail

      • MonotonousPlaceGenerationLogic

        public MonotonousPlaceGenerationLogic​(IntEncodings<Transition> transitionEncodings)
      • MonotonousPlaceGenerationLogic

        public MonotonousPlaceGenerationLogic​(IntEncodings<Transition> transitionEncodings,
                                              PlaceGeneratorParameters parameters)
        Configures this generator's constraint handling. If specified in parameters, handlers for the following constraint classes are added dynamically. Subclassing implementations can define their own handlers, which in turn may use new PotentialExpansionFilters and ExpansionStoppers. The following depicts the default flow.
              DepthConstraint into the depthLimiter
              WiringConstraint into the wiringTester
              BlacklistTransitionConstraint into the transitionBlacklister
              SubTreeCutoffConstraint into directly applied to potentialChildren in the node state
         
        Parameters:
        transitionEncodings -
        parameters -
    • Method Detail

      • initSelf

        protected void initSelf()
        Description copied from class: AbstractBaseClass
        Hook 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:
        initSelf in class AbstractBaseClass
      • 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 generated
        potentialExpansions - the pair of potential (preset, postset)-expansions
        expansionType - whether to expand the ExpansionType.Preset or ExpansionType.Postset
        Returns:
        the generated child node
      • hasChildrenLeft

        public boolean hasChildrenLeft​(PlaceNode parent)
        Parameters:
        parent -
        Returns:
        whether parent has any possible children as computed by computePotentialExpansions()
        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 updated
        expansionType - 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 of transitions are 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 place is allowed to have postset expansion children
      • canHavePresetChildren

        protected boolean canHavePresetChildren​(Place place)
        Parameters:
        place -
        Returns:
        whether place is allowed to have preset expansion children
      • cullChildren

        public void cullChildren​(PlaceNode node,
                                 MonotonousPlaceGenerationLogic.ExpansionType expansionType)
        Clears the potential expansions of type expansionType of PlaceNode node, 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 by potentialChildren.
        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()
      • handleCullChildrenConstraint

        protected void handleCullChildrenConstraint​(GenerationConstraint constraint)