|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.moeaframework.Executor
public class Executor
Configures and executes algorithms while hiding the underlying boilerplate code needed to setup and safely execute an algorithm. For example, the following demonstrates its typical use:
NondominatedPopulation result = new Executor()
.withAlgorithm("NSGAII")
.withProblem("DTLZ2_2")
.withProperty("populationSize", 100)
.withProperty("maxEvaluations", 10000)
.distributeOnAllCores()
.checkpointEveryIteration()
.withCheckpointFile(new File("example.state"))
.run();
The problem and algorithm must be specified prior to run().
| Constructor Summary | |
|---|---|
Executor()
Constructs a new executor initialized with default settings. |
|
| Method Summary | |
|---|---|
void |
cancel()
Informs this executor to stop processing and returns any results collected thus far. |
Executor |
checkpointEveryIteration()
Enables this executor to save checkpoints after every iteration of the algorithm. |
Executor |
clearProperties()
Clears the properties. |
Executor |
distributeOn(int numberOfThreads)
Enables this executor to distribute solution evaluations across the specified number of threads. |
Executor |
distributeOnAllCores()
Enables this executor to distribute solution evaluations across all processors on the local host. |
Executor |
distributeWith(ExecutorService executorService)
Sets the ExecutorService used by this executor to distribute
solution evaluations. |
Instrumenter |
getInstrumenter()
Returns the instrumenter used by this executor; or null if no
instrumenter has been assigned. |
boolean |
isCanceled()
Returns true if the canceled flag is set; false
otherwise. |
Executor |
resetCheckpointFile()
Deletes the checkpoint file if it exists. |
NondominatedPopulation |
run()
Runs this executor with its configured settings. |
List<NondominatedPopulation> |
runSeeds(int numberOfSeeds)
Runs this executor with its configured settings multiple times, returning the individual end-of-run approximation sets. |
protected NondominatedPopulation |
runSingleSeed(int seed,
int numberOfSeeds,
int maxEvaluations)
Runs this executor with its configured settings. |
Executor |
usingAlgorithmFactory(AlgorithmFactory algorithmFactory)
Sets the algorithm factory used by this executor. |
Executor |
usingProblemFactory(ProblemFactory problemFactory)
Sets the problem factory used by this builder. |
Executor |
withAlgorithm(String algorithmName)
Sets the algorithm used by this executor. |
Executor |
withCheckpointFile(File checkpointFile)
Sets the checkpoint file where the algorithm state is stored. |
Executor |
withCheckpointFrequency(int checkpointFrequency)
Sets the frequency at which this executor saves checkpoints. |
Executor |
withEpsilon(double... epsilon)
Sets the ε values; equivalent to setting the property epsilon. |
Executor |
withInstrumenter(Instrumenter instrumenter)
Sets the instrumenter used to record information about the runtime behavior of algorithms executed by this executor. |
Executor |
withMaxEvaluations(int maxEvaluations)
Sets the maximum number of evaluations; equivalent to setting the property maxEvaluations. |
Executor |
withProblem(String problemName)
Sets the problem used by this builder. |
Executor |
withProblemClass(Class<?> problemClass,
Object... problemArguments)
Sets the problem used by this builder. |
Executor |
withProblemClass(String problemClassName,
Object... problemArguments)
Sets the problem used by this builder. |
Executor |
withProgressListener(ProgressListener listener)
Adds the given progress listener to receive periodic progress reports. |
Executor |
withProperties(Properties properties)
Sets all properties. |
Executor |
withProperty(String key,
boolean value)
Sets a boolean property. |
Executor |
withProperty(String key,
byte value)
Sets a byte property. |
Executor |
withProperty(String key,
byte[] values)
Sets a byte array property. |
Executor |
withProperty(String key,
double value)
Sets a double property. |
Executor |
withProperty(String key,
double[] values)
Sets a double array property. |
Executor |
withProperty(String key,
float value)
Sets a float property. |
Executor |
withProperty(String key,
float[] values)
Sets a float array property. |
Executor |
withProperty(String key,
int value)
Sets an int property. |
Executor |
withProperty(String key,
int[] values)
Sets an int array property. |
Executor |
withProperty(String key,
long value)
Sets a long property. |
Executor |
withProperty(String key,
long[] values)
Sets a long array property. |
Executor |
withProperty(String key,
short value)
Sets a short property. |
Executor |
withProperty(String key,
short[] values)
Sets a short array property. |
Executor |
withProperty(String key,
String value)
Sets a property. |
Executor |
withProperty(String key,
String[] values)
Sets a String array property. |
Executor |
withSameProblemAs(org.moeaframework.ProblemBuilder builder)
Configures this builder to use the same problem, reference set, ε values and ProblemFactory as the specified instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Executor()
| Method Detail |
|---|
public void cancel()
public boolean isCanceled()
true if the canceled flag is set; false
otherwise. After canceling a run, the flag will remain set to
true until another run is started. This method is thread-safe.
true if the canceled flag is set; false
otherwisepublic Executor withInstrumenter(Instrumenter instrumenter)
instrumenter - the instrumeter
public Instrumenter getInstrumenter()
null if no
instrumenter has been assigned.
null if no
instrumenter has been assignedpublic Executor usingAlgorithmFactory(AlgorithmFactory algorithmFactory)
algorithmFactory - the algorithm factory
public Executor withSameProblemAs(org.moeaframework.ProblemBuilder builder)
ProblemFactory as the specified instance.
builder - the instance whose problem, reference set, ε
values and ProblemFactory are to be copied
public Executor usingProblemFactory(ProblemFactory problemFactory)
problemFactory - the problem factory
public Executor withProblem(String problemName)
problemName - the problem name
public Executor withProblemClass(Class<?> problemClass,
Object... problemArguments)
Class.newInstance() method. Ensure the problem
class satisfies all the conditions of newInstance(), otherwise
exceptions may be thrown when attempting to create an instance of the
problem.
problemClass - the problem classproblemArguments - the arguments passed to the problem constructor
public Executor withProblemClass(String problemClassName,
Object... problemArguments)
throws ClassNotFoundException
Class.newInstance() method. Ensure the problem
class satisfies all the conditions of newInstance(), otherwise
exceptions may be thrown when attempting to create an instance of the
problem.
problemClassName - the problem class nameproblemArguments - the arguments passed to the problem constructor
ClassNotFoundException - if the specified problem class name could
not be foundpublic Executor withAlgorithm(String algorithmName)
algorithmName - the algorithm name
public Executor distributeWith(ExecutorService executorService)
ExecutorService used by this executor to distribute
solution evaluations. The caller is responsible for ensuring the
executor service is shutdown after use.
executorService - the executor service
public Executor distributeOn(int numberOfThreads)
numberOfThreads - the number of threads
IllegalArgumentException - if numberOfThreads <= 0public Executor distributeOnAllCores()
public Executor withCheckpointFile(File checkpointFile)
checkpointFile - the checkpoint file
public Executor withCheckpointFrequency(int checkpointFrequency)
checkpointFrequency - the checkpoint frequency, specifying the
number of evaluations between checkpoints
public Executor checkpointEveryIteration()
public Executor resetCheckpointFile()
throws IOException
IOException - if the checkpoint file could not be deletedpublic Executor withEpsilon(double... epsilon)
epsilon.
epsilon - the ε values
public Executor withMaxEvaluations(int maxEvaluations)
maxEvaluations.
maxEvaluations - the maximum number of evaluations
public Executor withProperty(String key,
String value)
key - the property keyvalue - the property value
public Executor withProperty(String key,
float value)
float property.
key - the property keyvalue - the property value
public Executor withProperty(String key,
double value)
double property.
key - the property keyvalue - the property value
public Executor withProperty(String key,
byte value)
byte property.
key - the property keyvalue - the property value
public Executor withProperty(String key,
short value)
short property.
key - the property keyvalue - the property value
public Executor withProperty(String key,
int value)
int property.
key - the property keyvalue - the property value
public Executor withProperty(String key,
long value)
long property.
key - the property keyvalue - the property value
public Executor withProperty(String key,
boolean value)
boolean property.
key - the property keyvalue - the property value
public Executor withProperty(String key,
String[] values)
String array property.
key - the property keyvalues - the property value
public Executor withProperty(String key,
float[] values)
float array property.
key - the property keyvalues - the property value
public Executor withProperty(String key,
double[] values)
double array property.
key - the property keyvalues - the property value
public Executor withProperty(String key,
byte[] values)
byte array property.
key - the property keyvalues - the property value
public Executor withProperty(String key,
short[] values)
short array property.
key - the property keyvalues - the property value
public Executor withProperty(String key,
int[] values)
int array property.
key - the property keyvalues - the property value
public Executor withProperty(String key,
long[] values)
long array property.
key - the property keyvalues - the property value
public Executor clearProperties()
public Executor withProperties(Properties properties)
properties - the properties
public Executor withProgressListener(ProgressListener listener)
listener - the progress listener to add
public List<NondominatedPopulation> runSeeds(int numberOfSeeds)
numberOfSeeds - the number of seeds to run
public NondominatedPopulation run()
null if canceled
protected NondominatedPopulation runSingleSeed(int seed,
int numberOfSeeds,
int maxEvaluations)
seed - the current seed being run, such that
1 <= seed <= numberOfSeedsnumberOfSeeds - to total number of seeds being runmaxEvaluations - to maximum number of objective function
evaluations per seed
null if canceled
|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||