edu.indiana.iucbrf.performancemonitor
Class PerformanceMonitor

java.lang.Object
  extended by edu.indiana.iucbrf.performancemonitor.PerformanceMonitor
All Implemented Interfaces:
java.io.Serializable

public class PerformanceMonitor
extends java.lang.Object
implements java.io.Serializable

This class handles monitoring of performance characteristics of the CBR system. The CBR designer can extend this class to monitor additional features of the system.

See Also:
Serialized Form

Field Summary
static int ADAPTATION_TIMER
           
protected  boolean debugMode
          Set to true to get diagnostic prints to screen.
static int RETRIEVAL_TIMER
           
 
Constructor Summary
PerformanceMonitor()
          Creates new SystemPerformance
PerformanceMonitor(boolean debugMode)
          Creates new SystemPerformance
 
Method Summary
 void beginClock(int timerCode)
          Begin the clock, for tracking the execution time of some operation.
 java.lang.String caseByCaseReport(CaseBase CB)
          Return a String of a performance report of each case in the case base.
 void endClock(int timerCode)
          End the clock, for tracking the execution time of some operation.
 double getAverageAdaptationTime()
          Get the average adaptation time for this CBR system.
 double getAverageRetrievalTime()
          Get the average retrieval time for this CBR system.
 double getAverageSolutionQualityRating()
          Get the average solution quality rating for this CBR system.
 double getProblemCount()
          Get the number of problems that have been posed to the system associated with this monitor.
 double getSolvedWellPercentage()
          Get the percentage of problems that were solved well, according to the domain-dependent implementation of PerformanceMonitor.determineSolutionQuality().
 double getSystemAge()
          Get the age of the CBR system associated with this monitor.
 double getSystemCompetenceRating()
          Get the competence rating for this CBR system.
 double getSystemConsistencyRating()
          Get the consistency rating for this CBR system.
 void performanceReport(java.lang.String title)
          Open a new window with a performance report for the system with this performance monitor.
 void performanceReport(java.lang.String title, CaseBase CB)
          Open a new window with a performance report for the system with the given case base and this performance monitor.
 void resetMonitorData(CaseBase CB)
          Resets all monitor data, for all cases and the case base as a whole.
 java.lang.String textReport(java.lang.String title, CaseBase cb)
           
 void updateCaseBaseStatus(RetrievalResults retrieved, SolutionQuality quality)
          Update the status of the CBR system monitors, according to the results of adapting the retrieved cases and finding a quality on a Solution, based on PerformanceMonitor.determineSolutionQuality().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RETRIEVAL_TIMER

public static final int RETRIEVAL_TIMER
See Also:
Constant Field Values

ADAPTATION_TIMER

public static final int ADAPTATION_TIMER
See Also:
Constant Field Values

debugMode

protected final boolean debugMode
Set to true to get diagnostic prints to screen. Otherwise set to false.

Constructor Detail

PerformanceMonitor

public PerformanceMonitor()
Creates new SystemPerformance


PerformanceMonitor

public PerformanceMonitor(boolean debugMode)
Creates new SystemPerformance

Parameters:
debugMode - Set to true to get diagnostic prints to screen. Otherwise set to false.
Method Detail

updateCaseBaseStatus

public void updateCaseBaseStatus(RetrievalResults retrieved,
                                 SolutionQuality quality)
Update the status of the CBR system monitors, according to the results of adapting the retrieved cases and finding a quality on a Solution, based on PerformanceMonitor.determineSolutionQuality(). This involves updating the counts of the case base and each individual case retrieved.

Parameters:
retrieved - The cases that were retrieved, and hence, whose monitor components will be updated.
quality - The quality, according to PerformanceMonitor.determineSolutionQuality(), of the solution obtained by adapting the retrieved cases.

resetMonitorData

public void resetMonitorData(CaseBase CB)
Resets all monitor data, for all cases and the case base as a whole.


beginClock

public void beginClock(int timerCode)
Begin the clock, for tracking the execution time of some operation. The operation that is beginning is indicated by timerCode. Valid values for timerCode include constants such as PerformanceMonitor.RETRIEVAL_TIMER and PerformanceMonitor.ADAPTATION_TIMER.


endClock

public void endClock(int timerCode)
End the clock, for tracking the execution time of some operation. The operation that is ending is indicated by timerCode. Valid values for timerCode include constants such as PerformanceMonitor.RETRIEVAL_TIMER and PerformanceMonitor.ADAPTATION_TIMER.


textReport

public java.lang.String textReport(java.lang.String title,
                                   CaseBase cb)

performanceReport

public void performanceReport(java.lang.String title,
                              CaseBase CB)
Open a new window with a performance report for the system with the given case base and this performance monitor. This window shows basic performance data, such as average retrieval and adaptation times, and also allows the user to inspect case distribution on any two features of the case base (assuming that Feature.doubleValue() is overridden by the Feature subclass in use).

Parameters:
title - The title of the performance report window.
CB - The case base on which case distributions may be shown.

performanceReport

public void performanceReport(java.lang.String title)
Open a new window with a performance report for the system with this performance monitor. This window shows basic performance data, such as average retrieval and adaptation times. In this version of the method, no case base is provided, so case distribution data cannot be examined.

Parameters:
title - The title of the performance report window.

caseByCaseReport

public java.lang.String caseByCaseReport(CaseBase CB)
Return a String of a performance report of each case in the case base.


getAverageRetrievalTime

public double getAverageRetrievalTime()
Get the average retrieval time for this CBR system. This assumes exactly one retrieval step per problem seen. (One retrieval of possibly many cases.)


getAverageAdaptationTime

public double getAverageAdaptationTime()
Get the average adaptation time for this CBR system. This assumes exactly one adaptation step per problem seen. (One adaptation of possibly many cases, into one solution.)


getSystemCompetenceRating

public double getSystemCompetenceRating()
Get the competence rating for this CBR system. This is the percentage of problems that the system has solved at all.


getSystemConsistencyRating

public double getSystemConsistencyRating()
Get the consistency rating for this CBR system. (There are currently no consistency measurements implemented.)


getAverageSolutionQualityRating

public double getAverageSolutionQualityRating()
Get the average solution quality rating for this CBR system.


getSolvedWellPercentage

public double getSolvedWellPercentage()
Get the percentage of problems that were solved well, according to the domain-dependent implementation of PerformanceMonitor.determineSolutionQuality().


getProblemCount

public double getProblemCount()
Get the number of problems that have been posed to the system associated with this monitor. This corresponds to the system's age, and is exactly the same as getSystemAge().

Returns:
The number of problems seen.

getSystemAge

public double getSystemAge()
Get the age of the CBR system associated with this monitor. This is the number of problems the system has seen, and is exactly the same as getProblemCount().

Returns:
The age of the system.