I am using OptaPlanner 6.1.0.Final. When I try to use FilterClass in ValueSelector configuration, I got this exception:
Caused by: com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field org.optaplanner.core.config.heuristic.selector.value.ValueSelectorConfig.filterClass
Acording to the OptaPlanner docs (in 7.2.4. Filtered selection), FilterClass should also work on ValueSelector.
...apply it on a lower levels, such as a filterClass on the entitySelector or valueSelector:
<changeMoveSelector>
<entitySelector>
<filterClass>...EntityFilter</filterClass>
</entitySelector>
</changeMoveSelector>
Is this a bug on the Planner? Or any other way to have Filtering class for Planning Variables? Appreciated for your time and suggestion in advance.
Below is my configuration:
<changeMoveSelector>
<entitySelector mimicSelectorRef="placerEntitySelector">
</entitySelector>
<valueSelector>
<variableName>room</variableName>
<cacheType>PHASE</cacheType>
<selectionOrder>SORTED</selectionOrder>
<filterClass>..SelectionFilter</filterClass>
</valueSelector>
</changeMoveSelector>
<valueSelector>
does not support filters yet (see TODO ValueSelectorConfig.java
). It's debatable whether that's useful: if you have a good use case, do share.
Note that the surrounding <moveSelector>
does support filtering. In that case, you're filtering moves (a ChangeMove
in this case), instead of values - so there's more info, namely both the entity and the value, instead of just the value.