コード例 #1
0
 private ValueSelector buildBaseValueSelector(
     EnvironmentMode environmentMode,
     PlanningVariableDescriptor variableDescriptor,
     SelectionCacheType minimumCacheType,
     boolean randomSelection) {
   if (variableDescriptor.getValueRangeDescriptor().isEntityDependent()) {
     FromEntityPropertyPlanningValueRangeDescriptor valueRangeDescriptor =
         (FromEntityPropertyPlanningValueRangeDescriptor)
             variableDescriptor.getValueRangeDescriptor();
     // TODO should we ignore the minimumCacheType so it can be cached on changeMoves too?
     return new FromEntityPropertyValueSelector(
         valueRangeDescriptor, minimumCacheType, randomSelection);
   } else {
     // FromSolutionPropertyValueSelector caches by design, so it uses the minimumCacheType
     if (variableDescriptor.isPlanningValuesCacheable()) {
       if (minimumCacheType.compareTo(SelectionCacheType.PHASE) < 0) {
         // TODO we probably want to default this to SelectionCacheType.JUST_IN_TIME
         minimumCacheType = SelectionCacheType.PHASE;
       }
     } else {
       if (minimumCacheType.compareTo(SelectionCacheType.STEP) < 0) {
         // TODO we probably want to default this to SelectionCacheType.JUST_IN_TIME
         minimumCacheType = SelectionCacheType.STEP;
       }
     }
     return new FromSolutionPropertyValueSelector(
         variableDescriptor, minimumCacheType, randomSelection);
   }
 }
コード例 #2
0
 protected boolean isBaseInherentlyCached(PlanningVariableDescriptor variableDescriptor) {
   return !variableDescriptor.getValueRangeDescriptor().isEntityDependent();
 }