I'm trying to specify a pillarSwapMoveSelector
in my config XML which can swap all variables of an entity class which are not the chained variable (as they are not compatible with the pillar moves).
According to the OptaPlanner 8.8.0.Final documentation, the following should be valid:
<pillarSwapMoveSelector>
<pillarSelector>
<entitySelector>
<entityClass>a.fully.qualified.ClassName</entityClass>
</entitySelector>
</pillarSelector>
<variableNameInclude>planningVariable1</variableNameInclude>
<variableNameInclude>planningVariable2</variableNameInclude>
<variableNameInclude>planningVariable3</variableNameInclude>
</pillarSwapMoveSelector>
It seems that is it not. Is this intentionally invalid? Or is this just an issue with the documentation?
Regardless, as a work-around if it is a bug, you must use a wrapper to specify a collection of variableNameInclude
s:
<pillarSwapMoveSelector>
<pillarSelector>
<entitySelector>
<entityClass>a.fully.qualified.ClassName</entityClass>
</entitySelector>
</pillarSelector>
<variableNameIncludes>
<variableNameInclude>planningVariable1</variableNameInclude>
<variableNameInclude>planningVariable2</variableNameInclude>
<variableNameInclude>planningVariable3</variableNameInclude>
</variableNameIncludes>
</pillarSwapMoveSelector>
Thanks for reporting; as you suspect, it's an issue in the documentation. This is one of the changes introduced in OptaPlanner 8. The documentation will be updated soon to reflect that.
Let me also mention one more thing introduced in OptaPlanner 8, which is the XML Schema Definition for the solver and benchmark configuration. If you declare the solver
element as follows:
<solver xmlns="https://www.optaplanner.org/xsd/solver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.optaplanner.org/xsd/solver https://www.optaplanner.org/xsd/solver/solver.xsd">
you can use code completion and validation in any IDE that supports XSD.