|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.cpsolver.ifs.criteria.AbstractCriterion<V,T>
public abstract class AbstractCriterion<V extends Variable<V,T>,T extends Value<V,T>>
Abstract Criterion.
An optimization objective can be split into several (optimization) criteria
and modeled as a weighted sum of these. This makes the implementation of a particular problem
more versatile as it allows for an easier modification of the optimization objective.
This class implements most of the Criterion except of the Criterion.getValue(Value, Set).
| Nested Class Summary | |
|---|---|
protected static class |
AbstractCriterion.ValueUpdateType
Defines how the overall value of the criterion should be automatically updated (using Criterion.getValue(Value, Set)). |
| Field Summary | |
|---|---|
protected double |
iBest
|
protected boolean |
iDebug
|
protected double |
iValue
|
protected AbstractCriterion.ValueUpdateType |
iValueUpdateType
|
protected double |
iWeight
|
protected static DecimalFormat |
sDoubleFormat
|
protected static DecimalFormat |
sPercentFormat
|
| Constructor Summary | |
|---|---|
AbstractCriterion()
|
|
| Method Summary | |
|---|---|
void |
afterAssigned(long iteration,
T value)
Called after a value is assigned to its variable ( Value.variable()). |
void |
afterUnassigned(long iteration,
T value)
Called after a value is unassigned from its variable ( Value.variable()). |
void |
beforeAssigned(long iteration,
T value)
Called before a value is assigned to its variable ( Value.variable()). |
void |
beforeUnassigned(long iteration,
T value)
Called before a value is unassigned from its variable ( Value.variable()). |
void |
bestRestored()
Notification that the current solution has been restored from the best. |
void |
bestSaved()
Notification that the current solution has been saved to the best. |
protected void |
clearCache()
Clear bounds cache |
protected double[] |
computeBounds()
Compute bounds (bounds are being cached by default). |
void |
constraintAdded(Constraint<V,T> constraint)
Constraint is added to the model |
void |
constraintRemoved(Constraint<V,T> constraint)
Constraint is removed from the model |
double |
getBest()
Best value (value of the criterion in the best solution) |
double[] |
getBounds()
Bounds (minimum and maximum) estimate for the value |
double[] |
getBounds(Collection<V> variables)
Value bounds (minimum and maximum) of the criterion on a part of the problem |
void |
getInfo(Map<String,String> info)
Adds some information into the table with information about the solution |
void |
getInfo(Map<String,String> info,
Collection<V> variables)
Adds some information into the table with information about the solution, only consider variables from the given set |
Model<V,T> |
getModel()
Returns current model |
String |
getName()
Criterion name |
protected String |
getPerc(double value,
double min,
double max)
|
protected String |
getPercRev(double value,
double min,
double max)
|
double |
getValue()
Current value of the criterion (optimization objective) |
double |
getValue(Collection<V> variables)
Value of a part of the problem (given by the collection of variables) |
double |
getWeight()
Weight of the criterion |
double |
getWeightDefault(DataProperties config)
Defines default weight (when getWeightName() parameter is not present in the criterion). |
double |
getWeightedBest()
Weighted best value of the objective (value in the best solution). |
double |
getWeightedValue()
Weighted value of the objectives |
double |
getWeightedValue(Collection<V> variables)
Weighted value of a part of the problem (given by the collection of variables) |
double |
getWeightedValue(T value,
Set<T> conflicts)
Weighted value of a proposed assignment (including hard conflicts) |
String |
getWeightName()
Defines weight name (to be used to get the criterion weight from the configuration). |
void |
inc(double value)
Outside update of the criterion (usefull when the criterion is driven by a set of constraints). |
boolean |
init(Solver<V,T> solver)
Notification that the model was initialized by the solver. |
void |
variableAdded(V variable)
Variable is added to the model |
void |
variableRemoved(V variable)
Variable is removed from the model |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sf.cpsolver.ifs.criteria.Criterion |
|---|
getValue |
| Field Detail |
|---|
protected double iBest
protected double iValue
protected double iWeight
protected static DecimalFormat sDoubleFormat
protected static DecimalFormat sPercentFormat
protected boolean iDebug
protected AbstractCriterion.ValueUpdateType iValueUpdateType
| Constructor Detail |
|---|
public AbstractCriterion()
| Method Detail |
|---|
public String getWeightName()
public double getWeightDefault(DataProperties config)
getWeightName() parameter is not present in the criterion).
public boolean init(Solver<V,T> solver)
ModelListener
init in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>solver - IFS solverpublic Model<V,T> getModel()
public double getValue()
Criterion
getValue in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public double getBest()
Criterion
getBest in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public double getValue(Collection<V> variables)
Criterion
getValue in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public double getWeight()
Criterion
getWeight in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public double getWeightedBest()
Criterion
getWeightedBest in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public double getWeightedValue()
Criterion
getWeightedValue in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>
public double getWeightedValue(T value,
Set<T> conflicts)
Criterion
getWeightedValue in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public double getWeightedValue(Collection<V> variables)
Criterion
getWeightedValue in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>protected double[] computeBounds()
public double[] getBounds()
Criterion
getBounds in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public double[] getBounds(Collection<V> variables)
Criterion
getBounds in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>
public void beforeAssigned(long iteration,
T value)
ModelListenerValue.variable()).
beforeAssigned in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>iteration - current iterationvalue - value to be assigned
public void afterAssigned(long iteration,
T value)
ModelListenerValue.variable()).
afterAssigned in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>iteration - current iterationvalue - value to be assigned
public void beforeUnassigned(long iteration,
T value)
ModelListenerValue.variable()).
beforeUnassigned in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>iteration - current iterationvalue - value to be unassigned
public void afterUnassigned(long iteration,
T value)
ModelListenerValue.variable()).
afterUnassigned in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>iteration - current iterationvalue - value to be unassignedpublic void bestSaved()
Criterion
bestSaved in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public void bestRestored()
Criterion
bestRestored in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public void inc(double value)
Criterion
inc in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>public String getName()
Criterion
getName in interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>protected void clearCache()
public void variableAdded(V variable)
ModelListener
variableAdded in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>variable - added variablepublic void variableRemoved(V variable)
ModelListener
variableRemoved in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>variable - removed variablepublic void constraintAdded(Constraint<V,T> constraint)
ModelListener
constraintAdded in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>constraint - added constraintpublic void constraintRemoved(Constraint<V,T> constraint)
ModelListener
constraintRemoved in interface ModelListener<V extends Variable<V,T>,T extends Value<V,T>>constraint - removed constraint
protected String getPerc(double value,
double min,
double max)
protected String getPercRev(double value,
double min,
double max)
public void getInfo(Map<String,String> info)
InfoProvider
getInfo in interface InfoProvider<V extends Variable<V,T>>
public void getInfo(Map<String,String> info,
Collection<V> variables)
InfoProvider
getInfo in interface InfoProvider<V extends Variable<V,T>>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||