繁体   English   中英

Drools Planner的构造方法Heuristic java.lang.ClassCastException

[英]Drools Planner constructionHeuristic java.lang.ClassCastException

我尝试使用Drools Planner 5.4。 最终构造启发式类型BEST_FIT初始化解决方案。

<constructionHeuristic>
    <constructionHeuristicType>BEST_FIT</constructionHeuristicType>
</constructionHeuristic>

运行时评估期间发生以下错误

java.lang.ClassCastException: org.drools.planner.config.constructionheuristic.ConstructionHeuristicSolverPhaseConfig cannot be cast to org.drools.planner.config.localsearch.LocalSearchSolverPhaseConfig

有人有什么提示吗?

谢谢

这是堆栈跟踪

com.thoughtworks.xstream.converters.ConversionException: Element constructionHeuristic of type org.drools.planner.config.constructionheuristic.ConstructionHeuristicSolverPhaseConfig is not defined as field in type org.drools.planner.config.localsearch.LocalSearchSolverPhaseConfig
---- Debugging information ----
class               : org.drools.planner.config.localsearch.LocalSearchSolverPhaseConfig
required-type       : org.drools.planner.config.localsearch.LocalSearchSolverPhaseConfig
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 23
class[1]            : org.drools.planner.config.solver.SolverConfig
version             : null
-------------------------------
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter: writeValueToImplicitCollection (line:399)
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter: doUnmarshal (line:330)
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter: unmarshal (line:230)
com.thoughtworks.xstream.core.TreeUnmarshaller: convert (line:72)
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller: convert (line:65)
com.thoughtworks.xstream.core.TreeUnmarshaller: convertAnother (line:66)
com.thoughtworks.xstream.core.TreeUnmarshaller: convertAnother (line:50)
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter: doUnmarshal (line:318)
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter: unmarshal (line:230)
com.thoughtworks.xstream.core.TreeUnmarshaller: convert (line:72)
com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller: convert (line:65)
com.thoughtworks.xstream.core.TreeUnmarshaller: convertAnother (line:66)
com.thoughtworks.xstream.core.TreeUnmarshaller: convertAnother (line:50)
com.thoughtworks.xstream.core.TreeUnmarshaller: start (line:134)
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy: unmarshal (line:32)
com.thoughtworks.xstream.XStream: unmarshal (line:1035)
com.thoughtworks.xstream.XStream: unmarshal (line:1019)
com.thoughtworks.xstream.XStream: fromXML (line:895)
org.drools.planner.config.XmlSolverFactory: configure (line:95)
org.drools.planner.config.XmlSolverFactory: configure (line:85)
org.drools.planner.config.XmlSolverFactory: configure (line:78)

根据堆栈跟踪,您正在做类似的事情

<solver>
  ...
  <localSearch>
    <constructionHeuristic>
       ...    
    </constructionHeuristic>
    ...
  </localSearch>
<solver>

而应该是这样的:

<solver>
  ...
  <constructionHeuristic>
    ...    
  </constructionHeuristic>
  <localSearch>
    ...
  </localSearch>
<solver>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM