Class ExperimentalConstraintCollectors


  • public class ExperimentalConstraintCollectors
    extends Object
    A collection of experimental constraint collectors subject to change in future versions.
    • Method Detail

      • consecutive

        public static <A> ai.timefold.solver.core.api.score.stream.uni.UniConstraintCollector<A,​ConsecutiveSetTree<A,​Integer,​Integer>,​ConsecutiveInfo<A,​Integer>> consecutive​(ToIntFunction<A> indexMap)
        Creates a constraint collector that returns ConsecutiveInfo about the first fact. For instance, [Shift slot=1] [Shift slot=2] [Shift slot=4] [Shift slot=6] returns the following information:
         
         Consecutive Lengths: 2, 1, 1
         Break Lengths: 1, 2
         Consecutive Items: [[Shift slot=1] [Shift slot=2]], [[Shift slot=4]], [[Shift slot=6]]
         
         
        Type Parameters:
        A - type of the first mapped fact
        Parameters:
        indexMap - Maps the fact to its position in the sequence
        Returns:
        never null
      • consecutive

        public static <A,​B,​Result> ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector<A,​B,​ConsecutiveSetTree<Result,​Integer,​Integer>,​ConsecutiveInfo<Result,​Integer>> consecutive​(BiFunction<A,​B,​Result> resultMap,
                                                                                                                                                                                                                                                 ToIntFunction<Result> indexMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        Result - type of item in the sequence
        Parameters:
        resultMap - Maps both facts to an item in the sequence
        indexMap - Maps the item to its position in the sequence
        Returns:
        never null
      • consecutive

        public static <A,​B,​C,​Result> ai.timefold.solver.core.api.score.stream.tri.TriConstraintCollector<A,​B,​C,​ConsecutiveSetTree<Result,​Integer,​Integer>,​ConsecutiveInfo<Result,​Integer>> consecutive​(ai.timefold.solver.core.api.function.TriFunction<A,​B,​C,​Result> resultMap,
                                                                                                                                                                                                                                                                   ToIntFunction<Result> indexMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        Result - type of item in the sequence
        Parameters:
        resultMap - Maps the three facts to an item in the sequence
        indexMap - Maps the item to its position in the sequence
        Returns:
        never null
      • consecutive

        public static <A,​B,​C,​D,​Result> ai.timefold.solver.core.api.score.stream.quad.QuadConstraintCollector<A,​B,​C,​D,​ConsecutiveSetTree<Result,​Integer,​Integer>,​ConsecutiveInfo<Result,​Integer>> consecutive​(ai.timefold.solver.core.api.function.QuadFunction<A,​B,​C,​D,​Result> resultMap,
                                                                                                                                                                                                                                                                                     ToIntFunction<Result> indexMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        D - type of the fourth mapped fact
        Result - type of item in the sequence
        Parameters:
        resultMap - Maps the four facts to an item in the sequence
        indexMap - Maps the item to its position in the sequence
        Returns:
        never null
      • consecutiveIntervals

        public static <A,​PointType_ extends Comparable<PointType_>,​DifferenceType_ extends Comparable<DifferenceType_>> ai.timefold.solver.core.api.score.stream.uni.UniConstraintCollector<A,​IntervalTree<A,​PointType_,​DifferenceType_>,​ConsecutiveIntervalInfo<A,​PointType_,​DifferenceType_>> consecutiveIntervals​(Function<A,​PointType_> startMap,
                                                                                                                                                                                                                                                                                                                                                                     Function<A,​PointType_> endMap,
                                                                                                                                                                                                                                                                                                                                                                     BiFunction<PointType_,​PointType_,​DifferenceType_> differenceFunction)
        Creates a constraint collector that returns ConsecutiveIntervalInfo about the first fact. For instance, [Shift from=2, to=4] [Shift from=3, to=5] [Shift from=6, to=7] [Shift from=7, to=8] returns the following information:
         
         IntervalClusters: [[Shift from=2, to=4] [Shift from=3, to=5]], [[Shift from=6, to=7] [Shift from=7, to=8]]
         Breaks: [[Break from=5, to=6, length=1]]
         
         
        Type Parameters:
        A - type of the first mapped fact
        PointType_ - type of the fact endpoints
        DifferenceType_ - type of difference between points
        Parameters:
        startMap - Maps the fact to its start
        endMap - Maps the fact to its end
        differenceFunction - Computes the difference between two points. The second argument is always larger than the first (ex: Duration.between(java.time.temporal.Temporal, java.time.temporal.Temporal) or (a,b) -> b - a).
        Returns:
        never null
      • consecutiveIntervals

        public static <A,​B,​IntervalType_,​PointType_ extends Comparable<PointType_>,​DifferenceType_ extends Comparable<DifferenceType_>> ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector<A,​B,​IntervalTree<IntervalType_,​PointType_,​DifferenceType_>,​ConsecutiveIntervalInfo<IntervalType_,​PointType_,​DifferenceType_>> consecutiveIntervals​(BiFunction<A,​B,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                                                                                                                                               Function<IntervalType_,​PointType_> startMap,
                                                                                                                                                                                                                                                                                                                                                                                                                               Function<IntervalType_,​PointType_> endMap,
                                                                                                                                                                                                                                                                                                                                                                                                                               BiFunction<PointType_,​PointType_,​DifferenceType_> differenceFunction)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        IntervalType_ - type of the item in the cluster
        PointType_ - type of the item endpoints
        DifferenceType_ - type of difference between points
        Parameters:
        intervalMap - Maps both facts to an item in the cluster
        startMap - Maps the item to its start
        endMap - Maps the item to its end
        differenceFunction - Computes the difference between two points. The second argument is always larger than the first (ex: Duration.between(java.time.temporal.Temporal, java.time.temporal.Temporal) or (a,b) -> b - a).
        Returns:
        never null
      • consecutiveTemporalIntervals

        public static <A,​B,​IntervalType_,​PointType_ extends Temporal & Comparable<PointType_>> ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector<A,​B,​IntervalTree<IntervalType_,​PointType_,​Duration>,​ConsecutiveIntervalInfo<IntervalType_,​PointType_,​Duration>> consecutiveTemporalIntervals​(BiFunction<A,​B,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                                                                                          Function<IntervalType_,​PointType_> startMap,
                                                                                                                                                                                                                                                                                                                                                                          Function<IntervalType_,​PointType_> endMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        IntervalType_ - type of the item in the cluster
        PointType_ - temporal type of the endpoints
        Parameters:
        intervalMap - Maps the three facts to an item in the cluster
        startMap - Maps the fact to its start
        endMap - Maps the fact to its end
        Returns:
        never null
      • consecutiveIntervals

        public static <A,​B,​C,​IntervalType_,​PointType_ extends Comparable<PointType_>,​DifferenceType_ extends Comparable<DifferenceType_>> ai.timefold.solver.core.api.score.stream.tri.TriConstraintCollector<A,​B,​C,​IntervalTree<IntervalType_,​PointType_,​DifferenceType_>,​ConsecutiveIntervalInfo<IntervalType_,​PointType_,​DifferenceType_>> consecutiveIntervals​(ai.timefold.solver.core.api.function.TriFunction<A,​B,​C,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                                                                                                                                                                 Function<IntervalType_,​PointType_> startMap,
                                                                                                                                                                                                                                                                                                                                                                                                                                                 Function<IntervalType_,​PointType_> endMap,
                                                                                                                                                                                                                                                                                                                                                                                                                                                 BiFunction<PointType_,​PointType_,​DifferenceType_> differenceFunction)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        IntervalType_ - type of the item in the cluster
        PointType_ - type of the item endpoints
        DifferenceType_ - type of difference between points
        Parameters:
        intervalMap - Maps the three facts to an item in the cluster
        startMap - Maps the item to its start
        endMap - Maps the item to its end
        differenceFunction - Computes the difference between two points. The second argument is always larger than the first (ex: Duration.between(java.time.temporal.Temporal, java.time.temporal.Temporal) or (a,b) -> b - a).
        Returns:
        never null
      • consecutiveTemporalIntervals

        public static <A,​B,​C,​IntervalType_,​PointType_ extends Temporal & Comparable<PointType_>> ai.timefold.solver.core.api.score.stream.tri.TriConstraintCollector<A,​B,​C,​IntervalTree<IntervalType_,​PointType_,​Duration>,​ConsecutiveIntervalInfo<IntervalType_,​PointType_,​Duration>> consecutiveTemporalIntervals​(ai.timefold.solver.core.api.function.TriFunction<A,​B,​C,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                                                                                                            Function<IntervalType_,​PointType_> startMap,
                                                                                                                                                                                                                                                                                                                                                                                            Function<IntervalType_,​PointType_> endMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        IntervalType_ - type of the item in the cluster
        PointType_ - temporal type of the endpoints
        Parameters:
        intervalMap - Maps the three facts to an item in the cluster
        startMap - Maps the fact to its start
        endMap - Maps the fact to its end
        Returns:
        never null
      • consecutiveIntervals

        public static <A,​B,​C,​IntervalType_> ai.timefold.solver.core.api.score.stream.tri.TriConstraintCollector<A,​B,​C,​IntervalTree<IntervalType_,​Long,​Long>,​ConsecutiveIntervalInfo<IntervalType_,​Long,​Long>> consecutiveIntervals​(ai.timefold.solver.core.api.function.TriFunction<A,​B,​C,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                     ToLongFunction<IntervalType_> startMap,
                                                                                                                                                                                                                                                                                                     ToLongFunction<IntervalType_> endMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        IntervalType_ - type of the item in the cluster
        Parameters:
        startMap - Maps the fact to its start
        endMap - Maps the fact to its end
        Returns:
        never null
      • consecutiveIntervals

        public static <A,​B,​C,​D,​IntervalType_,​PointType_ extends Comparable<PointType_>,​DifferenceType_ extends Comparable<DifferenceType_>> ai.timefold.solver.core.api.score.stream.quad.QuadConstraintCollector<A,​B,​C,​D,​IntervalTree<IntervalType_,​PointType_,​DifferenceType_>,​ConsecutiveIntervalInfo<IntervalType_,​PointType_,​DifferenceType_>> consecutiveIntervals​(ai.timefold.solver.core.api.function.QuadFunction<A,​B,​C,​D,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Function<IntervalType_,​PointType_> startMap,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Function<IntervalType_,​PointType_> endMap,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                   BiFunction<PointType_,​PointType_,​DifferenceType_> differenceFunction)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        D - type of the fourth mapped fact
        IntervalType_ - type of the item in the cluster
        PointType_ - type of the item endpoints
        DifferenceType_ - type of difference between points
        Parameters:
        intervalMap - Maps the four facts to an item in the cluster
        startMap - Maps the item to its start
        endMap - Maps the item to its end
        differenceFunction - Computes the difference between two points. The second argument is always larger than the first (ex: Duration.between(java.time.temporal.Temporal, java.time.temporal.Temporal) or (a,b) -> b - a).
        Returns:
        never null
      • consecutiveTemporalIntervals

        public static <A,​B,​C,​D,​IntervalType_,​PointType_ extends Temporal & Comparable<PointType_>> ai.timefold.solver.core.api.score.stream.quad.QuadConstraintCollector<A,​B,​C,​D,​IntervalTree<IntervalType_,​PointType_,​Duration>,​ConsecutiveIntervalInfo<IntervalType_,​PointType_,​Duration>> consecutiveTemporalIntervals​(ai.timefold.solver.core.api.function.QuadFunction<A,​B,​C,​D,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                                                                                                                              Function<IntervalType_,​PointType_> startMap,
                                                                                                                                                                                                                                                                                                                                                                                                              Function<IntervalType_,​PointType_> endMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        D - type of the fourth mapped fact
        IntervalType_ - type of the item in the cluster
        PointType_ - temporal type of the endpoints
        Parameters:
        intervalMap - Maps the three facts to an item in the cluster
        startMap - Maps the fact to its start
        endMap - Maps the fact to its end
        Returns:
        never null
      • consecutiveIntervals

        public static <A,​B,​C,​D,​IntervalType_> ai.timefold.solver.core.api.score.stream.quad.QuadConstraintCollector<A,​B,​C,​D,​IntervalTree<IntervalType_,​Long,​Long>,​ConsecutiveIntervalInfo<IntervalType_,​Long,​Long>> consecutiveIntervals​(ai.timefold.solver.core.api.function.QuadFunction<A,​B,​C,​D,​IntervalType_> intervalMap,
                                                                                                                                                                                                                                                                                                                       ToLongFunction<IntervalType_> startMap,
                                                                                                                                                                                                                                                                                                                       ToLongFunction<IntervalType_> endMap)
        Type Parameters:
        A - type of the first mapped fact
        B - type of the second mapped fact
        C - type of the third mapped fact
        D - type of the fourth mapped fact
        IntervalType_ - type of the item in the cluster
        Parameters:
        startMap - Maps the fact to its start
        endMap - Maps the fact to its end
        Returns:
        never null