问题描述
我正在尝试根据与参与者的会话来解决日程安排问题。 同时开始且参与者相似的会议应受到处罚。
这是我的@PlanningEntity类:
@PlanningEntity
data class Session(
@PlanningId
val id: Long = 0L,val name: String = "",val participants: List<Participant> = emptyList(),@PlanningVariable(valueRangeProviderRefs = ["timeSlotRange"])
val timeslot: Timeslot = Timeslot()
)
@PlanningVariable看起来像这样:
data class Timeslot (
val room: Room = Room(),val time: String = "0:00"
)
我尝试使用以下代码在ConstraintProvider中解决此问题:
private fun collisionScore(constraintFactory: ConstraintFactory): Constraint {
return constraintFactory.fromUniquePair(Session::class.java,equal(Session::getTime),filtering({a,b -> a.participants.any(b.participants::contains)}))
.penalize("collisions",HardSoftScore.ONE_SOFT)
}
但这会导致以下error
:
java.lang.IllegalArgumentException: The joiner class (class org.optaplanner.core.impl.score.stream.bi.FilteringBiJoiner) is not supported.
at org.optaplanner.core.impl.score.stream.bi.AbstractBiJoiner.merge(AbstractBiJoiner.java:52)
at org.optaplanner.core.api.score.stream.ConstraintFactory.fromUniquePair(ConstraintFactory.java:138)
是否有简单的解决方案可以根据参与者列表来惩罚这些冲突? 谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)