Reputation: 1358
Is there a way of programmatically configuring a move selection filter?
I have a SpringBoot application that configures OP programmatically such as setting the termination config. I would like to tell OP to use a move selection filter without having to resort to an XML file as described in the documentation above.
Thanks in advance.
Upvotes: 1
Views: 323
Reputation: 5682
There is a direct 1-to-1 mapping between the solver config XML, and SolverConfig
. If you can already set termination config, you can set anything else.
Specifically, from the solver config, you can reach the phase config list. In there, find the local search phase config. And finally in there, find the selector which you want to filter, and set the filter.
It is possible that, by default, the phase config list will be empty. OptaPlanner would normally automatically add construction heuristics and local search at runtime. If that is the case, you will need to add these phases to the config list explicitly, incl. the selector configs.
As you yourself pointed out in the comments above, this answer probably gives you everything, incl. a code sample.
Upvotes: 4