コード例 #1
0
  private void calculatePartialFitness() {

    ProcessInstance pi = null;
    int numSimilarPIs = 0;
    int numMissingTokens = 0;
    int numExtraTokensLeftBehind = 0;

    Iterator logReaderInstanceIterator = logReader.instanceIterator();
    while (logReaderInstanceIterator.hasNext()) {
      pi = (ProcessInstance) logReaderInstanceIterator.next();
      numSimilarPIs = MethodsForWorkflowLogDataStructures.getNumberSimilarProcessInstances(pi);
      for (int i = 0; i < population.length; i++) {
        if (mapping.getMap(i) < 0) { // we need to compute the partial
          // fitness
          parser[i].parse(pi);
          // partial assignment to variables
          numMissingTokens = parser[i].getNumMissingTokens();
          if (numMissingTokens > 0) {
            this.numPIsWithMissingTokens[i] += numSimilarPIs;
            this.numMissingTokens[i] += (numMissingTokens * numSimilarPIs);
          }

          numExtraTokensLeftBehind = parser[i].getNumExtraTokensLeftBehind();
          if (numExtraTokensLeftBehind > 0) {
            this.numPIsWithExtraTokensLeftBehind[i] += numSimilarPIs;
            this.numExtraTokensLeftBehind[i] += (numExtraTokensLeftBehind * numSimilarPIs);
          }
          numParsedWMEs[i] += (parser[i].getNumParsedElements() * numSimilarPIs);
          numEnabledWMEs[i] += (parser[i].getNumTotalEnabledElements() * numSimilarPIs);
        }
      }
    }
  }
コード例 #2
0
 private void createParser() {
   // creating a parser for every individual
   parser = new ExtraBehaviorParser[population.length];
   for (int i = 0; i < parser.length; i++) {
     if (mapping.getMap(i) < 0) {
       parser[i] = new ExtraBehaviorParser(population[i], generator);
     }
   }
 }
コード例 #3
0
  private HeuristicsNet[] assignFitness() {

    double fitness = 0;
    double f1 = 0;
    double f2 = 0;
    double f3 = 0;

    double numATEsAtLog = 0;
    double numPIsAtLog = 0;
    double missingTokensDenominator = 0.001;
    double unusedTokensDenominator = 0.001;
    double maxEnabledWMEs = Double.MIN_VALUE;
    int indexIdenticalIndividual = 0;

    numATEsAtLog = logReader.getLogSummary().getNumberOfAuditTrailEntries();
    numPIsAtLog = logReader.getLogSummary().getNumberOfProcessInstances();
    maxEnabledWMEs = getMaxValue(numEnabledWMEs);

    for (int i = 0; i < population.length; i++) {

      indexIdenticalIndividual = mapping.getMap(i);

      if (indexIdenticalIndividual < 0) {

        missingTokensDenominator = numPIsAtLog - numPIsWithMissingTokens[i] + 1;

        unusedTokensDenominator = numPIsAtLog - numPIsWithExtraTokensLeftBehind[i] + 1;

        f1 =
            (numParsedWMEs[i]
                    - ((numMissingTokens[i] / missingTokensDenominator)
                        + (numExtraTokensLeftBehind[i] / unusedTokensDenominator)))
                / numATEsAtLog;

        f2 = numEnabledWMEs[i];

        f2 /= maxEnabledWMEs; // normalizing...

        if (maximumNumberIntersectingElements > 0) {
          f3 =
              (numIntersectingDuplicatesPerInputElement[i]
                      + numIntersectingDuplicatesPerOutputElement[i])
                  / maximumNumberIntersectingElements;
        } else {
          f3 = 0.0;
        }

        // f3 = (numIntersectingDuplicatesPerInputElement[i] +
        // numIntersectingDuplicatesPerOutputElement[i]) / (2 *
        // (Math.pow(population[i].size(),
        // 2) - population[i].size()));

        fitness = f1 - kappa * f2 - gamma * f3;
        // final double k = 1.0/3.0;
        // fitness = k*f1 + (k - (k*f2)) + (k - (k*f3));

        population[i].setFitness(fitness);

      } else {

        population[i].setFitness(population[indexIdenticalIndividual].getFitness());
        population[i].setDuplicatesActualFiring(
            population[indexIdenticalIndividual].getDuplicatesActualFiring());
        population[i].setArcUsage(population[indexIdenticalIndividual].getArcUsage());
      }
    }

    return population;
  }