What is the Python equivalent class (SequenceChain) and method (getConsecutiveSequences()) for the following Java Timefold piece of code?
flattenLast(SequenceChain::getConsecutiveSequences)
This line of code is used in one of the Quickstart examples like this:
protected Constraint multipleConsecutiveHomeMatches(ConstraintFactory constraintFactory) {
return constraintFactory.forEach(Match.class)
.join(Team.class, equal(Match::getHomeTeam, Function.identity()))
.groupBy((match, team) -> team,
ConstraintCollectors.toConsecutiveSequences((match, team) -> match.getRound(), Round::getIndex))
.flattenLast(SequenceChain::getConsecutiveSequences)
.filter((team, matches) -> matches.getCount() >= MAX_CONSECUTIVE_MATCHES)
.penalize(HardSoftScore.ONE_HARD, (team, matches) -> matches.getCount())
.asConstraint("4 or more consecutive home matches");
}
One of the tests suggests that it is SequenceChain.getConsecutiveSequences()
.