Package org.moeaframework.core
Class Settings
java.lang.Object
org.moeaframework.core.Settings
Global settings used by this framework.
The settings are loaded from the system properties, set when starting Java using
java -Dorg.moeaframework.core.foo=bar ... or the properties file.
The default properties file is "moeaframework.properties" and should be located in the working directory
where Java is started. This can be overridden by setting org.moeaframework.configuration=<file>.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default buffer size.static final StringThe default configuration file.static final intThe default number of function evaluations, typically used when not given explicitly.static final intThe default number of iterations, typically used when not given explicitly.static final intThe default population size.static final doubleLevel of significance or machine precision.static final StringThe property key storing the command or executable used to start Java.static final StringThe property key storing the option formatting style.static final StringThe property key for enabling consistency checks in the CMA-ES algorithm.static final StringThe property key for setting the configuration file.static final StringThe property key for the continuity correction flag.static final StringThe property key for how to handle duplicate solutions in a nondominated population.static final StringThe property key for enabling debugging info when running external problems.static final StringThe property key for configuring the number of retry attempts when running external problems.static final StringThe property key for configuring the retry delay when running external problems.static final StringThe property key for configuring the shutdown timeout when running external problems.static final StringThe property key to indicate that fast non-dominated sorting should be used.static final StringThe property key for the power used in the generational distance calculation.static final StringThe property key for the genetic programming protected functions flag.static final StringThe property key for setting the display width of help messages from command line tools.static final StringThe property key for the hypervolume command.static final StringThe property key for the hypervolume delta when determining the reference point.static final StringThe property key for the hypervolume flag.static final StringThe property key for the hypervolume inversion flag.static final StringThe property key for the power used in the inverted generational distance calculation.static final StringThe property key storing the major version.static final StringThe property key for setting a global PRNG seed, which can be used to make results reproducible.static final StringThe prefix for all problem property keys.static final StringThe property key for specifying the Python interpreter command.static final StringThe property key for enabling verbose logging.static final StringThe property key storing the version.static final TypedPropertiesThe global properties object. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCreates the key for a property by concatenating an optional prefix with one or more parts.static PropertyScopeCreates a new scope wherein settings can be temporarily modified.static StringReturns the command or executable used to start Java.static OptionStyleReturns the formatting style for CLI options.Returns the strategy used for handling duplicate solutions in a nondominated population.static intReturns the number of retry attempts when connecting to an external problem with sockets.static DurationReturns the delay, given in seconds, between retry attempts when connecting to an external problem with sockets.static DurationReturns the timeout, given in seconds, the external process is given to shutdown cleanly before a forceful shutdown is attempted.static doubleReturns the power used in the generational distance calculation.static StringReturns the native hypervolume command; ornullif the default hypervolume implementation is used.static doubleReturns the delta applied to the nadir point of the reference set when calculating the hypervolume.static MultiResolutionImagegetIcon()Returns the MOEA Framework icon, supporting a varient of sizes.static doubleReturns the power used in the inverted generational distance calculation.static intReturns the major version number.static EpsilonsgetProblemSpecificEpsilons(String problem) Returns a problem-specific ε value used in algorithms, archives, and other objects based on ε dominance.static doublegetProblemSpecificHypervolumeDelta(String problem) Returns a problem-specific delta used for hypervolume calculations, or the default fromgetHypervolumeDelta()if no problem-specific value is configured.static double[]getProblemSpecificMaximumBounds(String problem) Returns the configured maximum bounds (reference point) used for normalization, ornullif not configured.static double[]getProblemSpecificMinimumBounds(String problem) Returns the configured minimum bounds (ideal point) used for normalization, ornullif not configured.static StringReturns the configured Python interpreter.static StringReturns the current version.static booleanReturnstrueif the CMA-ES algorithm has consistency checks enabled.static booleanReturnstrueif continuity correction is enabled;falseotherwise.static booleanisDebug()Returnstrueif debugging mode is enabled.static booleanReturnstrueif debugging is enabled when running external problems.static booleanReturnstrueif hypervolume calculation is enabled;falseotherwise.static booleanReturnstrueif the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwisefalse.static booleanisNormalizationDisabled(String problem) Returnstrueif normalization has been disabled for the given problem instance.static booleanReturnstrueif genetic programming functions should use protection against invalid arguments that would otherwise result inNaNor other invalid values;falseotherwise.static booleanReturnstrueif verbose logging is enabled;falseotherwise.static voidreload()Clears any existing settings and reloads the properties.static booleanReturnstrueif fast non-dominated sorting should be used; orfalseif the naive non-dominated sorting implementation is preferred.
-
Field Details
-
EPS
public static final double EPSLevel of significance or machine precision.- See Also:
-
BUFFER_SIZE
public static final int BUFFER_SIZEThe default buffer size. Currently set to 4096 bytes.- See Also:
-
DEFAULT_POPULATION_SIZE
public static final int DEFAULT_POPULATION_SIZEThe default population size.- See Also:
-
DEFAULT_MAX_FUNCTION_EVALUATIONS
public static final int DEFAULT_MAX_FUNCTION_EVALUATIONSThe default number of function evaluations, typically used when not given explicitly.- See Also:
-
DEFAULT_MAX_ITERATIONS
public static final int DEFAULT_MAX_ITERATIONSThe default number of iterations, typically used when not given explicitly.- See Also:
-
DEFAULT_CONFIGURATION_FILE
The default configuration file.- See Also:
-
PROPERTIES
The global properties object. -
KEY_CONFIGURATION_FILE
The property key for setting the configuration file. This defaults to "moeaframework.properties" if unset. -
KEY_VERSION
The property key storing the version. -
KEY_MAJOR_VERSION
The property key storing the major version. -
KEY_VERBOSE
The property key for enabling verbose logging. -
KEY_PYTHON_INTERPRETER
The property key for specifying the Python interpreter command. -
KEY_PRNG_SEED
The property key for setting a global PRNG seed, which can be used to make results reproducible. Note, however, that the seed is set once during initialization. -
KEY_HELP_WIDTH
The property key for setting the display width of help messages from command line tools. -
KEY_DUPLICATE_MODE
The property key for how to handle duplicate solutions in a nondominated population. -
KEY_GD_POWER
The property key for the power used in the generational distance calculation. -
KEY_IGD_POWER
The property key for the power used in the inverted generational distance calculation. -
KEY_FAST_NONDOMINATED_SORTING
The property key to indicate that fast non-dominated sorting should be used. -
KEY_CLI_EXECUTABALE
The property key storing the command or executable used to start Java. -
KEY_CLI_OPTION_STYLE
The property key storing the option formatting style. -
KEY_CONTINUITY_CORRECTION
The property key for the continuity correction flag. -
KEY_HYPERVOLUME_DELTA
The property key for the hypervolume delta when determining the reference point. -
KEY_HYPERVOLUME
The property key for the hypervolume command. -
KEY_HYPERVOLUME_INVERTED
The property key for the hypervolume inversion flag. -
KEY_HYPERVOLUME_ENABLED
The property key for the hypervolume flag. -
KEY_PROBLEM_PREFIX
The prefix for all problem property keys. -
KEY_CMAES_CHECK_CONSISTENCY
The property key for enabling consistency checks in the CMA-ES algorithm. -
KEY_GP_PROTECTED_FUNCTIONS
The property key for the genetic programming protected functions flag. -
KEY_EXTERNAL_PROBLEM_DEBUGGING
The property key for enabling debugging info when running external problems. -
KEY_EXTERNAL_RETRY_ATTEMPTS
The property key for configuring the number of retry attempts when running external problems. -
KEY_EXTERNAL_RETRY_DELAY
The property key for configuring the retry delay when running external problems. -
KEY_EXTERNAL_SHUTDOWN_TIMEOUT
The property key for configuring the shutdown timeout when running external problems.
-
-
Method Details
-
reload
public static void reload()Clears any existing settings and reloads the properties. -
isVerbose
public static boolean isVerbose()Returnstrueif verbose logging is enabled;falseotherwise.- Returns:
trueif verbose logging is enabled;falseotherwise
-
isDebug
public static boolean isDebug()Returnstrueif debugging mode is enabled. This is primarily intended for internal use as a way to enable debug tracing on CI.- Returns:
trueif debugging mode is enabled;falseotherwise
-
getVersion
Returns the current version.- Returns:
- the version
-
getMajorVersion
public static int getMajorVersion()Returns the major version number.- Returns:
- the major version
-
getPythonCommand
Returns the configured Python interpreter. This must either be found on the system path or an absolute path to the executable.- Returns:
- the python command
-
getCLIExecutable
Returns the command or executable used to start Java. This is primarily used when generating help messages to show a usage string matching the original command.- Returns:
- the command or executable used to start Java
-
getCLIOptionStyle
Returns the formatting style for CLI options.- Returns:
- the formatting style for CLI options
-
isContinuityCorrection
public static boolean isContinuityCorrection()Returnstrueif continuity correction is enabled;falseotherwise. Rank-based statistical inference methods, such as the Mann-Whitney U test and the Wilcoxon Signed-Ranks test, approximate the test's discrete distribution with a continuous distribution for computing the p-value. It has been recommended but not often employed in practice to apply a continuity correction.- Returns:
trueif continuity correction is enabled;falseotherwise
-
getDuplicateMode
Returns the strategy used for handling duplicate solutions in a nondominated population.- Returns:
- the strategy for handling duplicate solutions
-
getGDPower
public static double getGDPower()Returns the power used in the generational distance calculation. The default value is 2.0.- Returns:
- the power used in the generational distance calculation
-
getIGDPower
public static double getIGDPower()Returns the power used in the inverted generational distance calculation. The default value is 1.0.- Returns:
- the power used in the inverted generational distance calculation
-
useFastNondominatedSorting
public static boolean useFastNondominatedSorting()Returnstrueif fast non-dominated sorting should be used; orfalseif the naive non-dominated sorting implementation is preferred. The default isfalsesince while the fast version has better worst-case time complexity, the naive version tends to run faster except for a small number of edge cases.- Returns:
trueif fast non-dominated sorting should be used; orfalseif the naive non-dominated sorting implementation is preferred
-
getHypervolumeDelta
public static double getHypervolumeDelta()Returns the delta applied to the nadir point of the reference set when calculating the hypervolume. Having a non-zero delta is necessary to ensure extremal solutions contribute to the hypervolume.- Returns:
- the delta applied to the nadir point of the reference set when calculating the hypervolume
-
getHypervolume
Returns the native hypervolume command; ornullif the default hypervolume implementation is used. The default hypervolume implementation may become computationally prohibitive on large approximation sets or at high dimensions. SeeNativeHypervolumefor more details on formatting the command.- Returns:
- the native hypervolume command; or
nullif the default hypervolume implementation is used
-
isHypervolumeInverted
public static boolean isHypervolumeInverted()Returnstrueif the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwisefalse.- Returns:
trueif the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwisefalse
-
isHypervolumeEnabled
public static boolean isHypervolumeEnabled()Returnstrueif hypervolume calculation is enabled;falseotherwise. When disabled, the hypervolume should be reported asDouble.NaN. Direct use of theHypervolumeclass remains unaffected by this option.- Returns:
trueif hypervolume calculation is enabled;falseotherwise
-
getProblemSpecificMinimumBounds
Returns the configured minimum bounds (ideal point) used for normalization, ornullif not configured.- Parameters:
problem- the problem name- Returns:
- the minimum bounds or
null
-
getProblemSpecificMaximumBounds
Returns the configured maximum bounds (reference point) used for normalization, ornullif not configured.- Parameters:
problem- the problem name- Returns:
- the maximum bounds or
null
-
getProblemSpecificHypervolumeDelta
Returns a problem-specific delta used for hypervolume calculations, or the default fromgetHypervolumeDelta()if no problem-specific value is configured.- Parameters:
problem- the problem name- Returns:
- the hypervolume delta
-
getProblemSpecificEpsilons
Returns a problem-specific ε value used in algorithms, archives, and other objects based on ε dominance.- Parameters:
problem- the problem name- Returns:
- the ε values or
nullif no override provided
-
isNormalizationDisabled
Returnstrueif normalization has been disabled for the given problem instance.- Parameters:
problem- the problem name- Returns:
trueif disabled;falseotherwise
-
isProtectedFunctions
public static boolean isProtectedFunctions()Returnstrueif genetic programming functions should use protection against invalid arguments that would otherwise result inNaNor other invalid values;falseotherwise.- Returns:
trueif genetic programming functions should use protection against invalid arguments that would otherwise result inNaNor other invalid values;falseotherwise
-
isExternalProblemDebuggingEnabled
public static boolean isExternalProblemDebuggingEnabled()Returnstrueif debugging is enabled when running external problems.- Returns:
trueif debugging for external problems is enabled;falseotherwise
-
getExternalProblemRetryAttempts
public static int getExternalProblemRetryAttempts()Returns the number of retry attempts when connecting to an external problem with sockets.- Returns:
- the number of retry attempts
-
getExternalProblemRetryDelay
Returns the delay, given in seconds, between retry attempts when connecting to an external problem with sockets.- Returns:
- the retry delay
-
getExternalProblemShutdownTimeout
Returns the timeout, given in seconds, the external process is given to shutdown cleanly before a forceful shutdown is attempted.- Returns:
- the shutdown timeout
-
isCMAESConsistencyCheckingEnabled
public static boolean isCMAESConsistencyCheckingEnabled()Returnstrueif the CMA-ES algorithm has consistency checks enabled.- Returns:
trueif the CMA-ES algorithm has consistency checks enabled;falseotherwise
-
getIcon
Returns the MOEA Framework icon, supporting a varient of sizes.- Returns:
- the MOEA Framework icon
-
createKey
Creates the key for a property by concatenating an optional prefix with one or more parts.- Parameters:
prefix- the prefix or first part of the keyparts- remaining parts of the key- Returns:
- the full key
-
createScope
Creates a new scope wherein settings can be temporarily modified. Upon closing the scope, the original settings are restored.- Returns:
- the scope
-