// The implementing class can assume that the provided LogAbstraction
  // partialTrace is
  // of the same class, i.e. this.getClass().equals(partialTrace.getClass()) =
  // true
  //
  // The implementing class can assume that the LogEvent provided is in the
  // set returned by
  // getPossibleNextLogEvents(partialTrace), i.e. in all instances
  // represented by this abstraction, the given LogEvent is a possible
  // next step.
  public final Recommendation getRecommendation(
      LogEvent logEventToDo, LogAbstraction partialTrace, SortedSet<LogEvent> enabledEvents) {
    Recommendation rec = new Recommendation();
    rec.setTask(logEventToDo.getModelElementName());
    rec.setEventType(logEventToDo.getEventType());
    double weight = calculateFitness(partialTrace);

    if (weight > 0) {

      SortedSet<LogEvent> possibleEvents = getPossibleNextLogEvents(partialTrace);

      if (possibleEvents.contains(logEventToDo) && enabledEvents.contains(logEventToDo)) {

        // It is possible to do this event, so give a recommendation
        double[] vals = getAllValuesAndWeights(weight);
        rec.setDoExpectedValue(vals[0]);
        rec.setDoExpectedSquaredValue(vals[1]);
        rec.setDoWeight(vals[2]);
      } else {
        // It is not possible to do this event, so give a "negative"
        // recommendation
        double w = 0;
        double e = 0;
        double e2 = 0;
        for (LogEvent evt : possibleEvents) {
          if (!enabledEvents.contains(evt)) {
            continue;
          }
          // Event evt is not a possible event in this case,
          // but is enabled in the query
          double[] vals = getAllValuesAndWeights(weight);
          double newW = w + vals[2];
          e = (e * w + vals[0] * vals[2]) / newW;
          e2 = (e2 * w + vals[1] * vals[2]) / newW;
          w = newW;
        }
        rec.setDontExpectedValue(e);
        rec.setDontExpectedSquaredValue(e2);
        rec.setDontWeight(w);
      }
    }
    return rec;
  }
Exemplo n.º 2
0
 public LogEventCheckBoxEnh(LogEvent le) {
   super(
       "<html><B>" + le.getModelElementName() + " (" + le.getEventType() + ") " + " </B></html>",
       true);
   this.le = le;
 }