OptaPlanner construction phase - Is there a way to

2019-09-05 03:49发布

问题:

In local search phase you can configure filters for entities, values and moves. You can even provide a custom move factory if you want.

However, I can't find any documentation on how to do the same in construction phase. The only configuration is a heuristic type and forager: Chapter 8. Construction heuristics

I want to implement some of my very hard rules in filters, however, without the ability to filter in construction phase I must also define them as scoring rules to avoid bad construction.

Is there a way to define filters for construction phase?

回答1:

Yes, there is (requires at least 6.0.0.CR1, but best the latest and greatest), but it's not yet documented.

Follow the rabit hole down from ConstructionHeuristicSolverPhaseConfig and QueuedEntityPlacerConfig. It's something like:

   <constructionHeuristic>
     <queuedEntityPlacer>
       <entitySelector id="a"/>
       <changeMoveSelector>
         <mimicEntitySelector refId="a"/>
         <valueSelector>
       </changeMoveSelector>
     </queuedEntityPlacer>
   </constructionHeuristic>