Class OCBAExperiment
-
- All Implemented Interfaces:
Notifier<Experiment,Experiment.ExperimentEvent>,ValueStore,Serializable,Cloneable
public class OCBAExperiment extends FullFactorialExperiment
Purpose of this class is to find the best configuration/parameterization of a base experiment (subject to random effects) using the Optimal Computing Budget Allocation (OCBA) method. In contrast to simply running a
FullFactorialExperimentperforming a fixed number of replications for each configuration, this class aims at intelligently distributing a given budget of base experiment runs in order to maximize the probability of actually selecting the best configuration (Probability of Correct Selection, PCS).Implements the OCBA method as described in Chen2000: Chen, C. H., J. Lin, E. Yücesan, and S. E. Chick, "Simulation Budget Allocation for Further Enhancing the Efficiency of Ordinal Optimization," Journal of Discrete Event Dynamic Systems: Theory and Applications, Vol. 10, pp. 251-270, July 2000.
First minReplicationsPerConfiguration replications (default: 5) are performed for each configuration. Later on runs are allocated dynamically using OCBA. The total budget is given by: getNumReplications() (default: 10)*<number of configurations>
To use this class at least the name of the objective value (
setObjective(String)) and whether this objective is to be maximized or minimized (setMaximize()) have to be set.Each iteration of the allocation algorithm allocates more than a single run in order to benefit from parallelization.
A usage example is given below. It selects the best of two dispatching rules of a dynamic job shop scenario.
// create and configure base experiment HolthausExperiment he = new HolthausExperiment(); he.setUtilLevel(0.9); he.addShopListener(new BasicJobStatCollector()); // create OCBA experiment OCBAExperiment ocbaExperiment = new OCBAExperiment(); ocbaExperiment.setInitialSeed(23); // set base experiment to use ocbaExperiment.setBaseExperiment(he); // define configurations to test ocbaExperiment.addFactor("sequencingRule", new SPT().setFinalTieBreaker(new TieBreakerFASFS())); ocbaExperiment.addFactor("sequencingRule", new PTPlusWINQPlusNPT().setFinalTieBreaker(new TieBreakerFASFS())); // define objective function ocbaExperiment.setObjective("flowMean"); ocbaExperiment.setProblemType(ProblemType.MINIMIZE); // no fixed budget, run until we are pretty sure to have the best // configuration ocbaExperiment.setNumReplications(0); ocbaExperiment.setPcsLevel(0.95); // optionally produce an Excel file with results and details ocbaExperiment.addNotifierListener(new ExcelSaver()); // run ocbaExperiment.runExperiment(); ocbaExperiment.printResults();This class implements a basic ranking and selection method. In future versions it would be very helpful to improve its algorithm to better deal with very similar performances of good configurations (such as indifference zone approaches, or using Expected Opportunity Costs). I'm also unsure about the effects if base experiments use common random numbers (which is the default behavior of this class, see
FullFactorialExperiment.setCommonRandomNumbers(boolean). In summary, this class is not a fool-proof intelligent allocator of replications, but should provide reasonably good results to be useful. Probably it's also a good starting point for experts in the field to implement (and contribute?) improved algorithms.- Author:
- Torsten Hildebrandt
- See Also:
MultipleReplicationExperiment,FullFactorialExperiment, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOCBAExperiment.ProblemType-
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 OCBAExperiment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doublecalcPCS()protected double[]calcPCSPriosPerConfiguration()protected ExperimentcreateExperimentForConf(Map<String,Object> conf)protected voidcreateExperiments()protected voiddone()This method can be overridden to perform any required clean-up.intgetMinReplicationsPerConfiguration()intgetNumReplicationsPerConfiguration()StringgetObjective()doublegetPcsLevel()OCBAExperiment.ProblemTypegetProblemType()protected booleanhasMoreTasks()booleanisDetailedResults()protected int[]ocba(int add_budget)This subroutine implements the optimal computation budget allocation (OCBA) algorithm presented in Chen et al. (2000) in the J of DEDS.voidproduceResults()Populates the result mapExperiment.resultMapwith values produced during experiment execution.voidsetDetailedResults(boolean detailedResults)Whether to produce detailed results or just basic information of the best configuration.voidsetMinReplicationsPerConfiguration(int minReps)Sets the minimum number of replications performed for each configuration.voidsetNumReplicationsPerConfiguration(int numReplications)Sets the total budget for each configuration.voidsetObjective(String objective)Sets the name of the objective which defines "best".voidsetPcsLevel(double pcsLevel)Stop using more replications if this level of the probablity of correct selection is reached.voidsetProblemType(OCBAExperiment.ProblemType problemType)Sets whether a minimization or maximization experiment should be solved.protected voidstoreRunResults(Experiment e, Map<String,Object> r)-
Methods inherited from class jasima.core.experiment.FullFactorialExperiment
addExperimentForConf, addFactor, addFactor, addFactor, addFactorValue, addFactorValue, clearFactors, clone, getFactorNames, getFactorValues, getMaxConfigurations, setCommonRandomNumbers, setMaxConfigurations
-
Methods inherited from class jasima.core.experiment.AbstractMultiConfExperiment
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, isAbortUponBaseExperimentAbort, isAllowParallelExecution, isCommonRandomNumbers, isKeepTaskResults, isProduceAveragedResults, isSpecialKey, performRun, removeKeepResultName, setAbortUponBaseExperimentAbort, setAllowParallelExecution, setKeepResults, setProduceAveragedResults, setSkipSeedCount
-
Methods inherited from class jasima.core.experiment.Experiment
abort, addErrorResults, addStandardResults, afterRun, beforeRun, cancel, checkCancelledOrInterrupted, 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
-
-
-
-
Method Detail
-
createExperiments
protected void createExperiments()
- Overrides:
createExperimentsin classFullFactorialExperiment
-
createExperimentForConf
protected Experiment createExperimentForConf(Map<String,Object> conf)
- Overrides:
createExperimentForConfin classAbstractMultiConfExperiment
-
done
protected void done()
Description copied from class:ExperimentThis method can be overridden to perform any required clean-up. It is executed immediately afterExperiment.afterRun(), but beforeExperiment.produceResults()andExperiment.finish().- Overrides:
donein classExperiment
-
produceResults
public void produceResults()
Description copied from class:ExperimentPopulates the result mapExperiment.resultMapwith values produced during experiment execution. The Experiment always adds the two results "runTime" and "expAborted".- Overrides:
produceResultsin classAbstractMultiExperiment
-
hasMoreTasks
protected boolean hasMoreTasks()
- Overrides:
hasMoreTasksin classAbstractMultiExperiment
-
storeRunResults
protected void storeRunResults(Experiment e, Map<String,Object> r)
- Overrides:
storeRunResultsin classAbstractMultiExperiment
-
calcPCS
protected double calcPCS()
-
calcPCSPriosPerConfiguration
protected double[] calcPCSPriosPerConfiguration()
-
ocba
protected int[] ocba(int add_budget)
This subroutine implements the optimal computation budget allocation (OCBA) algorithm presented in Chen et al. (2000) in the J of DEDS. It determines how many additional runs each design should have for the next iteration of simulation.- Parameters:
add_budget- The total number of additional replications that can be performed.- Returns:
- additional number of simulation replication assigned to design i, i=0,1,..,ND-1
-
setMinReplicationsPerConfiguration
public void setMinReplicationsPerConfiguration(int minReps)
Sets the minimum number of replications performed for each configuration. This has to be >=3 or -1 to use the number of available processor cores.- Parameters:
minReps- The minimum number of replications per configuration.
-
getMinReplicationsPerConfiguration
public int getMinReplicationsPerConfiguration()
-
setObjective
public void setObjective(String objective)
Sets the name of the objective which defines "best". This has to be the name of a result produced by the base experiment.- Parameters:
objective- Result name to use as the objective function.
-
getObjective
public String getObjective()
-
setPcsLevel
public void setPcsLevel(double pcsLevel)
Stop using more replications if this level of the probablity of correct selection is reached. This defines a dynamic stopping criterion.- Parameters:
pcsLevel- The desired confidence in the results (between 0 and 1).
-
getPcsLevel
public double getPcsLevel()
-
setDetailedResults
public void setDetailedResults(boolean detailedResults)
Whether to produce detailed results or just basic information of the best configuration.- Parameters:
detailedResults- Produce detailed results or not.
-
isDetailedResults
public boolean isDetailedResults()
-
setNumReplicationsPerConfiguration
public void setNumReplicationsPerConfiguration(int numReplications)
Sets the total budget for each configuration.- Parameters:
numReplications- The number of replications to use.
-
getNumReplicationsPerConfiguration
public int getNumReplicationsPerConfiguration()
-
getProblemType
public OCBAExperiment.ProblemType getProblemType()
-
setProblemType
public void setProblemType(OCBAExperiment.ProblemType problemType)
Sets whether a minimization or maximization experiment should be solved.- Parameters:
problemType- Whether minimization or maximization are required.
-
-