com.sun.slamd.job
Class OptimizationAlgorithm

java.lang.Object
  extended bycom.sun.slamd.job.OptimizationAlgorithm
Direct Known Subclasses:
SingleStatisticOptimizationAlgorithm, SingleStatisticWithConstraintOptimizationAlgorithm, SingleStatisticWithCPUUtilizationOptimizationAlgorithm, SingleStatisticWithReplicationLatencyOptimizationAlgorithm

public abstract class OptimizationAlgorithm
extends java.lang.Object

This class defines an abstract optimization algorithm, which can be used to determine how an optimizing job should proceed. In particular, an optimization algorithm defines a number of user-specified parameters that can be used to customize the way that it operates, and then implements the logic to determine whether each iteration of an optimizing job has performed better than all previous iterations based on the user-defined constraints.


Constructor Summary
OptimizationAlgorithm()
          Creates a new instance of this optimization algorithm.
 
Method Summary
abstract  boolean availableWithJobClass(JobClass jobClass)
          Indicates whether this optimization algorithm may be used when running the specified type of job.
abstract  double getIterationOptimizationValue(Job iteration)
          Retrieves the value associated with the provided iteration of the given optimizing job.
abstract  java.lang.String getOptimizationAlgorithmName()
          Retrieves the human-readable name that will be used for this optimization algorithm.
abstract  ParameterList getOptimizationAlgorithmParameters()
          Retrieves the set of parameters that have been defined for this optimization algorithm.
abstract  ParameterList getOptimizationAlgorithmParameterStubs(JobClass jobClass)
          Retrieves a set of parameter stubs that should be used to prompt the end user for the settings to use when executing the optimizing job.
abstract  void initializeOptimizationAlgorithm(OptimizingJob optimizingJob, ParameterList parameters)
          Initializes this optimization algorithm with the provided set of parameters for the given optimizing job.
abstract  boolean isBestIterationSoFar(Job iteration)
          Indicates whether the provided iteration is the best one seen so far for the given optimizing job based on the constraints specified in the parameters used to initialize this optimization algorithm.
abstract  OptimizationAlgorithm newInstance()
          Creates a new, uninitialized instance of this optimization algorithm.
abstract  void reInitializeOptimizationAlgorithm()
          Clears any state information currently set for this optimization algorithm and restores it to the state it would have if a new instance had been created and only the initializeOptimizationAlgorithm() method had been called on that instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimizationAlgorithm

public OptimizationAlgorithm()
Creates a new instance of this optimization algorithm. All subclasses must define a constructor that does not take any arguments, and they must invoke the constructor of this superclass as their first action.

Method Detail

getOptimizationAlgorithmName

public abstract java.lang.String getOptimizationAlgorithmName()
Retrieves the human-readable name that will be used for this optimization algorithm.


newInstance

public abstract OptimizationAlgorithm newInstance()
Creates a new, uninitialized instance of this optimization algorithm. In most cases, this should simply return the object created from invoking the default constructor.


availableWithJobClass

public abstract boolean availableWithJobClass(JobClass jobClass)
Indicates whether this optimization algorithm may be used when running the specified type of job.

Parameters:
jobClass - The job class for which to make the determination.
Returns:
true if this optimization algorithm may be used with the provided job class, or false if not.

getOptimizationAlgorithmParameterStubs

public abstract ParameterList getOptimizationAlgorithmParameterStubs(JobClass jobClass)
Retrieves a set of parameter stubs that should be used to prompt the end user for the settings to use when executing the optimizing job.

Parameters:
jobClass - The job class that will be used for the optimizing job.
Returns:
A set of parameter stubs that should be used to prompt the end user for the settings to use when executing the optimizing job.

getOptimizationAlgorithmParameters

public abstract ParameterList getOptimizationAlgorithmParameters()
Retrieves the set of parameters that have been defined for this optimization algorithm.

Returns:
The set of parameters that have been defined for this optimization algorithm.

initializeOptimizationAlgorithm

public abstract void initializeOptimizationAlgorithm(OptimizingJob optimizingJob,
                                                     ParameterList parameters)
                                              throws InvalidValueException
Initializes this optimization algorithm with the provided set of parameters for the given optimizing job.

Parameters:
optimizingJob - The optimizing job with which this optimization algorithm will be used.
parameters - The parameter list containing the parameter values provided by the end user when scheduling the optimizing job.
Throws:
InvalidValueException - If the contents of the provided parameter list are not valid for use with this optimization algorithm.

reInitializeOptimizationAlgorithm

public abstract void reInitializeOptimizationAlgorithm()
Clears any state information currently set for this optimization algorithm and restores it to the state it would have if a new instance had been created and only the initializeOptimizationAlgorithm() method had been called on that instance.


isBestIterationSoFar

public abstract boolean isBestIterationSoFar(Job iteration)
                                      throws SLAMDException
Indicates whether the provided iteration is the best one seen so far for the given optimizing job based on the constraints specified in the parameters used to initialize this optimization algorithm.

Parameters:
iteration - The job iteration for which to make the determination.
Returns:
true if the provided iteration is the best one seen so far for the optimizing job, or false if not.
Throws:
SLAMDException - If a problem occurs that prevents a valid determination from being made. If this exception is thrown, then the optimizing job will stop immediately with no further iterations.

getIterationOptimizationValue

public abstract double getIterationOptimizationValue(Job iteration)
                                              throws SLAMDException
Retrieves the value associated with the provided iteration of the given optimizing job.

Parameters:
iteration - The job iteration for which to retrieve the value.
Returns:
The value associated with the provided iteration of the given optimizing job.
Throws:
SLAMDException - If a problem occurs while trying to determine the value for the given optimizing job iteration.