|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--anthill.genie.impl.GeneticExperimentImpl
Class ExperimentImpl is a simple implementation of Experiment. It is constituted by a set of scenarios, on which the fitness is computed as the average fitness as computed in each scenario.
Field Summary | |
protected boolean |
computed
Boolean flag; true if the fitness has been already computed |
protected Factory |
factory
Factory used to instantiate objects |
protected int |
iterations
Number of times a scenario is evaluated |
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 int |
scenarioVersion
Version identifier of the scenario; when init params change, the version increase |
Constructor Summary | |
GeneticExperimentImpl(Factory factory,
int iterations)
Instantiates a new experiment by creating the specified number of scenarios through the specified scenario factory. |
Method Summary | |
void |
addGeneticCode(GeneticCode code)
Set the genetic code to be evaluated. |
void |
clear()
Restores the object to its initial state. |
Stats[] |
evaluate()
Execute the experiment, i.e. evaluate the fitness of the genetic code on each of the scenarios contained in this experimnt. |
double |
getFitness()
Returns the evaluated fitness. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String ROUND_NUMBER
Stats
object to
count the number of repetitions of the scenario evaluation in a
experiment.protected Factory factory
protected int iterations
protected int scenarioVersion
protected boolean computed
Constructor Detail |
public GeneticExperimentImpl(Factory factory, int iterations)
Method Detail |
public void addGeneticCode(GeneticCode code)
addGeneticCode
in interface GeneticExperiment
public Stats[] evaluate()
evaluate
in interface Experiment
IllegalStateException
- if no genetic code is presentpublic double getFitness()
getFitness
in interface GeneticExperiment
IllegalStateException
- if the fitness value has not been computed
yet.public void clear()
clear
in interface Clearable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |