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 int
The default buffer size.static final String
The default configuration file.static final int
The default number of function evaluations, typically used when not given explicitly.static final int
The default number of iterations, typically used when not given explicitly.static final int
The default population size.static final double
Level of significance or machine precision.static final String
The property key for enabling consistency checks in the CMA-ES algorithm.static final String
The property key for setting the configuration file.static final String
The property key for the continuity correction flag.static final String
The property key for how to handle duplicate solutions in a nondominated population.static final String
The property key for enabling debugging info when running external problems.static final String
The property key for configuring the number of retry attempts when running external problems.static final String
The property key for configuring the retry delay when running external problems.static final String
The property key for configuring the shutdown timeout when running external problems.static final String
The property key to indicate that fast non-dominated sorting should be used.static final String
The property key for the power used in the generational distance calculation.static final String
The property key for the genetic programming protected functions flag.static final String
The property key for setting the display width of help messages from command line tools.static final String
The property key for the hypervolume command.static final String
The property key for the hypervolume delta when determining the reference point.static final String
The property key for the hypervolume flag.static final String
The property key for the hypervolume inversion flag.static final String
The property key for the power used in the inverted generational distance calculation.static final String
The property key storing the major version.static final String
The property key for setting a global PRNG seed, which can be used to make results reproducible.static final String
The prefix for all problem property keys.static final String
The property key for specifying the Python interpreter command.static final String
The property key for enabling verbose logging.static final String
The property key storing the version.static final TypedProperties
The global properties object. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Creates the key for a property by concatenating an optional prefix with one or more parts.static PropertyScope
Creates a new scope wherein settings can be temporarily modified.Returns the strategy used for handling duplicate solutions in a nondominated population.static int
Returns the number of retry attempts when connecting to an external problem with sockets.static Duration
Returns the delay, given in seconds, between retry attempts when connecting to an external problem with sockets.static Duration
Returns the timeout, given in seconds, the external process is given to shutdown cleanly before a forceful shutdown is attempted.static double
Returns the power used in the generational distance calculation.static String
Returns the native hypervolume command; ornull
if the default hypervolume implementation is used.static double
Returns the delta applied to the nadir point of the reference set when calculating the hypervolume.static MultiResolutionImage
getIcon()
Returns the MOEA Framework icon, supporting a varient of sizes.static double
Returns the power used in the inverted generational distance calculation.static int
Returns the major version number.static Epsilons
getProblemSpecificEpsilons
(String problem) Returns a problem-specific ε value used in algorithms, archives, and other objects based on ε dominance.static double
getProblemSpecificHypervolumeDelta
(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, ornull
if not configured.static double[]
getProblemSpecificMinimumBounds
(String problem) Returns the configured minimum bounds (ideal point) used for normalization, ornull
if not configured.static String
Returns the configured Python interpreter.static String
Returns the current version.static boolean
Returnstrue
if the CMA-ES algorithm has consistency checks enabled.static boolean
Returnstrue
if continuity correction is enabled;false
otherwise.static boolean
isDebug()
Returnstrue
if debugging mode is enabled.static boolean
Returnstrue
if debugging is enabled when running external problems.static boolean
Returnstrue
if hypervolume calculation is enabled;false
otherwise.static boolean
Returnstrue
if the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwisefalse
.static boolean
isNormalizationDisabled
(String problem) Returnstrue
if normalization has been disabled for the given problem instance.static boolean
Returnstrue
if genetic programming functions should use protection against invalid arguments that would otherwise result inNaN
or other invalid values;false
otherwise.static boolean
Returnstrue
if verbose logging is enabled;false
otherwise.static void
reload()
Clears any existing settings and reloads the properties.static boolean
Returnstrue
if fast non-dominated sorting should be used; orfalse
if 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_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()Returnstrue
if verbose logging is enabled;false
otherwise.- Returns:
true
if verbose logging is enabled;false
otherwise
-
isDebug
public static boolean isDebug()Returnstrue
if debugging mode is enabled. This is primarily intended for internal use as a way to enable debug tracing on CI.- Returns:
true
if debugging mode is enabled;false
otherwise
-
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
-
isContinuityCorrection
public static boolean isContinuityCorrection()Returnstrue
if continuity correction is enabled;false
otherwise. 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:
true
if continuity correction is enabled;false
otherwise
-
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()Returnstrue
if fast non-dominated sorting should be used; orfalse
if the naive non-dominated sorting implementation is preferred. The default isfalse
since 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:
true
if fast non-dominated sorting should be used; orfalse
if 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; ornull
if the default hypervolume implementation is used. The default hypervolume implementation may become computationally prohibitive on large approximation sets or at high dimensions. SeeNativeHypervolume
for more details on formatting the command.- Returns:
- the native hypervolume command; or
null
if the default hypervolume implementation is used
-
isHypervolumeInverted
public static boolean isHypervolumeInverted()Returnstrue
if the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwisefalse
.- Returns:
true
if the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwisefalse
-
isHypervolumeEnabled
public static boolean isHypervolumeEnabled()Returnstrue
if hypervolume calculation is enabled;false
otherwise. When disabled, the hypervolume should be reported asDouble.NaN
. Direct use of theHypervolume
class remains unaffected by this option.- Returns:
true
if hypervolume calculation is enabled;false
otherwise
-
getProblemSpecificMinimumBounds
Returns the configured minimum bounds (ideal point) used for normalization, ornull
if not configured.- Parameters:
problem
- the problem name- Returns:
- the minimum bounds or
null
-
getProblemSpecificMaximumBounds
Returns the configured maximum bounds (reference point) used for normalization, ornull
if 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
null
if no override provided
-
isNormalizationDisabled
Returnstrue
if normalization has been disabled for the given problem instance.- Parameters:
problem
- the problem name- Returns:
true
if disabled;false
otherwise
-
isProtectedFunctions
public static boolean isProtectedFunctions()Returnstrue
if genetic programming functions should use protection against invalid arguments that would otherwise result inNaN
or other invalid values;false
otherwise.- Returns:
true
if genetic programming functions should use protection against invalid arguments that would otherwise result inNaN
or other invalid values;false
otherwise
-
isExternalProblemDebuggingEnabled
public static boolean isExternalProblemDebuggingEnabled()Returnstrue
if debugging is enabled when running external problems.- Returns:
true
if debugging for external problems is enabled;false
otherwise
-
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()Returnstrue
if the CMA-ES algorithm has consistency checks enabled.- Returns:
true
if the CMA-ES algorithm has consistency checks enabled;false
otherwise
-
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
-