Interface ComparatorFactory<Solution_,T>

Type Parameters:
Solution_ - the solution type, the class with the PlanningSolution annotation
T - the selection type
All Known Subinterfaces:
PlanningEntity.NullComparatorFactory<Solution_,T>, PlanningEntity.NullDifficultyWeightFactory<Solution_,T>, PlanningVariable.NullComparatorFactory<Solution_,T>, PlanningVariable.NullStrengthWeightFactory<Solution_,T>, SelectionSorterWeightFactory<Solution_,T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@NullMarked @FunctionalInterface public interface ComparatorFactory<Solution_,T>
Creates a Comparable to decide the order of a collection of selections (a selection is a PlanningEntity, a planningValue, a Move or a Selector). The selections are then sorted by some specific metric, normally ascending unless it's configured descending. The property sortManner, present in the selector configurations such as ValueSelectorConfig and EntitySelectorConfig, specifies how the data will be sorted. Additionally, the property constructionHeuristicType from ConstructionHeuristicPhaseConfig can also configure how entities and values are sorted.

Implementations are expected to be stateless. The solver may choose to reuse instances.

See Also:
  • Method Details

    • createComparator

      Comparator<T> createComparator(Solution_ solution)
      Parameters:
      solution - never null, the PlanningSolution to which the selection belongs or applies to
      Returns:
      never null