Package jasima.core.experiment
Class AbstractMultiConfExperiment
- java.lang.Object
-
- jasima.core.experiment.Experiment
-
- jasima.core.experiment.AbstractMultiExperiment
-
- jasima.core.experiment.AbstractMultiConfExperiment
-
- All Implemented Interfaces:
Notifier<Experiment,Experiment.ExperimentEvent>,ValueStore,Serializable,Cloneable
- Direct Known Subclasses:
FullFactorialExperiment,MultipleConfigurationExperiment
public abstract class AbstractMultiConfExperiment extends AbstractMultiExperiment
Base class for experiments that execute variations of a
baseExperimentby changing its properties.The order in which properties are applied is determined by the length of the property name to guarantee that sub-properties are set after the object containing them. This also applies when
AbstractMultiConfExperiment.ComplexFactorSetteris used. Properties with equally long names are executed in an undefined order. Exceptions are null, which is regarded as having a length of -1, andKEY_EXPERIMENT, which is regarded has having a length of -2.KEY_EXPERIMENTcan be present in any number of configurations. If it is present in all configurations, baseExperiment need not be set.- Author:
- Robin Kreis, Torsten Hildebrandt
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractMultiConfExperiment.ComplexFactorSetterAllows finer control of the way a base experiment is configured than the usual mechanism using JavaBean properties.static interfaceAbstractMultiConfExperiment.ConfigurationValidatorAn (optional) way to veto certain configurations, because some combinations of factors and their values might not make sense.-
Nested classes/interfaces inherited from class jasima.core.experiment.AbstractMultiExperiment
AbstractMultiExperiment.BaseExperimentCompleted
-
Nested classes/interfaces inherited from class jasima.core.experiment.Experiment
Experiment.ExperimentEvent, Experiment.ExperimentState, Experiment.UniqueNamesCheckingHashMap
-
-
Field Summary
Fields Modifier and Type Field Description static StringFACTORSstatic StringKEY_EXPERIMENTprotected intnumConfs-
Fields inherited from class jasima.core.experiment.AbstractMultiExperiment
detailedResultsNumeric, detailedResultsOther, experiments, NUM_TASKS_EXECUTED, numTasksExecuted, seedStream
-
Fields inherited from class jasima.core.experiment.Experiment
aborted, DEFAULT_SEED, error, EXCEPTION, EXCEPTION_MESSAGE, EXP_ABORTED, resultMap, RUNTIME
-
-
Constructor Summary
Constructors Constructor Description AbstractMultiConfExperiment()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AbstractMultiConfExperimentclone()protected ExperimentcreateExperimentForConf(Map<String,Object> conf)protected abstract voidcreateExperiments()protected ExperimentdoCreate(Map<String,Object> conf)ExperimentgetBaseExperiment()AbstractMultiConfExperiment.ConfigurationValidatorgetConfigurationValidator()intgetNumExperiments()Returns the number of experiment configurations to be executed.voidinit()This method is called to perform any initializations required before the experiment is run.protected booleanisValidConfiguration(Map<String,Object> conf)protected Stringprefix()voidsetBaseExperiment(Experiment baseExperiment)Sets the base experiment that is executed multiple times in various configurations.voidsetConfigurationValidator(AbstractMultiConfExperiment.ConfigurationValidator configurationValidator)Sets aAbstractMultiConfExperiment.ConfigurationValidator, which is used to veto certain impossible factor combinations.protected voidsetProperties(Experiment e, List<Map.Entry<String,Object>> entries)-
Methods inherited from class jasima.core.experiment.AbstractMultiExperiment
addKeepResultName, configureRunExperiment, executeExperiments, getExperimentSeed, getKeepResults, getNumTasks, getNumTasksExecuted, getSkipSeedCount, handleNumericValue, handleOtherValue, hasMoreTasks, isAbortUponBaseExperimentAbort, isAllowParallelExecution, isCommonRandomNumbers, isKeepTaskResults, isProduceAveragedResults, isSpecialKey, performRun, produceResults, removeKeepResultName, setAbortUponBaseExperimentAbort, setAllowParallelExecution, setCommonRandomNumbers, setKeepResults, setProduceAveragedResults, setSkipSeedCount, storeRunResults
-
Methods inherited from class jasima.core.experiment.Experiment
abort, addErrorResults, addStandardResults, afterRun, beforeRun, cancel, checkCancelledOrInterrupted, done, executeSubExperiment, finalActions, finish, getError, getInitialSeed, getLogLevel, getName, getPropsWithValues, getResults, getState, handleExecutionError, isCancelled, main, nestingLevel, nestingLevel, notifierImpl, print, print, print, print, printResults, readResolve, requireState, runExperiment, runExperimentAsync, runExperimentAsync, runExperimentInternal, runTimeReal, setInitialSeed, setLogLevel, setName, starting, state, toString, valueStoreImpl
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jasima.core.util.observer.Notifier
addListener, addListener, addListener, fire, fire, getListener, numListener, removeCurrentListener, removeListener
-
Methods inherited from interface jasima.core.util.ValueStore
valueStoreContains, valueStoreGet, valueStoreGet, valueStoreGetAllKeys, valueStoreGetNumKeys, valueStorePut, valueStoreRemove, valueStoreUpdate
-
-
-
-
Field Detail
-
KEY_EXPERIMENT
public static final String KEY_EXPERIMENT
- See Also:
- Constant Field Values
-
FACTORS
public static final String FACTORS
- See Also:
- Constant Field Values
-
numConfs
protected int numConfs
-
-
Method Detail
-
init
public void init()
Description copied from class:ExperimentThis method is called to perform any initializations required before the experiment is run.- Overrides:
initin classAbstractMultiExperiment
-
createExperiments
protected abstract void createExperiments()
- Specified by:
createExperimentsin classAbstractMultiExperiment
-
createExperimentForConf
@Nullable protected Experiment createExperimentForConf(Map<String,Object> conf)
-
doCreate
protected Experiment doCreate(Map<String,Object> conf)
-
setProperties
protected void setProperties(Experiment e, List<Map.Entry<String,Object>> entries)
-
prefix
protected final String prefix()
- Specified by:
prefixin classAbstractMultiExperiment
-
getNumExperiments
public int getNumExperiments()
Returns the number of experiment configurations to be executed.- Specified by:
getNumExperimentsin classAbstractMultiExperiment
-
getBaseExperiment
public Experiment getBaseExperiment()
-
setBaseExperiment
public void setBaseExperiment(Experiment baseExperiment)
Sets the base experiment that is executed multiple times in various configurations. Before experiment execution, a copy (clone) ofbaseExperimentis created and run. Therefore the specific experiment instance passed as thebaseExperimentis never actually executed.- Parameters:
baseExperiment- The base experiment to use.
-
getConfigurationValidator
public AbstractMultiConfExperiment.ConfigurationValidator getConfigurationValidator()
-
setConfigurationValidator
public void setConfigurationValidator(AbstractMultiConfExperiment.ConfigurationValidator configurationValidator)
Sets aAbstractMultiConfExperiment.ConfigurationValidator, which is used to veto certain impossible factor combinations.- Parameters:
configurationValidator- Sets the validator.
-
clone
public AbstractMultiConfExperiment clone()
- Overrides:
clonein classAbstractMultiExperiment
-
-