Enum SelectionOrder
- 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 Summary
Enum Constants Enum Constant Description INHERIT
Inherit the value from the parentSelectorConfig
.ORIGINAL
Select the elements in original order.PROBABILISTIC
Select in random order, based on the selection probability of each element.RANDOM
Select in random order, without shuffling the elements.SHUFFLED
Select in random order by shuffling the elements when a selection iterator is created.SORTED
Select in sorted order by sorting the elements.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SelectionOrder
fromRandomSelectionBoolean(boolean randomSelection)
static SelectionOrder
resolve(SelectionOrder selectionOrder, SelectionOrder inheritedSelectionOrder)
boolean
toRandomSelectionBoolean()
static SelectionOrder
valueOf(String name)
Returns the enum constant of this type with the specified name.static SelectionOrder[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INHERIT
public static final SelectionOrder INHERIT
Inherit the value from the parentSelectorConfig
. If the parent is cached, the value is changed toORIGINAL
.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). RequiresSelectionCacheType.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). RequiresSelectionCacheType.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. RequiresSelectionCacheType.STEP
or higher.
-
-
Method Detail
-
values
public static SelectionOrder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SelectionOrder c : SelectionOrder.values()) System.out.println(c);
- 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 nameNullPointerException
- if the argument is null
-
resolve
public static SelectionOrder resolve(SelectionOrder selectionOrder, SelectionOrder inheritedSelectionOrder)
- Parameters:
selectionOrder
- sometimes nullinheritedSelectionOrder
- never null- Returns:
- never null
-
fromRandomSelectionBoolean
public static SelectionOrder fromRandomSelectionBoolean(boolean randomSelection)
-
toRandomSelectionBoolean
public boolean toRandomSelectionBoolean()
-
-