java.lang.Object
tools.refinery.interpreter.localsearch.planner.PlanState

public class PlanState extends 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)

  • Constructor Details

    • PlanState

      public PlanState(PBody pBody, Set<PVariable> boundVariables)
      Creates an initial state
  • Method Details

    • cloneWithApplied

      public PlanState cloneWithApplied(PConstraintInfo op)
    • getEnforcedConstraints

      public Set<PConstraint> getEnforcedConstraints()
    • updateExtends

      public void updateExtends(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(Iterable<PConstraintInfo> previousPresentExtends, Map<PVariable,? extends 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(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(Map<PVariable,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()
    • getOperations

      public List<PConstraintInfo> getOperations()
    • getBoundVariables

      public 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 List<PConstraintInfo> getPresentExtends()
    • getDeltaVariables

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