Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-394

ValueSelector should support filterClass too (just like entity & move selectors)

    XMLWordPrintable

Details

    • Documentation (Ref Guide, User Guide, etc.)

    Description

      Trying to use the XML configuration as indicated in the Drools Planner documentation;

      "...or a valueFilterClass on the valueSelector:..."

      Quick look at the source failed to turn up references. The first mention of this feature is in the 5.5.0.Beta1 Drools Planner documentation (it's also in subsequent versions) - perhaps something has not been committed/merged somewhere?

      Full error message:

      Exception in thread "main" com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field org.drools.planner.config.heuristic.selector.value.ValueSelectorConfig.valueFilterClass
      ---- Debugging information ----
      field               : valueFilterClass
      class               : org.drools.planner.config.heuristic.selector.value.ValueSelectorConfig
      required-type       : org.drools.planner.config.heuristic.selector.value.ValueSelectorConfig
      converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
      line number         : 36
      class[1]            : org.drools.planner.config.heuristic.selector.move.generic.ChangeMoveSelectorConfig
      class[2]            : org.drools.planner.config.heuristic.selector.move.composite.UnionMoveSelectorConfig
      class[3]            : org.drools.planner.config.localsearch.LocalSearchSolverPhaseConfig
      class[4]            : org.drools.planner.config.solver.SolverConfig
      version             : null
      -------------------------------
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.determineType(AbstractReflectionConverter.java:449)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:290)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:230)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:351)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:302)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:230)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:318)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:230)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:318)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:230)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:318)
      	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:230)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
      	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
      	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
      	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1035)
      	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1019)
      	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:895)
      	at org.drools.planner.config.XmlSolverFactory.configure(XmlSolverFactory.java:87)
      	at org.drools.planner.config.XmlSolverFactory.configure(XmlSolverFactory.java:77)
      	at com.hill.planner.basic.DroolsRunner.<init>(DroolsRunner.java:27)
      	at com.hill.planner.basic.Main.main(Main.java:49)
      
      

      Full source available at;

      https://github.com/ununbium/DroolsPlannerHelloWorld

      There may be other issues in this source - apologies in advance.

      To recreate:
      Using XML configuration, add the following to the Xml (as indicated by the planner document),

      <changeMoveSelector>
      <selectionOrder>RANDOM</selectionOrder>
      <valueSelector>			<valueFilterClass>com.example.MyFilter</valueFilterClass>
      </valueSelector>
      </changeMoveSelector>
      

      Attachments

        Activity

          People

            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            curlydrew andrew hill (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: