Class Settings

java.lang.Object
org.moeaframework.core.Settings

public class Settings extends Object
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 Details

    • EPS

      public static final double EPS
      Level of significance or machine precision.
      See Also:
    • BUFFER_SIZE

      public static final int BUFFER_SIZE
      The default buffer size. Currently set to 4096 bytes.
      See Also:
    • DEFAULT_POPULATION_SIZE

      public static final int DEFAULT_POPULATION_SIZE
      The default population size.
      See Also:
    • DEFAULT_CONFIGURATION_FILE

      public static final String DEFAULT_CONFIGURATION_FILE
      The default configuration file.
      See Also:
    • PROPERTIES

      public static final TypedProperties PROPERTIES
      The global properties object.
    • KEY_CONFIGURATION_FILE

      public static final String KEY_CONFIGURATION_FILE
      The property key for setting the configuration file. This defaults to "moeaframework.properties" if unset.
    • KEY_VERBOSE

      public static final String KEY_VERBOSE
      The property key for enabling verbose logging.
    • KEY_PRNG_SEED

      public static final String 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

      public static final String KEY_HELP_WIDTH
      The property key for setting the display width of help messages from command line tools.
    • KEY_DUPLICATE_MODE

      public static final String KEY_DUPLICATE_MODE
      The property key for how to handle duplicate solutions in a nondominated population.
    • KEY_GD_POWER

      public static final String KEY_GD_POWER
      The property key for the power used in the generational distance calculation.
    • KEY_IGD_POWER

      public static final String KEY_IGD_POWER
      The property key for the power used in the inverted generational distance calculation.
    • KEY_FAST_NONDOMINATED_SORTING

      public static final String KEY_FAST_NONDOMINATED_SORTING
      The property key to indicate that fast non-dominated sorting should be used.
    • KEY_SUPPRESS_TRUNCATION_WARNING

      public static final String KEY_SUPPRESS_TRUNCATION_WARNING
      The property key to indicate that truncation warnings should be suppressed.
    • KEY_CONTINUITY_CORRECTION

      public static final String KEY_CONTINUITY_CORRECTION
      The property key for the continuity correction flag.
    • KEY_HYPERVOLUME_DELTA

      public static final String KEY_HYPERVOLUME_DELTA
      The property key for the hypervolume delta when determining the reference point.
    • KEY_HYPERVOLUME

      public static final String KEY_HYPERVOLUME
      The property key for the hypervolume command.
    • KEY_HYPERVOLUME_INVERTED

      public static final String KEY_HYPERVOLUME_INVERTED
      The property key for the hypervolume inversion flag.
    • KEY_HYPERVOLUME_ENABLED

      public static final String KEY_HYPERVOLUME_ENABLED
      The property key for the hypervolume flag.
    • KEY_PROBLEM_PREFIX

      public static final String KEY_PROBLEM_PREFIX
      The prefix for all problem property keys.
    • KEY_PROBLEM_LIST

      public static final String KEY_PROBLEM_LIST
      The property key for the list of available problems.
    • KEY_DIAGNOSTIC_TOOL_ALGORITHMS

      public static final String KEY_DIAGNOSTIC_TOOL_ALGORITHMS
      The property key for the algorithms available in the diagnostic tool.
    • KEY_DIAGNOSTIC_TOOL_PROBLEMS

      public static final String KEY_DIAGNOSTIC_TOOL_PROBLEMS
      The property key for the problems available in the diagnostic tool.
    • KEY_CMAES_CHECK_CONSISTENCY

      public static final String KEY_CMAES_CHECK_CONSISTENCY
      The property key for enabling consistency checks in the CMA-ES algorithm.
    • KEY_GP_PROTECTED_FUNCTIONS

      public static final String KEY_GP_PROTECTED_FUNCTIONS
      The property key for the genetic programming protected functions flag.
    • KEY_EXTERNAL_PROBLEM_DEBUGGING_DEPRECATED

      @Deprecated public static final String KEY_EXTERNAL_PROBLEM_DEBUGGING_DEPRECATED
      Deprecated.
      The property key for enabling debugging info when running external problems.
    • KEY_EXTERNAL_PROBLEM_DEBUGGING

      public static final String KEY_EXTERNAL_PROBLEM_DEBUGGING
      The property key for enabling debugging info when running external problems.
    • KEY_EXTERNAL_RETRY_ATTEMPTS

      public static final String KEY_EXTERNAL_RETRY_ATTEMPTS
      The property key for configuring the number of retry attempts when running external problems.
    • KEY_EXTERNAL_RETRY_DELAY

      public static final String KEY_EXTERNAL_RETRY_DELAY
      The property key for configuring the retry delay when running external problems.
    • KEY_EXTERNAL_SHUTDOWN_TIMEOUT

      public static final String 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()
      Returns true if verbose logging is enabled; false otherwise.
      Returns:
      true if verbose logging is enabled; false otherwise
    • isContinuityCorrection

      public static boolean isContinuityCorrection()
      Returns true 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

      public static NondominatedPopulation.DuplicateMode 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()
      Returns true if fast non-dominated sorting should be used; or false if the naive non-dominated sorting implementation is preferred. The default is false 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; or false if the naive non-dominated sorting implementation is preferred
    • isSuppressTruncationWarning

      public static boolean isSuppressTruncationWarning()
      Returns true if truncation warnings, when implicitly converting a real-valued property to an integer and truncating the decimal value, should be suppressed.
      Returns:
      true if truncation warnings are suppressed; false otherwise
    • 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

      public static String getHypervolume()
      Returns the native hypervolume command; or null if the default hypervolume implementation is used. The default hypervolume implementation may become computationally prohibitive on large approximation sets or at high dimensions. See NativeHypervolume 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()
      Returns true if the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwise false.
      Returns:
      true if the approximation set is inverted prior to being passed to the custom hypervolume implementation; otherwise false
    • isHypervolumeEnabled

      public static boolean isHypervolumeEnabled()
      Returns true if hypervolume calculation is enabled; false otherwise. When disabled, the hypervolume should be reported as Double.NaN. Direct use of the Hypervolume class remains unaffected by this option.
      Returns:
      true if hypervolume calculation is enabled; false otherwise
    • getProblemSpecificMinimumBounds

      public static double[] getProblemSpecificMinimumBounds(String problem)
      Returns the configured minimum bounds (ideal point) used for normalization, or null if not configured.
      Parameters:
      problem - the problem name
      Returns:
      the minimum bounds or null
    • getProblemSpecificMaximumBounds

      public static double[] getProblemSpecificMaximumBounds(String problem)
      Returns the configured maximum bounds (reference point) used for normalization, or null if not configured.
      Parameters:
      problem - the problem name
      Returns:
      the maximum bounds or null
    • getProblemSpecificHypervolumeDelta

      public static double getProblemSpecificHypervolumeDelta(String problem)
      Returns a problem-specific delta used for hypervolume calculations, or the default from getHypervolumeDelta() if no problem-specific value is configured.
      Parameters:
      problem - the problem name
      Returns:
      the hypervolume delta
    • getProblemSpecificEpsilons

      public static Epsilons getProblemSpecificEpsilons(String problem)
      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

      public static boolean isNormalizationDisabled(String problem)
      Returns true if normalization has been disabled for the given problem instance.
      Parameters:
      problem - the problem name
      Returns:
      true if disabled; false otherwise
    • getProblems

      public static Set<String> getProblems()
      Returns the list of available problems. This allows enumerating additional problems without the need for defining and registering a service provider on the classpath.
      Returns:
      the list of available problems
    • getProblemClass

      public static String getProblemClass(String name)
      Returns the class for the specified problem.
      Parameters:
      name - the problem name
      Returns:
      the class for the specified problem
    • getProblemReferenceSet

      public static String getProblemReferenceSet(String name)
      Returns the reference set filename for the specified problem.
      Parameters:
      name - the problem name
      Returns:
      the reference set filename for the specified problem
    • getDiagnosticToolAlgorithms

      public static Set<String> getDiagnosticToolAlgorithms()
      Returns the list of algorithms displayed in the diagnostic tool GUI.
      Returns:
      the list of algorithms displayed in the diagnostic tool GUI
    • getDiagnosticToolProblems

      public static Set<String> getDiagnosticToolProblems()
      Returns the list of problems displayed in the diagnostic tool GUI.
      Returns:
      the list of problems displayed in the diagnostic tool GUI
    • isProtectedFunctions

      public static boolean isProtectedFunctions()
      Returns true if genetic programming functions should use protection against invalid arguments that would otherwise result in NaN or other invalid values; false otherwise.
      Returns:
      true if genetic programming functions should use protection against invalid arguments that would otherwise result in NaN or other invalid values; false otherwise
    • isExternalProblemDebuggingEnabled

      public static boolean isExternalProblemDebuggingEnabled()
      Returns true 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

      public static Duration getExternalProblemRetryDelay()
      Returns the delay, given in seconds, between retry attempts when connecting to an external problem with sockets.
      Returns:
      the retry delay
    • getExternalProblemShutdownTimeout

      public static Duration 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()
      Returns true if the CMA-ES algorithm has consistency checks enabled.
      Returns:
      true if the CMA-ES algorithm has consistency checks enabled; false otherwise
    • getIcon

      public static MultiResolutionImage getIcon()
      Returns the MOEA Framework icon, supporting a varient of sizes.
      Returns:
      the MOEA Framework icon
    • createKey

      public static String createKey(String prefix, String... parts)
      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 key
      parts - remaining parts of the key
      Returns:
      the full key
    • createScope

      public static PropertyScope createScope()
      Creates a new scope wherein settings can be temporarily modified. Upon closing the scope, the original settings are restored.
      Returns:
      the scope