V
- VariableT
- ValueC
- Assignment Contextpublic interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>
AssignmentContext
available
to the class.HasAssignmentContext
interface and the data will be wrapped by this class.
The HasAssignmentContext
will only contain a reference to this
assignment context, created by calling Model.createReference(HasAssignmentContext)
during its initialization. The assignment context can be than accessed by calling
Assignment.getAssignmentContext(AssignmentContextReference)
.AssignmentContextHolder
interface. For constraints, criteria, extensions, and
neighborhood selections an existing class implementing the context can be used, see
ConstraintWithContext
, AbstractCriterion
, ExtensionWithContext
,
and NeighbourSelectionWithContext
respectively.ConstraintWithContext
, only the method
createAssignmentContext(Assignment)
needs to be implemented and the
assignment context can be accessed within the constraint using the method
ConstraintWithContext.getContext(Assignment)
.AssignmentContextHolder
,
HasAssignmentContext
Modifier and Type | Method and Description |
---|---|
C |
createAssignmentContext(Assignment<V,T> assignment)
Create a new assignment context for the given assignment.
|
AssignmentContextReference<V,T,C> |
getAssignmentContextReference()
Returns an assignment context reference
|
C |
getContext(Assignment<V,T> assignment)
Returns an assignment context associated with this object.
|
void |
setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)
Store an assignment context reference that was given for the class by the
Model.createReference(HasAssignmentContext) . |
C createAssignmentContext(Assignment<V,T> assignment)
assignment
- an assignment for which there needs to be an assignment contextAssignmentContextReference<V,T,C> getAssignmentContextReference()
Model.createReference(HasAssignmentContext)
during initializationvoid setAssignmentContextReference(AssignmentContextReference<V,T,C> reference)
Model.createReference(HasAssignmentContext)
.reference
- reference provided by the model by calling Model.createReference(HasAssignmentContext)
during initializationC getContext(Assignment<V,T> assignment)
createAssignmentContext(Assignment)
method.assignment
- given assignment