Class PlanState


  • public class PlanState
    extends java.lang.Object
    This class represents the state of the plan during planning.

    A PlanState represents a sequence of operations (operationsList) and caches the computed cost for this operation sequence. The list and the cost are initialized in the constructor. However, #categorizeChecks() also updates the operations list (by suffixing checks)

    No Reference:
    This class is not intended to be referenced by clients.
    • Constructor Detail

      • PlanState

        public PlanState​(PBody pBody,
                         java.util.Set<PVariable> boundVariables)
        Creates an initial state
    • Method Detail

      • getEnforcedConstraints

        public java.util.Set<PConstraint> getEnforcedConstraints()
      • updateExtends

        public void updateExtends​(java.lang.Iterable<PConstraintInfo> allPotentialExtendInfos)
        Re-categorizes given extend operations into already applied or no longer applicable ones (discarded), immediately applicable ones (saved as presently viable extends), and not yet applicable ones (discarded).
        Parameters:
        allPotentialExtendInfos - all other extends that may be applicable to this plan state now or in the future; MUST consist of "extend" constraint applications only (at least one free variable)
      • updateExtendsBasedOnDelta

        public void updateExtendsBasedOnDelta​(java.lang.Iterable<PConstraintInfo> previousPresentExtends,
                                              java.util.Map<PVariable,​? extends java.util.Collection<PConstraintInfo>> extendOpsByBoundVariables)
        Re-categorizes given extend operations into already applied or no longer applicable ones (discarded), immediately applicable ones (saved as presently viable extends), and not yet applicable ones (discarded).
        Parameters:
        extendOpsByBoundVariables - all EXTEND operations indexed by affected bound variables MUST consist of "extend" constraint applications only (at least one free variable)
      • applyChecks

        public void applyChecks​(java.util.List<PConstraintInfo> allPotentialCheckInfos)
        Check operations that newly became applicable (see getDeltaVariables()) are appended to operations lists.

        Will never discover degenerate checks (of PConstraints with zero variables), so must not use on initial state.

        Parameters:
        allPotentialCheckInfos - all CHECK operations MUST consist of "check" constraint applications only (no free variables) and must be iterable in decreasing order of cost
      • applyChecksBasedOnDelta

        public void applyChecksBasedOnDelta​(java.util.Map<PVariable,​java.util.List<PConstraintInfo>> checkOpsByVariables)
        Immediately applicable checks are appended to operations lists.
        Parameters:
        checkOpsByVariables - all CHECK operations indexed by affected variables MUST consist of "check" constraint applications only (no free variables) and each bucket must be iterable in decreasing order of cost
      • getAssociatedPBody

        public PBody getAssociatedPBody()
      • getBoundVariables

        public java.util.Set<PVariable> getBoundVariables()
      • getCost

        public double getCost()
        Returns:
        the derived cost of the plan contained in the state
      • getCummulativeProduct

        public double getCummulativeProduct()
        Returns:
        cumulative branching factor
        Since:
        2.1
      • getPresentExtends

        public java.util.List<PConstraintInfo> getPresentExtends()
      • getDeltaVariables

        public java.util.Collection<PVariable> getDeltaVariables()
        Contains only those variables that are added by the newest extend (or the initially bound ones if no extend yet)