Operator.Operations
Class StatisticsCollectionOperation

java.lang.Object
  extended by Operator.Operations.StatisticsCollectionOperation
All Implemented Interfaces:
Operation, OutputI, ParameterI

public class StatisticsCollectionOperation
extends java.lang.Object
implements Operation, OutputI

Operation that collects statistics from the algorithm. Catches statistics from the run. Cathes statistics about the individuals.

Author:
erikhemberg

Field Summary
protected  java.lang.String fileName
           
protected  IndividualCatcher indCatch
           
protected  StatCatcher stats
           
 
Constructor Summary
StatisticsCollectionOperation(StatCatcher stats, IndividualCatcher indCatch)
          Creates a new instance of StatisticsCollectionOperation
StatisticsCollectionOperation(StatCatcher stats, IndividualCatcher indCatch, java.util.Properties p)
          Creates a new instance of StatisticsCollectionOperation
 
Method Summary
 void doOperation(Individual operand)
          Performs the operation on an operand
 void doOperation(java.util.List<Individual> operands)
          Store the time of the operation.
 IndividualCatcher getBest(java.util.List<Individual> operand)
          Return the best individual in the group
 IndividualCatcher getIndividualCatcher()
          Return IndividualCatcher for information retival.
 StatCatcher getStats()
          Return StatCatcher for information retival.
 void print(java.util.List<Individual> operand, boolean toFile)
          Print the statistics to file.
 void printHeader()
          Prints the header for statistics output
 void printStatistics(long time)
          Print stats for the current generation
 void printStats()
          Print the StatCatcher to file
 void setProperties(java.util.Properties p)
          Set properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stats

protected StatCatcher stats

indCatch

protected IndividualCatcher indCatch

fileName

protected java.lang.String fileName
Constructor Detail

StatisticsCollectionOperation

public StatisticsCollectionOperation(StatCatcher stats,
                                     IndividualCatcher indCatch)
Creates a new instance of StatisticsCollectionOperation

Parameters:
stats - statistics extraction
indCatch - indivudal information extraction

StatisticsCollectionOperation

public StatisticsCollectionOperation(StatCatcher stats,
                                     IndividualCatcher indCatch,
                                     java.util.Properties p)
Creates a new instance of StatisticsCollectionOperation

Parameters:
stats - statistics extraction
indCatch - indivudal information extraction
p - properties
Method Detail

printHeader

public void printHeader()
Prints the header for statistics output


printStatistics

public void printStatistics(long time)
Print stats for the current generation

Parameters:
time - time it took to run

setProperties

public void setProperties(java.util.Properties p)
Set properties

Specified by:
setProperties in interface ParameterI
Parameters:
p - object containing properties

doOperation

public void doOperation(Individual operand)
Description copied from interface: Operation
Performs the operation on an operand

Specified by:
doOperation in interface Operation
Parameters:
operand - operand to perform operation on

doOperation

public void doOperation(java.util.List<Individual> operands)
Store the time of the operation. Add statistics.

Specified by:
doOperation in interface Operation
Parameters:
operands - Individuals used for data derivation

getStats

public StatCatcher getStats()
Return StatCatcher for information retival.

Returns:
StatCatcher containing data about the run

getIndividualCatcher

public IndividualCatcher getIndividualCatcher()
Return IndividualCatcher for information retival.

Returns:
IndividualCatcher containing data about the run

print

public void print(java.util.List<Individual> operand,
                  boolean toFile)
Print the statistics to file. Add the operand to the IndividualStatistics and print to System.out

Specified by:
print in interface OutputI
Parameters:
operand - Individuals that will be printed
toFile - Boolean for printing to file

getBest

public IndividualCatcher getBest(java.util.List<Individual> operand)
Return the best individual in the group

Specified by:
getBest in interface OutputI
Parameters:
operand - Individuals that will be printed

printStats

public void printStats()
Print the StatCatcher to file