|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.cpsolver.ifs.perturbations.DefaultPerturbationsCounter
public class DefaultPerturbationsCounter
Default computation of perturbation penalty (minimal perturbation problem).
A distance function can be defined with the help of perturbations. A perturbation is a variable that has a different
value in the solutions of the initial and the new problem. Some perturbations must be present in each new solution.
So called input perturbation means that a variable must have different values in the initial and changed problem
because of some input changes (e.g., a course must be scheduled at a different time in the changed problem).
The distance function can be defined as the number of additional perturbations. They are given by subtraction of
the final number of perturbations and the number of input perturbations (variables without initial assignments).
This implementation is easily extendable. It disassemble all the available cases into a comparison of the initial and
the assigned value different each other. So, the only method which is needed to be changed is
getPenalty(Value, Value)
. Its current implementation is:
protected double getPenalty(Value assignedValue, Value initialValue) {
return 1.0;
}
Solver
,
Solution
,
Variable
Field Summary | |
---|---|
protected static DecimalFormat |
sDoubleFormat
|
Constructor Summary | |
---|---|
DefaultPerturbationsCounter(DataProperties properties)
Constructor |
Method Summary | |
---|---|
void |
getInfo(Dictionary info,
Model model)
Some (perturbation) information about the solution might be returned here. |
void |
getInfo(Dictionary info,
Model model,
Vector variables)
Some (perturbation) information about the solution might be returned here (only include variables from the given set). |
protected double |
getPenalty(Value assignedValue,
Value initialValue)
Computes perturbation penalty between assigned and initial value of the same lecture. |
protected double |
getPenaltyA(Value selectedValue,
Value initialValue)
Case A: initial value of a different unassigned variable cannot be assigned (computed by ViolatedInitials ) |
protected double |
getPenaltyB(Value selectedValue,
Value assignedValue,
Value initialValue)
Case B: initial value is unassigned from a conflicting variable. |
protected double |
getPenaltyC(Value selectedValue,
Value assignedValue,
Value initialValue)
Case C: non-initial value is unassigned from a conflicting variable. |
protected double |
getPenaltyD(Value selectedValue,
Value initialValue)
Case D: different than initial value is assigned to the varaible |
double |
getPerturbationPenalty(Model model)
Returns perturbation penalty, i.e., the distance between current solution and the solution of the initial problem (see Variable.getInitialAssignment() ). |
double |
getPerturbationPenalty(Model model,
Value selectedValue,
Collection 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. |
double |
getPerturbationPenalty(Model model,
Vector 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() ). |
protected ViolatedInitials |
getViolatedInitials()
|
void |
init(Solver solver)
Initialization |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static DecimalFormat sDoubleFormat
Constructor Detail |
---|
public DefaultPerturbationsCounter(DataProperties properties)
properties
- input configurationMethod Detail |
---|
public void init(Solver solver)
init
in interface PerturbationsCounter
public double getPerturbationPenalty(Model model)
PerturbationsCounter
Variable.getInitialAssignment()
).
getPerturbationPenalty
in interface PerturbationsCounter
model
- current modelpublic double getPerturbationPenalty(Model model, Vector variables)
PerturbationsCounter
Variable.getInitialAssignment()
).
getPerturbationPenalty
in interface PerturbationsCounter
model
- current modelprotected ViolatedInitials getViolatedInitials()
protected double getPenalty(Value assignedValue, Value initialValue)
assignedValue
- value assigned to a varuable (null when variable is unassigned)initialValue
- initial value of the same varaible (always not null)protected double getPenaltyA(Value selectedValue, Value initialValue)
ViolatedInitials
)
selectedValue
- 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(Value selectedValue, Value assignedValue, Value initialValue)
selectedValue
- 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(Value selectedValue, Value assignedValue, Value initialValue)
selectedValue
- 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(Value selectedValue, Value initialValue)
selectedValue
- value which is going to be unassigned to its variableinitialValue
- initial value of the same variablepublic double getPerturbationPenalty(Model model, Value selectedValue, Collection conflicts)
PerturbationsCounter
getPerturbationPenalty
in interface PerturbationsCounter
model
- current modelselectedValue
- value to be selected in the next iterationconflicts
- conflicting values to be unassigned in the next iterationpublic void getInfo(Dictionary info, Model model)
PerturbationsCounter
getInfo
in interface PerturbationsCounter
info
- resultant info tablemodel
- current modelpublic void getInfo(Dictionary info, Model model, Vector variables)
PerturbationsCounter
getInfo
in interface PerturbationsCounter
info
- resultant info tablemodel
- current model
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |