admin管理员组文章数量:1123371
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");
}
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");
}
Share
Improve this question
edited 12 hours ago
Mark Rotteveel
109k225 gold badges155 silver badges218 bronze badges
asked 13 hours ago
Diallo Francis PatrickDiallo Francis Patrick
14710 bronze badges
1 Answer
Reset to default 1One of the tests suggests that it is SequenceChain.getConsecutiveSequences()
.
本文标签: optaplannerPython equivalent for SequnceChain class in TimefoldStack Overflow
版权声明:本文标题:optaplanner - Python equivalent for SequnceChain class in Timefold - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736565671a1944699.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论