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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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)As defined byconsecutive(ToIntFunction).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)As defined byconsecutive(ToIntFunction).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)As defined byconsecutive(ToIntFunction).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 returnsConsecutiveInfoabout the first fact.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)As defined byconsecutiveIntervals(Function,Function,BiFunction).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)As defined byconsecutiveIntervals(ToLongFunction, ToLongFunction).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)As defined byconsecutiveIntervals(Function,Function,BiFunction).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)As defined byconsecutiveIntervals(ToLongFunction, ToLongFunction).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)As defined byconsecutiveIntervals(Function,Function,BiFunction).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)As defined byconsecutiveIntervals(ToLongFunction, ToLongFunction).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 returnsConsecutiveIntervalInfoabout the first fact.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)Specialized version ofconsecutiveIntervals(Function,Function,BiFunction)for Long.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)As defined byconsecutiveTemporalIntervals(Function,Function).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)As defined byconsecutiveTemporalIntervals(Function,Function).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)As defined byconsecutiveTemporalIntervals(Function,Function).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)Specialized version ofconsecutiveIntervals(Function,Function,BiFunction)forTemporaltypes.
-
-
-
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 returnsConsecutiveInfoabout 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)
As defined byconsecutive(ToIntFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factResult- type of item in the sequence- Parameters:
resultMap- Maps both facts to an item in the sequenceindexMap- 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)
As defined byconsecutive(ToIntFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factResult- type of item in the sequence- Parameters:
resultMap- Maps the three facts to an item in the sequenceindexMap- 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)
As defined byconsecutive(ToIntFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factD- type of the fourth mapped factResult- type of item in the sequence- Parameters:
resultMap- Maps the four facts to an item in the sequenceindexMap- 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 returnsConsecutiveIntervalInfoabout 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 factPointType_- type of the fact endpointsDifferenceType_- type of difference between points- Parameters:
startMap- Maps the fact to its startendMap- Maps the fact to its enddifferenceFunction- 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)
Specialized version ofconsecutiveIntervals(Function,Function,BiFunction)forTemporaltypes.- Type Parameters:
A- type of the first mapped factPointType_- temporal type of the endpoints- Parameters:
startMap- Maps the fact to its startendMap- 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)
Specialized version ofconsecutiveIntervals(Function,Function,BiFunction)for Long.- Type Parameters:
A- type of the first mapped fact- Parameters:
startMap- Maps the fact to its startendMap- 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)
As defined byconsecutiveIntervals(Function,Function,BiFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factIntervalType_- type of the item in the clusterPointType_- type of the item endpointsDifferenceType_- type of difference between points- Parameters:
intervalMap- Maps both facts to an item in the clusterstartMap- Maps the item to its startendMap- Maps the item to its enddifferenceFunction- 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)
As defined byconsecutiveTemporalIntervals(Function,Function).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factIntervalType_- type of the item in the clusterPointType_- temporal type of the endpoints- Parameters:
intervalMap- Maps the three facts to an item in the clusterstartMap- Maps the fact to its startendMap- 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)
As defined byconsecutiveIntervals(ToLongFunction, ToLongFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factIntervalType_- type of the item in the cluster- Parameters:
startMap- Maps the fact to its startendMap- 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)
As defined byconsecutiveIntervals(Function,Function,BiFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factIntervalType_- type of the item in the clusterPointType_- type of the item endpointsDifferenceType_- type of difference between points- Parameters:
intervalMap- Maps the three facts to an item in the clusterstartMap- Maps the item to its startendMap- Maps the item to its enddifferenceFunction- 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)
As defined byconsecutiveTemporalIntervals(Function,Function).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factIntervalType_- type of the item in the clusterPointType_- temporal type of the endpoints- Parameters:
intervalMap- Maps the three facts to an item in the clusterstartMap- Maps the fact to its startendMap- 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)
As defined byconsecutiveIntervals(ToLongFunction, ToLongFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factIntervalType_- type of the item in the cluster- Parameters:
startMap- Maps the fact to its startendMap- 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)
As defined byconsecutiveIntervals(Function,Function,BiFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factD- type of the fourth mapped factIntervalType_- type of the item in the clusterPointType_- type of the item endpointsDifferenceType_- type of difference between points- Parameters:
intervalMap- Maps the four facts to an item in the clusterstartMap- Maps the item to its startendMap- Maps the item to its enddifferenceFunction- 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)
As defined byconsecutiveTemporalIntervals(Function,Function).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factD- type of the fourth mapped factIntervalType_- type of the item in the clusterPointType_- temporal type of the endpoints- Parameters:
intervalMap- Maps the three facts to an item in the clusterstartMap- Maps the fact to its startendMap- 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)
As defined byconsecutiveIntervals(ToLongFunction, ToLongFunction).- Type Parameters:
A- type of the first mapped factB- type of the second mapped factC- type of the third mapped factD- type of the fourth mapped factIntervalType_- type of the item in the cluster- Parameters:
startMap- Maps the fact to its startendMap- Maps the fact to its end- Returns:
- never null
-
-