Class ExperimentalConstraintCollectors

java.lang.Object
ai.timefold.solver.examples.common.experimental.ExperimentalConstraintCollectors

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

    • 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
    • consecutiveTemporalIntervals

      public static <A, PointType_ extends Temporal & Comparable<PointType_>> ai.timefold.solver.core.api.score.stream.uni.UniConstraintCollector<A,IntervalTree<A,PointType_,Duration>,ConsecutiveIntervalInfo<A,PointType_,Duration>> consecutiveTemporalIntervals(Function<A,PointType_> startMap, Function<A,PointType_> endMap)
      Type Parameters:
      A - type of the first mapped fact
      PointType_ - temporal type of the endpoints
      Parameters:
      startMap - Maps the fact to its start
      endMap - Maps the fact to its end
      Returns:
      never null
    • consecutiveIntervals

      public static <A> ai.timefold.solver.core.api.score.stream.uni.UniConstraintCollector<A,IntervalTree<A,Long,Long>,ConsecutiveIntervalInfo<A,Long,Long>> consecutiveIntervals(ToLongFunction<A> startMap, ToLongFunction<A> endMap)
      Type Parameters:
      A - type of the first mapped fact
      Parameters:
      startMap - Maps the fact to its start
      endMap - Maps the fact to its end
      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, IntervalType_> ai.timefold.solver.core.api.score.stream.bi.BiConstraintCollector<A,B,IntervalTree<IntervalType_,Long,Long>,ConsecutiveIntervalInfo<IntervalType_,Long,Long>> consecutiveIntervals(BiFunction<A,B,IntervalType_> intervalMap, ToLongFunction<IntervalType_> startMap, ToLongFunction<IntervalType_> 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
      Parameters:
      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