V - VariableT - Valuepublic interface Assignment<V extends Variable<V,T>,T extends Value<V,T>>
Model. This class decouples
an assignment of variables (classes extending Variable) to their values
(classes extending Value) from the Model. This is needed for
any kind of parallel computations, or in general, to be able to hold multiple
different assignments in memory.AssignmentContextReference to
AssignmentContext, so that each constraint, criterion, neighborhood selection
etc. can hold its own assignment dependent information. See ConstraintWithContext or
NeighbourSelectionWithContext for more details.Variable,
Value,
Model,
AssignmentContext| Modifier and Type | Method and Description |
|---|---|
T |
assign(long iteration,
T value)
Assign the given value to its variable.
|
Collection<T> |
assignedValues()
The list of assigned values in the assignment.
|
Collection<V> |
assignedVariables()
The list of assigned variables in the assignment.
|
<C extends AssignmentContext> |
clearContext(AssignmentContextReference<V,T,C> reference)
Clear an assignment context that is associated with the given a reference.
|
<C extends AssignmentContext> |
getAssignmentContext(AssignmentContextReference<V,T,C> reference)
Assignment context for a reference.
|
int |
getIndex()
Assignment index.
|
long |
getIteration(V variable)
Returns iteration of the last assignment.
|
T |
getValue(V variable)
Returns assignment of a variable, null if not assigned
Replacement for
Variable.getAssignment(). |
int |
nrAssignedVariables()
Number of assigned variables in this assignment.
|
int |
nrUnassignedVariables(Model<V,T> model)
Number of assigned variables in the assignment.
|
T |
unassign(long iteration,
V variable)
Unassign the given variable.
|
T |
unassign(long iteration,
V variable,
T value)
Unassign the given variable, but only if the current assignment differs from the given value.
|
Collection<V> |
unassignedVariables(Model<V,T> model)
The list of variables of the model that have no value in this assignment.
|
int getIndex()
T getValue(V variable)
Variable.getAssignment().variable - problem variablelong getIteration(V variable)
Variable.getLastIteration().variable - problem variableT assign(long iteration, T value)
Variable.assign(int, Value).iteration - current iterationvalue - a new value to be assigned to variable Value.variable().T unassign(long iteration, V variable)
Variable.unassign(int).iteration - current iterationvariable - variable to be unassignedT unassign(long iteration, V variable, T value)
Variable.unassign(int).iteration - current iterationvariable - variable to be unassignedvalue - target valueint nrAssignedVariables()
Model.nrAssignedVariables().Collection<V> assignedVariables()
getValue(Variable) is not null in this assignment.
Replacement for Model.assignedVariables().Collection<T> assignedValues()
getValue(Variable) for all assigned variables in this assignment.int nrUnassignedVariables(Model<V,T> model)
Model.nrUnassignedVariables().model - existing model (the assignment does not keep track about all existing variables, that is what the Model.variables() is for)Collection<V> unassignedVariables(Model<V,T> model)
getValue(Variable) is null in this assignment.
Replacement for Model.unassignedVariables()model - existing model (the assignment does not keep track about all existing variables, that is what the Model.variables() is for)<C extends AssignmentContext> C getAssignmentContext(AssignmentContextReference<V,T,C> reference)
ConstraintWithContext).C - assignment context typereference - a reference (which can be stored within the model, e.g., as an instance variable of a constraint)AssignmentContext<C extends AssignmentContext> void clearContext(AssignmentContextReference<V,T,C> reference)
C - assignment context typereference - a reference (which can be stored within the model, e.g., as an instance variable of a constraint)