}
private ValueSelector buildBaseValueSelector(
HeuristicConfigPolicy configPolicy, GenuineVariableDescriptor variableDescriptor,
SelectionCacheType minimumCacheType, boolean randomSelection) {
ValueRangeDescriptor valueRangeDescriptor = variableDescriptor.getValueRangeDescriptor();
// TODO minimumCacheType SOLVER is only a problem if the valueRange includes entities or custom weird cloning
if (minimumCacheType == SelectionCacheType.SOLVER) {
// TODO Solver cached entities are not compatible with DroolsScoreCalculator and IncrementalScoreDirector
// because between phases the entities get cloned and the KieSession/Maps contains those clones afterwards
// https://issues.jboss.org/browse/PLANNER-54
throw new IllegalArgumentException("The minimumCacheType (" + minimumCacheType
+ ") is not yet supported. Please use " + SelectionCacheType.PHASE + " instead.");
}
if (valueRangeDescriptor.isEntityIndependent()) {
return new FromSolutionPropertyValueSelector(
(EntityIndependentValueRangeDescriptor) valueRangeDescriptor, minimumCacheType, randomSelection);
} else {
// TODO Do not allow PHASE cache on FromEntityPropertyValueSelector, except if the moveSelector is PHASE cached too.
return new FromEntityPropertyValueSelector(valueRangeDescriptor, randomSelection);