anthill.antsim.impl
Class ExperimentImpl

java.lang.Object
  |
  +--anthill.antsim.impl.ExperimentImpl
All Implemented Interfaces:
Clearable, Experiment
Direct Known Subclasses:
GeneticExperimentImpl

public class ExperimentImpl
extends java.lang.Object
implements Experiment

Class ExperimentImpl 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.


Field Summary
protected  Factory factory
          Factory used to instantiate objects
protected  int iterations
          Number of times a scenario is evaluated
static java.lang.String NUMBER_OF_ROUNDS_ID
          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
protected  java.lang.String scenarioClass
          Class name of the scenario to be used
protected  int scenarioVersion
          Version identifier of the scenario; when init params change, the version increase
 
Constructor Summary
  ExperimentImpl(Factory factory, int iterations)
          Instantiates a new experiment by setting the given number of times by which a scenario has to be evaluated.
protected ExperimentImpl(Factory factory, java.lang.String scenarioClass, int iterations)
          Instantiates a new experiment by setting the given number of times by which a scenario of the specified class 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

NUMBER_OF_ROUNDS_ID

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

factory

protected Factory factory
Factory used to instantiate objects

scenarioClass

protected java.lang.String scenarioClass
Class name of the scenario to be used

iterations

protected int iterations
Number of times a scenario is evaluated

scenario

protected Scenario scenario
Scenario on which evaluate the experiment

scenarioVersion

protected int scenarioVersion
Version identifier of the scenario; when init params change, the version increase
Constructor Detail

ExperimentImpl

public ExperimentImpl(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

ExperimentImpl

protected ExperimentImpl(Factory factory,
                         java.lang.String scenarioClass,
                         int iterations)
Instantiates a new experiment by setting the given number of times by which a scenario of the specified class has to be evaluated.
Parameters:
factory - the factory to be used to create scenarios
scenarioClass - the class name of the scenario object to be created
iterations - the number of scenario evaluations to be performed
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