public class PlanState
extends java.lang.Object
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 and Description |
---|
PlanState(PBody pBody,
java.util.Set<PVariable> boundVariables)
Creates an initial state
|
Modifier and Type | Method and Description |
---|---|
void |
applyChecks(java.util.List<PConstraintInfo> allPotentialCheckInfos)
Check operations that newly became applicable (see
getDeltaVariables() )
are appended to operations lists. |
void |
applyChecksBasedOnDelta(java.util.Map<PVariable,java.util.List<PConstraintInfo>> checkOpsByVariables)
Immediately applicable checks are appended to operations lists.
|
PlanState |
cloneWithApplied(PConstraintInfo op) |
PBody |
getAssociatedPBody() |
java.util.Set<PVariable> |
getBoundVariables() |
double |
getCost() |
double |
getCummulativeProduct() |
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)
|
java.util.Set<PConstraint> |
getEnforcedConstraints() |
java.util.List<PConstraintInfo> |
getOperations() |
java.util.List<PConstraintInfo> |
getPresentExtends() |
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).
|
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).
|
public PlanState cloneWithApplied(PConstraintInfo op)
public java.util.Set<PConstraint> getEnforcedConstraints()
public void updateExtends(java.lang.Iterable<PConstraintInfo> allPotentialExtendInfos)
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)public void updateExtendsBasedOnDelta(java.lang.Iterable<PConstraintInfo> previousPresentExtends, java.util.Map<PVariable,? extends java.util.Collection<PConstraintInfo>> extendOpsByBoundVariables)
extendOpsByBoundVariables
- all EXTEND operations indexed by affected bound variables
MUST consist of "extend" constraint applications only (at least one free variable)public void applyChecks(java.util.List<PConstraintInfo> allPotentialCheckInfos)
getDeltaVariables()
)
are appended to operations lists.
Will never discover degenerate checks (of PConstraints with zero variables), so must not use on initial state.
allPotentialCheckInfos
- all CHECK operations
MUST consist of "check" constraint applications only (no free variables)
and must be iterable in decreasing order of costpublic void applyChecksBasedOnDelta(java.util.Map<PVariable,java.util.List<PConstraintInfo>> checkOpsByVariables)
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 costpublic PBody getAssociatedPBody()
public java.util.List<PConstraintInfo> getOperations()
public java.util.Set<PVariable> getBoundVariables()
public double getCost()
public double getCummulativeProduct()
public java.util.List<PConstraintInfo> getPresentExtends()
public java.util.Collection<PVariable> getDeltaVariables()