首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Optaplanner: selectionList包含2倍的相同选择

Optaplanner: selectionList包含2倍的相同选择
EN

Stack Overflow用户
提问于 2015-09-16 16:41:09
回答 1查看 253关注 0票数 1

对于optplanner来说,我是新手,并且尝试使用它来解决时间表问题,但是在所有设置之后,当我试图解决这个问题时,我会得到以下错误:

代码语言:javascript
复制
java.lang.IllegalStateException: The selectionList contains 2 times the same selection (c0001{t000}-0 @ null + null) and (c0001{t000}-1 @ null + null).
    at org.optaplanner.core.impl.heuristic.selector.common.decorator.WeightFactorySelectionSorter.sort(WeightFactorySelectionSorter.java:58)
    at org.optaplanner.core.impl.heuristic.selector.entity.decorator.SortingEntitySelector.constructCache(SortingEntitySelector.java:44)
    at org.optaplanner.core.impl.heuristic.selector.common.SelectionCacheLifecycleBridge.phaseStarted(SelectionCacheLifecycleBridge.java:49)
    at org.optaplanner.core.impl.phase.event.PhaseLifecycleSupport.firePhaseStarted(PhaseLifecycleSupport.java:39)
    at org.optaplanner.core.impl.heuristic.selector.AbstractSelector.phaseStarted(AbstractSelector.java:47)
    at org.optaplanner.core.impl.phase.event.PhaseLifecycleSupport.firePhaseStarted(PhaseLifecycleSupport.java:39)
    at org.optaplanner.core.impl.heuristic.selector.AbstractSelector.phaseStarted(AbstractSelector.java:47)
    at org.optaplanner.core.impl.phase.event.PhaseLifecycleSupport.firePhaseStarted(PhaseLifecycleSupport.java:39)
    at org.optaplanner.core.impl.constructionheuristic.placer.AbstractEntityPlacer.phaseStarted(AbstractEntityPlacer.java:41)
    at org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase.phaseStarted(DefaultConstructionHeuristicPhase.java:124)
    at org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase.solve(DefaultConstructionHeuristicPhase.java:67)
    at org.optaplanner.core.impl.solver.DefaultSolver.runPhases(DefaultSolver.java:214)
    at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:176)

以前有没有人遇到过这种情况,如果你遇到了,你能帮忙吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-17 07:09:51

它看起来像是dataset中的一个问题(或者是域对象的equals()方法中的问题)。

selectionList包含2倍相同的选择(c0001{t000}-0 @ null + null)和(c0001{t000}-1 @ null + null)。

它认为这两个讲座是一样的:

  • C 0001 .-0 //当然是0001
  • C 0001 .-1 //当然是0001

显然,它们是不平等的,因为它们有不同的lectureIndexInCourse。

课程继承了AbstractPersistable的“等于”方法,该方法基于id进行等式。

我敢打赌,您在dataset中的讲座要么有空id,要么有副本。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32614204

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档