edu.indiana.iucbrf.adaptation
Class WeightedAverageAdapter
java.lang.Object
edu.indiana.iucbrf.adaptation.Adaptation
edu.indiana.iucbrf.adaptation.WeightedAverageAdapter
- All Implemented Interfaces:
- java.io.Serializable
public class WeightedAverageAdapter
- extends Adaptation
WeightedAverageAdapter finds a solution to the new problem by taking
the average of the suggested solution of each retrieved case, giving
each retrieved case importance in the average based on the weightings
provided to the object's constructor. It is assumed that the Solution class
used defines the doubleValue() method.
If weights are not specified for all retrieved cases, then the weight is defined as 0 for the worst cases.
If more weights are specified than cases are retrieved, then the extra weights are ignored.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WeightedAverageAdapter
public WeightedAverageAdapter()
- Construct a WeightedAverageAdapter without specifying the weights. The weights must
be specified with setWeights() before the adapter is used.
WeightedAverageAdapter
public WeightedAverageAdapter(double[] wts)
- Creates new WeightedAverageAdapter
- Parameters:
Wts
- An array of doubles, of weights to be used by the average adapter.
WeightedAverageAdapter
public WeightedAverageAdapter(double[] wts,
boolean debugMode)
- Creates new WeightedAverageAdapter
- Parameters:
Wts
- An array of doubles, of weights to be used by the average adapter.debugMode
- Set to true to print debugging information, false otherwise.
adaptTo
public Solution adaptTo(RetrievalResults retrieved,
Problem currentProblem,
Domain domain)
- Adapt retrieved solutions by taking a weighted average.
- Specified by:
adaptTo
in class Adaptation
- Parameters:
Retrieved
- A RetrievalResults of Case objects deemed relevant to this problemCurrentProblem
- The Problem object being adapted to. In this implementation, this parameter is ignored.
- Returns:
- A Solution object of the adapted solution.