anthill.antsim.impl
Class TimeExperiment

java.lang.Object
  |
  +--anthill.antsim.impl.TimeExperiment
All Implemented Interfaces:
Clearable, Experiment

public class TimeExperiment
extends java.lang.Object
implements Experiment

Class TimeExperiment is a simple implementation of Experiment which repeat the execution of a single scenario a certain number of times and returns a single Stats object containing a summary of the statistics for all the executions.

Version:
$Revision$
Author:
Alberto Montresor

Field Summary
protected  boolean debug
          If true, methods for the analysis of experiment footprint are invoked
protected  Factory factory
          Factory used to instantiate objects
protected  int iterations
          Number of times a scenario is evaluated
protected  int nscenarios
          Number of scenario to be evaluated
static java.lang.String REPETITION
           
static java.lang.String ROUND_NUMBER
          The identifier of the counter used in a Stats object to count the number of repetitions of the scenario evaluation in a experiment.
protected  Scenario scenario
          Scenario on which evaluate the experiment
 
Constructor Summary
TimeExperiment(Factory factory, int iterations)
          Instantiates a new experiment by setting the given number of times by which a scenario has to be evaluated.
TimeExperiment(Factory factory, int iterations, int nscenarios)
          Instantiates a new experiment by setting the given number of times by which a scenario has to be evaluated.
TimeExperiment(Factory factory, int iterations, int nscenarios, boolean debug)
          Instantiates a new experiment by setting the given number of times by which a scenario has to be evaluated.
 
Method Summary
 void clear()
          Restores the object to its initial state.
 Stats[] evaluate()
          Perform the evaluation of the current ant algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUND_NUMBER

public static final java.lang.String ROUND_NUMBER
The identifier of the counter used in a Stats object to count the number of repetitions of the scenario evaluation in a experiment.

REPETITION

public static final java.lang.String REPETITION

factory

protected Factory factory
Factory used to instantiate objects

iterations

protected int iterations
Number of times a scenario is evaluated

nscenarios

protected int nscenarios
Number of scenario to be evaluated

debug

protected boolean debug
If true, methods for the analysis of experiment footprint are invoked

scenario

protected Scenario scenario
Scenario on which evaluate the experiment
Constructor Detail

TimeExperiment

public TimeExperiment(Factory factory,
                      int iterations)
Instantiates a new experiment by setting the given number of times by which a scenario has to be evaluated.
Parameters:
factory - the factory to be used to create scenarios
iterations - the number of scenario evaluations to be performed

TimeExperiment

public TimeExperiment(Factory factory,
                      int iterations,
                      int nscenarios)
Instantiates a new experiment by setting the given number of times by which a scenario has to be evaluated.
Parameters:
factory - the factory to be used to create scenarios
iterations - the number of scenario evaluations to be performed
clear - if true, the scenario will be cleared after each iteration of the experiment

TimeExperiment

public TimeExperiment(Factory factory,
                      int iterations,
                      int nscenarios,
                      boolean debug)
Instantiates a new experiment by setting the given number of times by which a scenario has to be evaluated.
Parameters:
factory - the factory to be used to create scenarios
iterations - the number of scenario evaluations to be performed
clear - if true, the scenario will be cleared after each iteration of the experiment
debug - if true, methods to analyze the memory footprint of the experiment are activated
Method Detail

evaluate

public Stats[] evaluate()
Perform the evaluation of the current ant algorithm. Returns a Stats array containing the statistics collected during the simulation.

In this implementation, a single Stats object is created and is used to collect statistics for all scenario executions performed by this Experiment.

Specified by:
evaluate in interface Experiment

clear

public void clear()
Restores the object to its initial state.
Specified by:
clear in interface Clearable