Class PlanState
java.lang.Object
tools.refinery.interpreter.localsearch.planner.PlanState
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyChecks(List<PConstraintInfo> allPotentialCheckInfos) Check operations that newly became applicable (seegetDeltaVariables()) are appended to operations lists.voidapplyChecksBasedOnDelta(Map<PVariable, List<PConstraintInfo>> checkOpsByVariables) Immediately applicable checks are appended to operations lists.doublegetCost()doubleContains only those variables that are added by the newest extend (or the initially bound ones if no extend yet)voidupdateExtends(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).voidupdateExtendsBasedOnDelta(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).
-
Constructor Details
-
PlanState
Creates an initial state
-
-
Method Details
-
cloneWithApplied
-
getEnforcedConstraints
-
updateExtends
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
Check operations that newly became applicable (seegetDeltaVariables()) 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
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
-
getOperations
-
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
-
getDeltaVariables
Contains only those variables that are added by the newest extend (or the initially bound ones if no extend yet)
-