V
- VariableT
- Valuepublic class DefaultPerturbationsCounter<V extends Variable<V,T>,T extends Value<V,T>> extends Object implements PerturbationsCounter<V,T>
getPenalty(Assignment, Value, Value)
. Its current
implementation is:
protected double getPenalty(Value assignedValue, Value initialValue) {
return 1.0;
}
It is called only when assignedValue is different to initialValue.Solver
,
Solution
,
Variable
Modifier and Type | Field and Description |
---|---|
protected static DecimalFormat |
sDoubleFormat |
Constructor and Description |
---|
DefaultPerturbationsCounter(DataProperties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
getInfo(Assignment<V,T> assignment,
Model<V,T> model,
Map<String,String> info)
Some (perturbation) information about the solution might be returned
here.
|
void |
getInfo(Assignment<V,T> assignment,
Model<V,T> model,
Map<String,String> info,
Collection<V> variables)
Some (perturbation) information about the solution might be returned here
(only include variables from the given set).
|
protected double |
getPenalty(Assignment<V,T> assignment,
T assignedValue,
T initialValue)
Computes perturbation penalty between assigned and initial value of the
same lecture.
|
protected double |
getPenaltyA(Assignment<V,T> assignment,
T selectedValue,
T initialValue)
Case A: initial value of a different unassigned variable cannot be
assigned (computed by
ViolatedInitials ) |
protected double |
getPenaltyB(Assignment<V,T> assignment,
T selectedValue,
T assignedValue,
T initialValue)
Case B: initial value is unassigned from a conflicting variable.
|
protected double |
getPenaltyC(Assignment<V,T> assignment,
T selectedValue,
T assignedValue,
T initialValue)
Case C: non-initial value is unassigned from a conflicting variable.
|
protected double |
getPenaltyD(Assignment<V,T> assignment,
T selectedValue,
T initialValue)
Case D: different than initial value is assigned to the variable
|
double |
getPerturbationPenalty(Assignment<V,T> assignment,
Model<V,T> model)
Returns perturbation penalty, i.e., the distance between current solution
and the solution of the initial problem (see
Variable.getInitialAssignment() ). |
double |
getPerturbationPenalty(Assignment<V,T> assignment,
Model<V,T> model,
Collection<V> variables)
Returns perturbation penalty, i.e., the distance between current solution
and the solution of the initial (only include variables from the given
set) problem (see
Variable.getInitialAssignment() ). |
double |
getPerturbationPenalty(Assignment<V,T> assignment,
Model<V,T> model,
T selectedValue,
Collection<T> conflicts)
Returns perturbation penalty of the solution which become from the
current solution when given conflicting values are unassigned and the
selected value is assigned.
|
protected ViolatedInitials<V,T> |
getViolatedInitials() |
void |
init(Solver<V,T> solver)
Initialization
|
protected static DecimalFormat sDoubleFormat
public DefaultPerturbationsCounter(DataProperties properties)
properties
- input configurationpublic double getPerturbationPenalty(Assignment<V,T> assignment, Model<V,T> model)
PerturbationsCounter
Variable.getInitialAssignment()
).getPerturbationPenalty
in interface PerturbationsCounter<V extends Variable<V,T>,T extends Value<V,T>>
assignment
- current assignmentmodel
- current modelpublic double getPerturbationPenalty(Assignment<V,T> assignment, Model<V,T> model, Collection<V> variables)
PerturbationsCounter
Variable.getInitialAssignment()
).getPerturbationPenalty
in interface PerturbationsCounter<V extends Variable<V,T>,T extends Value<V,T>>
assignment
- current assignmentmodel
- current modelvariables
- sub-problemprotected ViolatedInitials<V,T> getViolatedInitials()
protected double getPenalty(Assignment<V,T> assignment, T assignedValue, T initialValue)
assignment
- current assignmentassignedValue
- value assigned to a varuable (null when variable is
unassigned)initialValue
- initial value of the same varaible (always not null)protected double getPenaltyA(Assignment<V,T> assignment, T selectedValue, T initialValue)
ViolatedInitials
)assignment
- current assignmentselectedValue
- value which is going to be assigned to its variableinitialValue
- value of a different variable, which is currently assigned but
which need to be unassifned Different variable, which is
unassigned and whose initial value is in conflict with the
selected value.protected double getPenaltyB(Assignment<V,T> assignment, T selectedValue, T assignedValue, T initialValue)
assignment
- current assignmentselectedValue
- value which is going to be unassigned to its variableassignedValue
- value currently assigned to a conflicting variable (different
from the one of selectedVariable)initialValue
- initial value of the conflicting variable of assignedValueprotected double getPenaltyC(Assignment<V,T> assignment, T selectedValue, T assignedValue, T initialValue)
assignment
- current assignmentselectedValue
- value which is going to be unassigned to its variableassignedValue
- value currently assigned to a conflicting variable (different
from the one of selectedVariable)initialValue
- initial value of the conflicting variable of assignedValueprotected double getPenaltyD(Assignment<V,T> assignment, T selectedValue, T initialValue)
assignment
- current assignmentselectedValue
- value which is going to be unassigned to its variableinitialValue
- initial value of the same variablepublic double getPerturbationPenalty(Assignment<V,T> assignment, Model<V,T> model, T selectedValue, Collection<T> conflicts)
PerturbationsCounter
getPerturbationPenalty
in interface PerturbationsCounter<V extends Variable<V,T>,T extends Value<V,T>>
assignment
- current assignmentmodel
- current modelselectedValue
- value to be selected in the next iterationconflicts
- conflicting values to be unassigned in the next iterationpublic void getInfo(Assignment<V,T> assignment, Model<V,T> model, Map<String,String> info)
PerturbationsCounter
public void getInfo(Assignment<V,T> assignment, Model<V,T> model, Map<String,String> info, Collection<V> variables)
PerturbationsCounter