Class FilteringEntityByEntitySelector<Solution_>

java.lang.Object
ai.timefold.solver.core.impl.heuristic.selector.AbstractSelector<Solution_>
ai.timefold.solver.core.impl.heuristic.selector.AbstractDemandEnabledSelector<Solution_>
ai.timefold.solver.core.impl.heuristic.selector.entity.decorator.FilteringEntityByEntitySelector<Solution_>
Type Parameters:
Solution_ - the solution type
All Implemented Interfaces:
ListIterable<Object>, EntitySelector<Solution_>, IterableSelector<Solution_,Object>, ListIterableSelector<Solution_,Object>, Selector<Solution_>, PhaseLifecycleListener<Solution_>, SolverLifecycleListener<Solution_>, Iterable<Object>, EventListener

public final class FilteringEntityByEntitySelector<Solution_> extends AbstractDemandEnabledSelector<Solution_> implements EntitySelector<Solution_>
The decorator returns a list of reachable entities for a specific entity. It enables the creation of a filtering tier when using entity-provided value ranges, ensuring only valid and reachable entities are returned. An entity is considered reachable to another entity if the assigned values exist within their respective entity value ranges.

The decorator can only be applied to basic variables. e1 = entity_range[v1, v2, v3] e2 = entity_range[v1, v4] e3 = entity_range[v1, v4, v5]

Let's consider the following use-cases:

  1. e1(null) - e2(null): e2 is reachable by e1 because both assigned values are null.
  2. e1(v2) - e2(v1): e2 is not reachable by e1 because its value range does not accept v2.
  3. e2(v1) - e3(v4): e3 is reachable by e2 because e2 accepts v4 and e3 accepts v1.

This node is currently used by the SwapMoveSelector selector. To explain its functionality, let's consider how moves are generated for the basic swap type. Initially, the swap move selector employs a left entity selector to choose one entity. Then, it uses a right entity selector to select another entity, with the goal of swapping their values.

Based on the previously described process and the current goal of this node, we can observe that once an entity is selected using the left selector, the right node can filter out all non-reachable entities and generate a valid move. A move is considered valid only if both entities accept each other's values. The filtering process of invalid entities allows the solver to explore the solution space more efficiently.

See Also: