| java.lang.Object org.cougaar.planning.ldm.plan.ScoringFunction
All known Subclasses: org.cougaar.lib.util.UTILEndDateScoringFunction, org.cougaar.glm.util.GLMLocationScoringFunction,
ScoringFunction | abstract public class ScoringFunction implements Serializable,Cloneable(Code) | | Base class for functions which compute a Score value given an AspectValue.
Score is a double where LOW_THRESHOLD (0.0) is "good"/"optimal" and
HIGH_THRESHOLD (1.0) is "bad" (as bad as it gets). ScoringFunction domains
should be infinite and Range should be 0.0 to 1.0 inclusive.
|
Inner Class :public static class PiecewiseLinearScoringFunction extends ScoringFunction | |
Inner Class :abstract public static class SinglePointScoringFunction extends ScoringFunction | |
Inner Class :public static class StrictValueScoringFunction extends SinglePointScoringFunction | |
Inner Class :public static class PreferredValueScoringFunction extends SinglePointScoringFunction | |
Inner Class :abstract public static class TwoPointScoringFunction extends ScoringFunction | |
Inner Class :public static class VScoringFunction extends TwoPointScoringFunction | |
Inner Class :public static class StrictBetweenScoringFunction extends TwoPointScoringFunction | |
Inner Class :public static class StrictBetweenWithBest extends StrictBetweenScoringFunction | |
Inner Class :public static class PreferredBetweenScoringFunction extends TwoPointScoringFunction | |
Inner Class :public static class AboveScoringFunction extends SinglePointScoringFunction | |
Inner Class :public static class BelowScoringFunction extends SinglePointScoringFunction | |
Inner Class :public static class StepScoringFunction extends SinglePointScoringFunction | |
Inner Class :public static class EnumeratedScoringFunction extends ScoringFunction | |
Inner Class :public static class ConstantScoringFunction extends ScoringFunction | |
Field Summary | |
final public static double | BEST | final public static double | HIGH_THRESHOLD | final public static double | LOW_THRESHOLD | final public static double | NOVALUE A Value to be used when the Score is undefined, equivalent to Double.NaN. | final public static double | OK | final public static double | WORST | protected int | aspectType |
Method Summary | |
final static double | _interpY(double px, double x1, double y1, double x2, double y2) interpolate a Y given an X and a line segment. | final AspectScorePoint | _maxY(double minx, double maxx, double x1, double y1, double x2, double y2) return an AspectScorePoint for the maximum y of the segment
((x1,y1) (x2, y2)) in the range of minx-maxx. | final AspectScorePoint | _minY(double minx, double maxx, double x1, double y1, double x2, double y2) return an AspectScorePoint for the minimum y of the segment
((x1,y1) (x2, y2)) in the range of minx-maxx. | final public static void | checkValidCurve(AspectScorePoint[] curve) Check a set of AspectScorePoints for validity as the "curve" of
PiecewiseLinearScoringFunction. | abstract public Object | clone() | final public static ScoringFunction | createConstantScoringFunction(double score, int type) | final public static ScoringFunction | createConstantScoringFunction(AspectScorePoint score) | final public static ScoringFunction | createEnumerated(AspectScorePoint[] points) Select specific enumerated points where score is allowed :
disallowed (above threshold) at all other points. | final public static ScoringFunction | createNearOrAbove(AspectValue value, double slope) Prefer as close as possible to value from above
The score at the inflection point is BEST
Parameters: value - The point. | final public static ScoringFunction | createNearOrBelow(AspectValue value, double slope) Prefer as close as possible to value from below
The score at the inflection point is BEST;
Parameters: value - The point. | final public static ScoringFunction | createPiecewiseLinearScoringFunction(Enumeration points) | final public static ScoringFunction | createPiecewiseLinearScoringFunction(AspectScorePoint[] points) Create a ScoringFunction from a set of AspectScorePoints. | final public static ScoringFunction | createPreferredAtValue(AspectValue value, double slope) A single point with slanted sides in score space
Parameters: value - The single point. | final public static ScoringFunction | createPreferredBetweenValues(AspectValue low, AspectValue high, double slope) A flat basin with slanted sides
Parameters: low - The low point. Parameters: high - The high point. | final public static ScoringFunction | createStepScoringFunction(AspectValue changepoint, double prescore, double postscore) | final public static ScoringFunction | createStrictlyAtValue(AspectValue value) A single point with straight sides in score space
Parameters: value - The single point. | final public static ScoringFunction | createStrictlyBetweenValues(AspectValue low, AspectValue high) A flat basin with straight sides.
BEST defaults to low point.
Parameters: low - The low point. Parameters: high - The high point. | final public static ScoringFunction | createStrictlyBetweenWithBestValues(AspectValue low, AspectValue best, AspectValue high) A flat basin with straight sides.
Just like StrictBetweenScoringFunction, except
that BEST point is specified, even though the
Scores of low, best and high are all actually the same.
Parameters: low - The low point. Parameters: best - The preferred point. Parameters: high - The high point. | final public static ScoringFunction | createVScoringFunction(AspectValue low, AspectValue best, AspectValue high) A typical V-shaped scoring function.
low and high values are OK, best is BEST,
score is linear betwen low and best, best and high.
anything outside the range is WORST.
The best point need not be centered between low and high.
Parameters: low - The low point. Parameters: best - The best point. Parameters: high - The high point. | final public static ScoringFunction | createVScoringFunction(AspectValue low, AspectValue best, AspectValue high, double ok) like createVScoringFunction(low,best,high) except allows specification
of value of OK value. | abstract public AspectScorePoint | getBest() Find the/a "Best" value of the function. | public AspectScoreRange | getDefinedRange() | abstract public AspectScorePoint | getMaxInRange(AspectValue lowerbound, AspectValue upperbound) Find the/a "Worst" value within a range. | abstract public AspectScorePoint | getMinInRange(AspectValue lowerbound, AspectValue upperbound) Find the/a "Best" value within a range. | abstract public double | getScore(AspectValue value) Find the Score at a point. | abstract public Enumeration | getValidRanges(AspectValue lowerbound, AspectValue upperbound) Find all non-1.0 (worst) value ranges within boundaries. | public static void | main(String[] args) | final protected static AspectScorePoint | newASP(double value, double score, int type) |
BEST | final public static double BEST(Code) | | "Best" Score *
|
HIGH_THRESHOLD | final public static double HIGH_THRESHOLD(Code) | | Maximum valid value *
|
LOW_THRESHOLD | final public static double LOW_THRESHOLD(Code) | | Minimum valid value *
|
NOVALUE | final public static double NOVALUE(Code) | | A Value to be used when the Score is undefined, equivalent to Double.NaN.
|
OK | final public static double OK(Code) | | Typical "Satisfactory" value *
|
WORST | final public static double WORST(Code) | | "Worst" Score *
|
aspectType | protected int aspectType(Code) | | |
ScoringFunction | protected ScoringFunction(int type)(Code) | | |
_interpY | final static double _interpY(double px, double x1, double y1, double x2, double y2)(Code) | | interpolate a Y given an X and a line segment. px must be in
the range.
|
_maxY | final AspectScorePoint _maxY(double minx, double maxx, double x1, double y1, double x2, double y2)(Code) | | return an AspectScorePoint for the maximum y of the segment
((x1,y1) (x2, y2)) in the range of minx-maxx.
BEST if out of range. |
_minY | final AspectScorePoint _minY(double minx, double maxx, double x1, double y1, double x2, double y2)(Code) | | return an AspectScorePoint for the minimum y of the segment
((x1,y1) (x2, y2)) in the range of minx-maxx.
WORST if out of range. |
checkValidCurve | final public static void checkValidCurve(AspectScorePoint[] curve)(Code) | | Check a set of AspectScorePoints for validity as the "curve" of
PiecewiseLinearScoringFunction. Tests used are: must have at least 2 points,
all points must have the AspectType, values must be strictly increasing, scores
may not be negative.
throws: IllegalArgumentException - on illegal curve. |
createConstantScoringFunction | final public static ScoringFunction createConstantScoringFunction(double score, int type)(Code) | | Constant function
always has same score
Parameters: score - - the score for all values |
createConstantScoringFunction | final public static ScoringFunction createConstantScoringFunction(AspectScorePoint score)(Code) | | Constant function
always has same score
Parameters: score - - the score for all values |
createEnumerated | final public static ScoringFunction createEnumerated(AspectScorePoint[] points)(Code) | | Select specific enumerated points where score is allowed :
disallowed (above threshold) at all other points.
Note : The implementation ignores range, as enumerations have
no sense of comparison or continuity.
Parameters: points - array of AspectScorePoints of allowable points |
createNearOrAbove | final public static ScoringFunction createNearOrAbove(AspectValue value, double slope)(Code) | | Prefer as close as possible to value from above
The score at the inflection point is BEST
Parameters: value - The point. AboveScoringFunction |
createNearOrBelow | final public static ScoringFunction createNearOrBelow(AspectValue value, double slope)(Code) | | Prefer as close as possible to value from below
The score at the inflection point is BEST;
Parameters: value - The point. BelowScoringFunction |
createPiecewiseLinearScoringFunction | final public static ScoringFunction createPiecewiseLinearScoringFunction(Enumeration points)(Code) | | Create a ScoringFunction from a set of AspectScorePoints
Parameters: points - A set of AspectScorePoints which define the curve of the function. |
createPiecewiseLinearScoringFunction | final public static ScoringFunction createPiecewiseLinearScoringFunction(AspectScorePoint[] points)(Code) | | Create a ScoringFunction from a set of AspectScorePoints. The parameter will not be
copied, so the points must never be modified.
Parameters: points - A set of AspectScorePoints which define the curve of the function. |
createPreferredAtValue | final public static ScoringFunction createPreferredAtValue(AspectValue value, double slope)(Code) | | A single point with slanted sides in score space
Parameters: value - The single point. PreferredValueScoringFunction |
createPreferredBetweenValues | final public static ScoringFunction createPreferredBetweenValues(AspectValue low, AspectValue high, double slope)(Code) | | A flat basin with slanted sides
Parameters: low - The low point. Parameters: high - The high point. PreferredBetweenScoringFunction |
createStepScoringFunction | final public static ScoringFunction createStepScoringFunction(AspectValue changepoint, double prescore, double postscore)(Code) | | Step function
The score exactly at the inflection point is BEST
Parameters: changepoint - Parameters: prescore - Parameters: postscore - |
createStrictlyAtValue | final public static ScoringFunction createStrictlyAtValue(AspectValue value)(Code) | | A single point with straight sides in score space
Parameters: value - The single point. StrictValueScoringFunction |
createStrictlyBetweenValues | final public static ScoringFunction createStrictlyBetweenValues(AspectValue low, AspectValue high)(Code) | | A flat basin with straight sides.
BEST defaults to low point.
Parameters: low - The low point. Parameters: high - The high point. StrictBetweenScoringFunction |
createStrictlyBetweenWithBestValues | final public static ScoringFunction createStrictlyBetweenWithBestValues(AspectValue low, AspectValue best, AspectValue high)(Code) | | A flat basin with straight sides.
Just like StrictBetweenScoringFunction, except
that BEST point is specified, even though the
Scores of low, best and high are all actually the same.
Parameters: low - The low point. Parameters: best - The preferred point. Parameters: high - The high point. StrictBetweenWithBest |
createVScoringFunction | final public static ScoringFunction createVScoringFunction(AspectValue low, AspectValue best, AspectValue high)(Code) | | A typical V-shaped scoring function.
low and high values are OK, best is BEST,
score is linear betwen low and best, best and high.
anything outside the range is WORST.
The best point need not be centered between low and high.
Parameters: low - The low point. Parameters: best - The best point. Parameters: high - The high point. VScoringFunction |
getBest | abstract public AspectScorePoint getBest()(Code) | | Find the/a "Best" value of the function.
Can be used as a starting point for an allocator.
If not implemented, returns null.
AspectScorePoint May be null if uncomputable. |
getDefinedRange | public AspectScoreRange getDefinedRange()(Code) | | the range over which the scoring function is defined.Note that "undefined" == "undifferentiated WORST" score.Will always return a non-null value, but one or both values ofthe range may an AspectScorePoing infinity, indicating unbounded range.There may be any amount of score variation, including WORST pointswithin this range. |
getMaxInRange | abstract public AspectScorePoint getMaxInRange(AspectValue lowerbound, AspectValue upperbound)(Code) | | Find the/a "Worst" value within a range.
Specify AspectValue boundaries within the function and get the
maximum value within those boundaries.
If not implemented, returns null.
Parameters: lowerbound - Parameters: upperbound - AspectScorePoint May be null if uncomputable. |
getMinInRange | abstract public AspectScorePoint getMinInRange(AspectValue lowerbound, AspectValue upperbound)(Code) | | Find the/a "Best" value within a range.
Specify AspectValue boundaries within the function and get the
minimum value within those boundaries.
If not implemented, returns null.
Parameters: lowerbound - Parameters: upperbound - AspectScorePoint May be null if uncomputable. |
getValidRanges | abstract public Enumeration getValidRanges(AspectValue lowerbound, AspectValue upperbound)(Code) | | Find all non-1.0 (worst) value ranges within boundaries.
Specify AspectValue boundaries within the function and get the
the valid ranges of values within those boundaries.
If not implemented, returns null.
Parameters: lowerbound - Parameters: upperbound - Enumeration{AspectScoreRange} may be null if uncomputable. |
|
|