java.lang.Object
java.lang.Enum<SelectionOrder>
org.optaplanner.core.config.heuristic.selector.common.SelectionOrder
All Implemented Interfaces:
Serializable, Comparable<SelectionOrder>

public enum SelectionOrder extends Enum<SelectionOrder>
Defines in which order the elements or a selector are selected.
  • Enum Constant Details

    • INHERIT

      public static final SelectionOrder INHERIT
      Inherit the value from the parent SelectorConfig. If the parent is cached, the value is changed to ORIGINAL.

      This is the default. If there is no such parent, then it defaults to RANDOM.

    • ORIGINAL

      public static final SelectionOrder ORIGINAL
      Select the elements in original order.
    • SORTED

      public static final SelectionOrder SORTED
      Select in sorted order by sorting the elements. Each element will be selected exactly once (if all elements end up being selected). Requires SelectionCacheType.STEP or higher.
    • RANDOM

      public static final SelectionOrder RANDOM
      Select in random order, without shuffling the elements. Each element might be selected multiple times. Scales well because it does not require caching.
    • SHUFFLED

      public static final SelectionOrder SHUFFLED
      Select in random order by shuffling the elements when a selection iterator is created. Each element will be selected exactly once (if all elements end up being selected). Requires SelectionCacheType.STEP or higher.
    • PROBABILISTIC

      public static final SelectionOrder PROBABILISTIC
      Select in random order, based on the selection probability of each element. Elements with a higher probability have a higher chance to be selected than elements with a lower probability. Each element might be selected multiple times. Requires SelectionCacheType.STEP or higher.
  • Method Details

    • values

      public static SelectionOrder[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static SelectionOrder valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • resolve

      public static SelectionOrder resolve(SelectionOrder selectionOrder, SelectionOrder inheritedSelectionOrder)
      Parameters:
      selectionOrder - sometimes null
      inheritedSelectionOrder - never null
      Returns:
      never null
    • fromRandomSelectionBoolean

      public static SelectionOrder fromRandomSelectionBoolean(boolean randomSelection)
    • toRandomSelectionBoolean

      public boolean toRandomSelectionBoolean()