Package jasima.core.experiment
Class FullFactorialExperiment
- java.lang.Object
-
- jasima.core.experiment.Experiment
-
- jasima.core.experiment.AbstractMultiExperiment
-
- jasima.core.experiment.AbstractMultiConfExperiment
-
- jasima.core.experiment.FullFactorialExperiment
-
- All Implemented Interfaces:
Notifier<Experiment,Experiment.ExperimentEvent>,ValueStore,Serializable,Cloneable
- Direct Known Subclasses:
OCBAExperiment,RandomFractionalExperiment
public class FullFactorialExperiment extends AbstractMultiConfExperiment
Systematically tests all possible combinations of various discrete factors and their values on a base experiment.- Author:
- Torsten Hildebrandt
- See Also:
RandomFractionalExperiment,OCBAExperiment, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jasima.core.experiment.AbstractMultiConfExperiment
AbstractMultiConfExperiment.ComplexFactorSetter, AbstractMultiConfExperiment.ConfigurationValidator
-
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 inherited from class jasima.core.experiment.AbstractMultiConfExperiment
FACTORS, KEY_EXPERIMENT, numConfs
-
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 FullFactorialExperiment()FullFactorialExperiment(Experiment baseExperiment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddExperimentForConf(int[] conf)<E extends Enum<?>>
voidaddFactor(String factorName, Class<E> enumClass)Convenience method to set a factor "factorName" for all possible values of an enumeration.voidaddFactor(String factorName, Object... values)Convenience method to add all elements invaluesas a possible value for a factor/propertyfactorName.voidaddFactor(String factorName, Collection<?> values)Convenience method to add all elements invaluesas a possible value for a factor/propertyfactorName.voidaddFactorValue(String name, AbstractMultiConfExperiment.ComplexFactorSetter value)Adds a new value for the factor "name".voidaddFactorValue(String name, Object value)Adds a configuration to test.voidclearFactors()Clears all configurations previously added using {@link #addFactorValue(...)}.FullFactorialExperimentclone()protected voidcreateExperiments()Collection<String>getFactorNames()Returns a read-only collection of all factor names that are currently defined.List<?>getFactorValues(String name)Returns a list with all values of a certain factor.intgetMaxConfigurations()Returns the current setting for the maximum number of configurations to run.voidsetCommonRandomNumbers(boolean commonRandomNumbers)Whether to use the variance reduction technique of common random numbers.voidsetMaxConfigurations(int maxConfigurations)Sets the maximum number of configurations (i.e., sub-experiments) that are allowed to execute.-
Methods inherited from class jasima.core.experiment.AbstractMultiConfExperiment
createExperimentForConf, doCreate, getBaseExperiment, getConfigurationValidator, getNumExperiments, init, isValidConfiguration, prefix, setBaseExperiment, setConfigurationValidator, setProperties
-
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, 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
-
-
-
-
Constructor Detail
-
FullFactorialExperiment
public FullFactorialExperiment()
-
FullFactorialExperiment
public FullFactorialExperiment(@Nullable Experiment baseExperiment)
-
-
Method Detail
-
clearFactors
public void clearFactors()
Clears all configurations previously added using {@link #addFactorValue(...)}.
-
addFactorValue
public void addFactorValue(String name, Object value)
Adds a configuration to test.- Parameters:
name- The factor name. This should be the name of a Java Beans Property of the base experiment, otherwise execution of the experiment will fail. In casevalueis aAbstractMultiConfExperiment.ComplexFactorSetter, name can be arbitrary.value- The value to test for factorname.
-
addFactorValue
public void addFactorValue(String name, AbstractMultiConfExperiment.ComplexFactorSetter value)
Adds a new value for the factor "name". This allows putting in a Java 8 method reference or lambda expression as a factor setter.
-
addFactor
public <E extends Enum<?>> void addFactor(String factorName, Class<E> enumClass)
Convenience method to set a factor "factorName" for all possible values of an enumeration.
Say an experiment has a property "color" of type
ColorEnumenum ColorEnum { RED, GREEN, BLUE }than callingaddFactors("color",ColorEnum.class)would be equivalent to manually adding three configurations:addFactor("color", ColorEnum.RED); addFactor("color", ColorEnum.GREEN); addFactor("color", ColorEnum.BLUE);- Type Parameters:
E- Any enumeration type.- Parameters:
factorName- name of the factor.enumClass- The enumeration, of which all members will be used as a value.- See Also:
addFactorValue(String, Object)
-
addFactor
public void addFactor(String factorName, Object... values)
Convenience method to add all elements invaluesas a possible value for a factor/propertyfactorName. This method is equivalent to repeatedly callingaddFactorValue(String, Object)for each element invalues.- Parameters:
factorName- Name of the factor.values- Values to use for this factor.- See Also:
addFactorValue(String, Object)
-
addFactor
public void addFactor(String factorName, Collection<?> values)
Convenience method to add all elements invaluesas a possible value for a factor/propertyfactorName. This method is equivalent to repeatedly callingaddFactorValue(String, Object)for each element invalues.- Parameters:
factorName- Name of the factor.values- A collection of values to use for this factor.- See Also:
addFactorValue(String, Object)
-
getFactorNames
public Collection<String> getFactorNames()
Returns a read-only collection of all factor names that are currently defined.- Returns:
- A collection of all factor names.
-
getFactorValues
public List<?> getFactorValues(String name)
Returns a list with all values of a certain factor.- Parameters:
name- A factor name.- Returns:
- A list with all values for the given factor name.
-
clone
public FullFactorialExperiment clone()
- Overrides:
clonein classAbstractMultiConfExperiment
-
createExperiments
protected void createExperiments()
- Specified by:
createExperimentsin classAbstractMultiConfExperiment
-
addExperimentForConf
protected void addExperimentForConf(int[] conf)
-
setCommonRandomNumbers
public void setCommonRandomNumbers(boolean commonRandomNumbers)
Description copied from class:AbstractMultiExperimentWhether to use the variance reduction technique of common random numbers. If set to true, all sub-experiments are executed using the same random seed, so random influences will be the same for all sub-experiments. If set tofalse, all sub-experiments will be assigned a differentinitialSeed, depending only on this experiment'sinitialSeed.- Overrides:
setCommonRandomNumbersin classAbstractMultiExperiment- Parameters:
commonRandomNumbers- Whether or not all sub-experiments are assigned the sameinitialSeed.
-
getMaxConfigurations
public int getMaxConfigurations()
Returns the current setting for the maximum number of configurations to run.- Returns:
- The maximum number of configurations.
-
setMaxConfigurations
public void setMaxConfigurations(int maxConfigurations)
Sets the maximum number of configurations (i.e., sub-experiments) that are allowed to execute. The default value is 1,000,000. If there are more valid configurations/factor combinations, then theFullFactorialExperimentwill abort in the initialization phase.- Parameters:
maxConfigurations- The maximum number of configurations to allow.
-
-