コード例 #1
0
 @Override
 public MoveSelector buildBaseMoveSelector(
     HeuristicConfigPolicy configPolicy,
     SelectionCacheType minimumCacheType,
     boolean randomSelection) {
   EntitySelectorConfig entitySelectorConfig_ =
       entitySelectorConfig == null ? new EntitySelectorConfig() : entitySelectorConfig;
   EntitySelector entitySelector =
       entitySelectorConfig_.buildEntitySelector(
           configPolicy,
           minimumCacheType,
           SelectionOrder.fromRandomSelectionBoolean(randomSelection));
   ValueSelectorConfig valueSelectorConfig_ =
       valueSelectorConfig == null ? new ValueSelectorConfig() : valueSelectorConfig;
   ValueSelector[] valueSelectors = new ValueSelector[K - 1];
   for (int i = 0; i < valueSelectors.length; i++) {
     valueSelectors[i] =
         valueSelectorConfig_.buildValueSelector(
             configPolicy,
             entitySelector.getEntityDescriptor(),
             minimumCacheType,
             SelectionOrder.fromRandomSelectionBoolean(randomSelection));
   }
   return new KOptMoveSelector(entitySelector, valueSelectors, randomSelection);
 }
コード例 #2
0
 /**
  * @param configPolicy never null
  * @param minimumCacheType never null, If caching is used (different from {@link
  *     SelectionCacheType#JUST_IN_TIME}), then it should be at least this {@link
  *     SelectionCacheType} because an ancestor already uses such caching and less would be
  *     pointless.
  * @param inheritedSelectionOrder never null
  * @return never null
  */
 public PillarSelector buildPillarSelector(
     HeuristicConfigPolicy configPolicy,
     SelectionCacheType minimumCacheType,
     SelectionOrder inheritedSelectionOrder) {
   if (minimumCacheType.compareTo(SelectionCacheType.STEP) > 0) {
     throw new IllegalArgumentException(
         "The pillarSelectorConfig ("
             + this
             + ")'s minimumCacheType ("
             + minimumCacheType
             + ") must not be higher than "
             + SelectionCacheType.STEP
             + " because the pillars change every step.");
   }
   // EntitySelector uses SelectionOrder.ORIGINAL because a SameValuePillarSelector STEP caches the
   // values
   EntitySelectorConfig entitySelectorConfig_ =
       entitySelectorConfig == null ? new EntitySelectorConfig() : entitySelectorConfig;
   EntitySelector entitySelector =
       entitySelectorConfig_.buildEntitySelector(
           configPolicy, minimumCacheType, SelectionOrder.ORIGINAL);
   Collection<GenuineVariableDescriptor> variableDescriptors =
       entitySelector.getEntityDescriptor().getVariableDescriptors();
   return new SameValuePillarSelector(
       entitySelector, variableDescriptors, inheritedSelectionOrder.toRandomSelectionBoolean());
 }
コード例 #3
0
 public void inherit(PillarSelectorConfig inheritedConfig) {
   super.inherit(inheritedConfig);
   if (entitySelectorConfig == null) {
     entitySelectorConfig = inheritedConfig.getEntitySelectorConfig();
   } else if (inheritedConfig.getEntitySelectorConfig() != null) {
     entitySelectorConfig.inherit(inheritedConfig.getEntitySelectorConfig());
   }
   //        variableNameList = ConfigUtils.inheritMergeableListProperty(variableNameList,
   //                inheritedConfig.getVariableNameList());
 }