Search code examples
javadroolsoptaplanner

OptaPlanner:Can I use custom changeMove with two variables?


I have two variables: period and room.

Some of them have constraints with special lecture. Some change move is not allowed ,so I want a custom changeMove.

I have checked the examples. But the curriculumcourse doesn't have such situation.

Should I write two changemove class? periodChangeMove and roomChangeMove?

Can anyone tell me how to write it?

sorry , my english is not good.

thanks.


Solution

  • Yes, you can.

    If you just write <changeMoveSelector> it will just unfold into 2 change move selectors (one for each planning variable) and do a <unionMoveSelector> over them. In some cases you want a <cartesianProductMoveSeletor>, in which case you'll need to configure it explicitly (see docs chapter on move selection).