net.sf.bddbddb.order
Class EpisodeCollection

java.lang.Object
  extended by net.sf.bddbddb.order.EpisodeCollection

public class EpisodeCollection
extends java.lang.Object

A collection of trials on the same test. (The same BDD operation.)

Version:
$Id: EpisodeCollection.java 563 2005-05-24 05:24:11Z joewhaley $
Author:
John Whaley

Nested Class Summary
 class EpisodeCollection.Episode
           
 
Field Summary
 java.lang.String name
          Name of the test.
static java.lang.String OP_CONST
           
static java.lang.String RULE_CONST
          Time of the test.
static java.lang.String SPACER
           
 java.util.Map trials
          Map from orders to their trial information.
static java.lang.String UPDATE_CONST
           
 
Constructor Summary
EpisodeCollection(BDDInferenceRule rule, int opNum)
          Construct a new collection of trials.
 
Method Summary
 void addTrial(Order o, TrialPrediction p, long cost, long timestamp)
          Add the information about a trial to this collection.
 void addTrial(TrialInfo i)
          Add the information about a trial to this collection.
 boolean contains(Order o)
          Returns true if this collection contains a trial with the given order, false otherwise.
static EpisodeCollection.Episode episodeFromXMLElement(org.jdom.Element elem1, java.util.Map nameToVar, EpisodeCollection tc)
           
static EpisodeCollection fromXMLElement(org.jdom.Element e, Solver solver)
           
 long getAverage()
           
 EpisodeCollection.Episode getCurrEpisode()
           
 TrialInfo getMaximum()
           
 TrialInfo getMinimum()
           
 int getNumTrials()
           
 int getOpNumber()
           
 java.util.Collection getOrders()
           
 InferenceRule getRule(Solver solver)
           
 TrialInfo[] getSorted()
           
 double getStdDev()
           
static double getStdDev(java.util.Collection trials)
          Calculates the standard deviation of a collection of trials.
 java.util.Collection getTrials()
           
 int getUpdateCount()
           
 double getVariance()
           
static double getVariance(java.util.Collection trials)
          Calculates the variance of a collection of trials.
 EpisodeCollection.Episode startNewEpisode(long timestamp)
           
 java.lang.String toString()
           
 org.jdom.Element toXMLElement()
          Returns this EpisodeCollection as an XML element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name
Name of the test.


RULE_CONST

public static java.lang.String RULE_CONST
Time of the test.


SPACER

public static java.lang.String SPACER

UPDATE_CONST

public static java.lang.String UPDATE_CONST

OP_CONST

public static java.lang.String OP_CONST

trials

public java.util.Map trials
Map from orders to their trial information.

Constructor Detail

EpisodeCollection

public EpisodeCollection(BDDInferenceRule rule,
                         int opNum)
Construct a new collection of trials.

Method Detail

addTrial

public void addTrial(TrialInfo i)
Add the information about a trial to this collection.

Parameters:
i - trial info

addTrial

public void addTrial(Order o,
                     TrialPrediction p,
                     long cost,
                     long timestamp)
Add the information about a trial to this collection.

Parameters:
o - order
p - predicted value for this trial
cost - cost of operation

contains

public boolean contains(Order o)
Returns true if this collection contains a trial with the given order, false otherwise.

Parameters:
o - order
Returns:
true if this collection contains it, false otherwise

getStdDev

public static double getStdDev(java.util.Collection trials)
Calculates the standard deviation of a collection of trials.

Parameters:
trials - collection of trials
Returns:
variance

getStdDev

public double getStdDev()
Returns:
the standard deviation of the trials

getVariance

public static double getVariance(java.util.Collection trials)
Calculates the variance of a collection of trials.

Parameters:
trials - collection of trials
Returns:
variance

getVariance

public double getVariance()
Returns:
the variance of the trials

getMinimum

public TrialInfo getMinimum()
Returns:
the minimum cost trial

getMaximum

public TrialInfo getMaximum()
Returns:
the maximum cost trial

getAverage

public long getAverage()
Returns:
the mean of the trials

getSorted

public TrialInfo[] getSorted()
Returns:
the trials sorted by increasing cost

getTrials

public java.util.Collection getTrials()
Returns:
the collection of trials

getNumTrials

public int getNumTrials()
Returns:
the number of trials in this collection

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toXMLElement

public org.jdom.Element toXMLElement()
Returns this EpisodeCollection as an XML element.

Returns:
XML element

getRule

public InferenceRule getRule(Solver solver)

getUpdateCount

public int getUpdateCount()

getOpNumber

public int getOpNumber()

fromXMLElement

public static EpisodeCollection fromXMLElement(org.jdom.Element e,
                                               Solver solver)

getOrders

public java.util.Collection getOrders()

startNewEpisode

public EpisodeCollection.Episode startNewEpisode(long timestamp)

getCurrEpisode

public EpisodeCollection.Episode getCurrEpisode()

episodeFromXMLElement

public static EpisodeCollection.Episode episodeFromXMLElement(org.jdom.Element elem1,
                                                              java.util.Map nameToVar,
                                                              EpisodeCollection tc)


Copyright © 2004-2008 Stanford SUIF Compiler Group. All Rights Reserved.