greedyPlanningEntitySelector.setPlanningEntitySelectorList(planningEntitySelectorList);
return greedyPlanningEntitySelector;
}
private GreedyDecider buildGreedyDecider(SolutionDescriptor solutionDescriptor, EnvironmentMode environmentMode) {
DefaultGreedyDecider greedyDecider = new DefaultGreedyDecider();
ConstructionHeuristicPickEarlyType constructionHeuristicPickEarlyType = (this.constructionHeuristicPickEarlyType == null)
? ConstructionHeuristicPickEarlyType.NEVER : this.constructionHeuristicPickEarlyType;
Set<Class<?>> planningEntityImplementationClassSet = solutionDescriptor.getPlanningEntityImplementationClassSet();
if (planningEntityImplementationClassSet.size() != 1) {
// TODO Multiple MUST BE SUPPORTED TOO
throw new UnsupportedOperationException("Currently the greedyFit implementation only supports " +
"1 planningEntityImplementationClass.");
}
Class<?> planningEntityImplementationClass = planningEntityImplementationClassSet.iterator().next();
PlanningEntityDescriptor planningEntityDescriptor = solutionDescriptor.getPlanningEntityDescriptor(planningEntityImplementationClass);
PlanningVariableWalker planningVariableWalker = new PlanningVariableWalker(planningEntityDescriptor);
List<PlanningValueWalker> planningValueWalkerList = new ArrayList<PlanningValueWalker>();
for (PlanningVariableDescriptor planningVariableDescriptor
: planningEntityDescriptor.getPlanningVariableDescriptors()) {
PlanningValueSelector planningValueSelector = new PlanningValueSelector(planningVariableDescriptor);
// TODO should be configured to do BEST etc.
PlanningValueWalker planningValueWalker = new PlanningValueWalker(
planningVariableDescriptor, planningValueSelector);
planningValueWalkerList.add(planningValueWalker);
}
planningVariableWalker.setPlanningValueWalkerList(planningValueWalkerList);
greedyDecider.setPlanningVariableWalker(planningVariableWalker);
// TODO greedyDecider.setConstructionHeuristicPickEarlyType(constructionHeuristicPickEarlyType);
if (environmentMode == EnvironmentMode.TRACE) {
greedyDecider.setAssertMoveScoreIsUncorrupted(true);
}
return greedyDecider;
}