edu.indiana.iucbrf.adaptation
Class WeightedAverageAdapter

java.lang.Object
  extended by edu.indiana.iucbrf.adaptation.Adaptation
      extended by 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

Field Summary
 
Fields inherited from class edu.indiana.iucbrf.adaptation.Adaptation
debugMode, wts
 
Constructor Summary
WeightedAverageAdapter()
          Construct a WeightedAverageAdapter without specifying the weights.
WeightedAverageAdapter(double[] wts)
          Creates new WeightedAverageAdapter
WeightedAverageAdapter(double[] wts, boolean debugMode)
          Creates new WeightedAverageAdapter
 
Method Summary
 Solution adaptTo(RetrievalResults retrieved, Problem currentProblem, Domain domain)
          Adapt retrieved solutions by taking a weighted average.
 
Methods inherited from class edu.indiana.iucbrf.adaptation.Adaptation
setDebugMode, setWeights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.
Method Detail

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 problem
CurrentProblem - The Problem object being adapted to. In this implementation, this parameter is ignored.
Returns:
A Solution object of the adapted solution.