V
- VariableT
- ValueC
- Assignment Contextpublic abstract class NeighbourSelectionWithContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext> extends Object implements NeighbourSelection<V,T>, HasAssignmentContext<V,T,C>, CanHoldContext
AssignmentContext
interface). This context is created by calling
HasAssignmentContext.createAssignmentContext(Assignment)
and accessed by
ConstraintWithContext.getContext(Assignment)
.AssignmentContext
Modifier and Type | Field and Description |
---|---|
protected C |
iContextOverride |
sMaxSize
Constructor and Description |
---|
NeighbourSelectionWithContext() |
Modifier and Type | Method and Description |
---|---|
AssignmentContextReference<V,T,C> |
getAssignmentContextReference()
Returns an assignment context reference
|
AssignmentContext[] |
getContext()
An array of
CanHoldContext.sMaxSize assignment contexts |
C |
getContext(Assignment<V,T> assignment)
Returns an assignment context associated with this selection.
|
boolean |
hasContextOverride()
Has context override
|
void |
init(Solver<V,T> solver)
Criterion initialization
|
protected boolean |
isSingleContextSolver(Solver<V,T> solver)
Returns true if there should be only one context for this neighbourhood selection.
|
void |
setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)
Store an assignment context reference that was given for the class by the
Model.createReference(HasAssignmentContext) . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
selectNeighbour
createAssignmentContext
protected C extends AssignmentContext iContextOverride
public NeighbourSelectionWithContext()
public void init(Solver<V,T> solver)
NeighbourSelection
protected boolean isSingleContextSolver(Solver<V,T> solver)
solver
- current solverSolver.hasSingleSolution()
public C getContext(Assignment<V,T> assignment)
HasAssignmentContext.createAssignmentContext(Assignment)
method. From that time on,
this context is kept with the assignment.getContext
in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>
assignment
- given assignmentpublic AssignmentContextReference<V,T,C> getAssignmentContextReference()
HasAssignmentContext
getAssignmentContextReference
in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>
Model.createReference(HasAssignmentContext)
during initializationpublic void setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)
HasAssignmentContext
Model.createReference(HasAssignmentContext)
.setAssignmentContextReference
in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>
reference
- reference provided by the model by calling Model.createReference(HasAssignmentContext)
during initializationpublic AssignmentContext[] getContext()
CanHoldContext
CanHoldContext.sMaxSize
assignment contextsgetContext
in interface CanHoldContext
public boolean hasContextOverride()