Esempio n. 1
0
  /** This method applies the action set subsumption */
  public void doActionSetSubsumption() {
    int i, pos = 0;
    Classifier cl = null;

    for (i = 0; i < macroClSum; i++) {
      if (set[i].couldSubsume()) {
        if (cl == null
            || set[i].numberOfDontCareSymbols() > cl.numberOfDontCareSymbols()
            || (set[i].numberOfDontCareSymbols() == cl.numberOfDontCareSymbols()
                && Config.rand() < 0.5)) {
          cl = set[i];
          pos = i;
        }
      }
    }
    if (cl != null) {
      for (i = 0; i < macroClSum; i++) {
        if (cl != set[i] && cl.isMoreGeneral(set[i])) {
          cl.increaseNumerosity(set[i].getNumerosity());
          // Now, the classifier has to be removed from the actionSet and the population.
          // It's deleted from the action set.
          Classifier clDeleted = set[i];
          deleteClassifier(i);

          // And now, it's deleted from the population
          Population p = parentRef;
          while (p.parentRef != null) {
            p = p.parentRef;
          }

          pos =
              p.isThereClassifier(
                  clDeleted); // The classifier is searched in the initial population.

          if (pos >= 0) p.deleteClassifier(pos);
        }
      }
    }
  } // end doActionSetSubsumption