我正在构建一个基于Optaplanner车辆路线网络示例护士列队的Web应用程序。当我尝试从JBoss WildFly 8.x中的Eclipse中运行它时,它只运行到构建启发式阶段,然后停留在那里,没有任何进展。 有趣的是,代码实际上是从optaplanner 6.3.0-final发行版的护士列表示例中移除的。在Windows应用程序,它运行平稳,没有任何麻烦或卡住。Optaplanner解决阶段滞留在施工启发阶段
更新
我终于来设置日志级别追查,这里是出来的日志:
2016-04-06 23:10:49,930 INFO [org.optaplanner.webexamples.nurserostering.rest.persistence.NurseRosteringDao] (default task-11) Opened: D:\Users\Administrator\wildfly-8.2.1.Final\standalone\deployments\optaplanner-webexamples.war\WEB-INF\classes\org\optaplanner\webexamples\nurserostering\data\team-machine1.xml
2016-04-06 23:10:59,194 TRACE [org.optaplanner.core.impl.domain.solution.descriptor.SolutionDescriptor] (default task-12) Model annotations parsed for Solution NurseRoster:
2016-04-06 23:10:59,195 TRACE [org.optaplanner.core.impl.domain.solution.descriptor.SolutionDescriptor] (default task-12) Entity ShiftAssignment:
2016-04-06 23:10:59,195 TRACE [org.optaplanner.core.impl.domain.solution.descriptor.SolutionDescriptor] (default task-12) Variable employee (genuine)
2016-04-06 23:11:03,850 INFO [org.drools.compiler.kie.builder.impl.KieRepositoryImpl] (default task-12) KieModule was added: MemoryKieModule[releaseId=org.default:artifact:1.0.0-SNAPSHOT]
2016-04-06 23:11:04,499 INFO [org.optaplanner.core.impl.solver.DefaultSolver] (pool-6-thread-1) Solving started: time spent (395), best score (uninitialized/0hard/-260soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
2016-04-06 23:11:04,505 TRACE [org.optaplanner.core.impl.heuristic.selector.value.decorator.SortingValueSelector] (pool-6-thread-1) Created cachedValueList: size (10), valueSelector (Sorting(FromSolutionPropertyValueSelector(employee))).
2016-04-06 23:11:04,508 TRACE [org.optaplanner.core.impl.heuristic.selector.value.decorator.SortingValueSelector] (pool-6-thread-1) Sorted cachedValueList: size (10), valueSelector (Sorting(FromSolutionPropertyValueSelector(employee))).
2016-04-06 23:11:04,665 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (0), score (0hard/-260soft), move (2010-01-01(Fri)[email protected] {null -> A(A)}).
2016-04-06 23:11:04,676 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (1), score (-1hard/-259soft), move (2010-01-01(Fri)[email protected] {null -> B(B)}).
2016-04-06 23:11:04,682 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (2), score (-1hard/-260soft), move (2010-01-01(Fri)[email protected] {null -> C(C)}).
2016-04-06 23:11:04,699 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (3), score (0hard/-260soft), move (2010-01-01(Fri)[email protected] {null -> D(D)}).
2016-04-06 23:11:04,707 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (4), score (-1hard/-260soft), move (2010-01-01(Fri)[email protected] {null -> E(E)}).
2016-04-06 23:11:04,713 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (5), score (-1hard/-259soft), move (2010-01-01(Fri)[email protected] {null -> F(F)}).
2016-04-06 23:11:04,718 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (6), score (0hard/-259soft), move (2010-01-01(Fri)[email protected] {null -> G(G)}).
2016-04-06 23:11:04,726 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (7), score (-1hard/-259soft), move (2010-01-01(Fri)[email protected] {null -> H(H)}).
2016-04-06 23:11:04,732 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (8), score (-1hard/-258soft), move (2010-01-01(Fri)[email protected] {null -> I(I)}).
2016-04-06 23:11:04,738 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (9), score (0hard/-258soft), move (2010-01-01(Fri)[email protected] {null -> J(J)}).
2016-04-06 23:11:04,739 DEBUG [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) CH step (0), time spent (634), score (0hard/-258soft), selected move count (10), picked move (2010-01-01(Fri)[email protected] {null -> J(J)}).
...
2016-04-06 23:11:07,274 DEBUG [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) CH step (150), time spent (3170), score (-1hard/-103soft), selected move count (10), picked move (2010-01-28(Thu)[email protected] {null -> C(C)}).
2016-04-06 23:11:07,275 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (0), score (-3hard/-104soft), move (2010-01-28(Thu)[email protected] {null -> A(A)}).
2016-04-06 23:11:07,276 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (1), score (-2hard/-104soft), move (2010-01-28(Thu)[email protected] {null -> B(B)}).
2016-04-06 23:11:07,276 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (2), score (-3hard/-103soft), move (2010-01-28(Thu)[email protected] {null -> C(C)}).
2016-04-06 23:11:07,277 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (3), score (-2hard/-103soft), move (2010-01-28(Thu)[email protected] {null -> D(D)}).
2016-04-06 23:11:07,278 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (4), score (-1hard/-107soft), move (2010-01-28(Thu)[email protected] {null -> E(E)}).
2016-04-06 23:11:07,279 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (5), score (-2hard/-105soft), move (2010-01-28(Thu)[email protected] {null -> F(F)}).
2016-04-06 23:11:07,280 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (6), score (-2hard/-106soft), move (2010-01-28(Thu)[email protected] {null -> G(G)}).
2016-04-06 23:11:07,288 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (7), score (-2hard/-104soft), move (2010-01-28(Thu)[email protected] {null -> H(H)}).
2016-04-06 23:11:07,289 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (8), score (-2hard/-104soft), move (2010-01-28(Thu)[email protected] {null -> I(I)}).
2016-04-06 23:11:07,290 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (9), score (-2hard/-104soft), move (2010-01-28(Thu)[email protected] {null -> J(J)}).
2016-04-06 23:11:07,290 DEBUG [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) CH step (151), time spent (3186), score (-1hard/-107soft), selected move count (10), picked move (2010-01-28(Thu)[email protected] {null -> E(E)}).
2016-04-06 23:11:07,291 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (0), score (-2hard/-108soft), move (2010-01-28(Thu)[email protected] {null -> A(A)}).
2016-04-06 23:11:07,292 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (1), score (-3hard/-108soft), move (2010-01-28(Thu)[email protected] {null -> B(B)}).
2016-04-06 23:11:07,293 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (2), score (-3hard/-107soft), move (2010-01-28(Thu)[email protected] {null -> C(C)}).
2016-04-06 23:11:07,293 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (3), score (-1hard/-107soft), move (2010-01-28(Thu)[email protected] {null -> D(D)}).
2016-04-06 23:11:07,294 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (4), score (-3hard/-109soft), move (2010-01-28(Thu)[email protected] {null -> E(E)}).
2016-04-06 23:11:07,295 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (5), score (-2hard/-109soft), move (2010-01-28(Thu)[email protected] {null -> F(F)}).
2016-04-06 23:11:07,296 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (6), score (-1hard/-110soft), move (2010-01-28(Thu)[email protected] {null -> G(G)}).
2016-04-06 23:11:07,297 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (7), score (-3hard/-108soft), move (2010-01-28(Thu)[email protected] {null -> H(H)}).
2016-04-06 23:11:07,299 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (8), score (-2hard/-109soft), move (2010-01-28(Thu)[email protected] {null -> I(I)}).
2016-04-06 23:11:07,300 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (9), score (-1hard/-107soft), move (2010-01-28(Thu)[email protected] {null -> J(J)}).
2016-04-06 23:11:07,300 DEBUG [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) CH step (152), time spent (3196), score (-1hard/-107soft), selected move count (10), picked move (2010-01-28(Thu)[email protected] {null -> D(D)}).
2016-04-06 23:11:07,330 INFO [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) Construction Heuristic phase (0) ended: step total (153), time spent (3226), best score (-1hard/-107soft).
2016-04-06 23:11:07,400 TRACE [org.optaplanner.core.impl.heuristic.selector.move.factory.MoveListFactoryToMoveSelectorBridge] (pool-6-thread-1) Created cachedMoveList: size (1530), moveSelector (MoveListFactory(class org.optaplanner.webexamples.nurserostering.rest.solver.move.factory.EmployeeChangeMoveFactory)).
2016-04-06 23:11:07,405 TRACE [org.optaplanner.core.impl.heuristic.selector.move.factory.MoveListFactoryToMoveSelectorBridge] (pool-6-thread-1) Created cachedMoveList: size (11628), moveSelector (MoveListFactory(class org.optaplanner.webexamples.nurserostering.rest.solver.move.factory.ShiftAssignmentSwapMoveFactory)).
2016-04-06 23:11:07,411 TRACE [org.optaplanner.core.impl.heuristic.selector.move.factory.MoveListFactoryToMoveSelectorBridge] (pool-6-thread-1) Created cachedMoveList: size (268), moveSelector (MoveListFactory(class org.optaplanner.webexamples.nurserostering.rest.solver.move.factory.ShiftAssignmentPillarPartSwapMoveFactory)).
2016-04-06 23:13:58,592 INFO [org.optaplanner.core.impl.solver.BasicPlumbingTermination] (default task-36) Terminating solver early.
有什么不对的日志?请请帮助我,感谢和问候。
更新2
更新我的桌面应用程序的护士名册optaplanner 6.3.0决赛,然后运行它,结果它被困在比分-1hard/-107soft。这也提示我的异常,这里是堆栈跟踪:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Solving failed.
at com.employee.scheduler.common.swingui.SolverAndPersistenceFrame$SolveWorker.done(SolverAndPersistenceFrame.java:299)
at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
at javax.swing.Timer.fireActionPerformed(Timer.java:313)
at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: " java.lang.IllegalStateException: The notificationQueues might not be empty (false) so any shadow variables might be stale so score calculation is unreliable.
Maybe a ScoreDirector.before*() method was called without calling ScoreDirector.triggerVariableListeners(), before calling ScoreDirector.calculateScore().
at com.employee.scheduler.common.swingui.SolverAndPersistenceFrame$SolveWorker.done(SolverAndPersistenceFrame.java:299)
at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
at javax.swing.Timer.fireActionPerformed(Timer.java:313)
at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
更新3
我打开environmentMode到FULL_ASSERT,这里是我的config.xml:
<solver>
<environmentMode>FULL_ASSERT</environmentMode>
...
</solver>
然后我试图运行它,它仍然停留在本地搜索阶段(就像我之前发布的日志一样)。这里是日志:
11:29:21,671 DEBUG [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) CH step (151), time spent (10808), score (-1hard/-107soft), selected move count (10), picked move (2010-01-28(Thu)[email protected] {null -> E(E)}).
11:29:21,676 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (0), score (-2hard/-108soft), move (2010-01-28(Thu)[email protected] {null -> A(A)}).
11:29:21,680 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (1), score (-3hard/-108soft), move (2010-01-28(Thu)[email protected] {null -> B(B)}).
11:29:21,684 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (2), score (-3hard/-107soft), move (2010-01-28(Thu)[email protected] {null -> C(C)}).
11:29:21,689 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (3), score (-1hard/-107soft), move (2010-01-28(Thu)[email protected] {null -> D(D)}).
11:29:21,693 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (4), score (-3hard/-109soft), move (2010-01-28(Thu)[email protected] {null -> E(E)}).
11:29:21,699 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (5), score (-2hard/-109soft), move (2010-01-28(Thu)[email protected] {null -> F(F)}).
11:29:21,706 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (6), score (-1hard/-110soft), move (2010-01-28(Thu)[email protected] {null -> G(G)}).
11:29:21,714 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (7), score (-3hard/-108soft), move (2010-01-28(Thu)[email protected] {null -> H(H)}).
11:29:21,721 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (8), score (-2hard/-109soft), move (2010-01-28(Thu)[email protected] {null -> I(I)}).
11:29:21,728 TRACE [org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider] (pool-6-thread-1) Move index (9), score (-1hard/-107soft), move (2010-01-28(Thu)[email protected] {null -> J(J)}).
11:29:21,733 DEBUG [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) CH step (152), time spent (10870), score (-1hard/-107soft), selected move count (10), picked move (2010-01-28(Thu)[email protected] {null -> D(D)}).
11:29:21,739 INFO [org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase] (pool-6-thread-1) Construction Heuristic phase (0) ended: step total (153), time spent (10876), best score (-1hard/-107soft).
11:29:21,754 TRACE [org.optaplanner.core.impl.heuristic.selector.move.factory.MoveListFactoryToMoveSelectorBridge] (pool-6-thread-1) Created cachedMoveList: size (1530), moveSelector (MoveListFactory(class org.optaplanner.webexamples.nurserostering.rest.solver.move.factory.EmployeeChangeMoveFactory)).
11:29:21,759 TRACE [org.optaplanner.core.impl.heuristic.selector.move.factory.MoveListFactoryToMoveSelectorBridge] (pool-6-thread-1) Created cachedMoveList: size (11628), moveSelector (MoveListFactory(class org.optaplanner.webexamples.nurserostering.rest.solver.move.factory.ShiftAssignmentSwapMoveFactory)).
11:29:21,765 TRACE [org.optaplanner.core.impl.heuristic.selector.move.factory.MoveListFactoryToMoveSelectorBridge] (pool-6-thread-1) Created cachedMoveList: size (268), moveSelector (MoveListFactory(class org.optaplanner.webexamples.nurserostering.rest.solver.move.factory.ShiftAssignmentPillarPartSwapMoveFactory)).
11:33:26,137 INFO [org.optaplanner.core.impl.solver.BasicPlumbingTermination] (default task-17) Terminating solver early.
任何想法的人?开启环境模式我应该期待什么?从你的日志
在wildfly中部署时,wildfly记录器将基本上否决您的记录器,以便logback。xml文件被忽略。 [在这里看到一个类似的问题](https://groups.google.com/forum/#!topic/optaplanner-dev/scdaYDEMzyA)修复这个问题,以获得调试日志记录,你会更好地了解发生了什么。也许CH在数据集(这是可修复的)上花费的时间更长,或者您的servlet线程中有竞争条件来解决线程代码或...首先获取日志。 –
我尝试从optaplanner-core,optaplanner-benchmark和logback-classic中排除slf4j-api依赖项,然后尝试再次运行它。但是日志仍然来自jboss,而不是来自我自己的logback.xml文件。有什么我错过了吗? –
在jboss standalone.xml中设置记录器配置后,我终于得到了日志。我已经发布上面的日志。请帮我解决这个问题。 –