Replaying

The replaying classes in the package replay check if logs are fitting on the specified Petri net. In doing so three different termination criteria are considered:

Possible firing sequence: The trace relates to a possible sequence in given Petri net. All activities can be fired according to their order within the trace.

No enabled transitions: The trace relates to a complete firing sequence in the given Petri net. All activities can be fired according to their order within the trace. After firing the last activity, there must not be any enabled transitions.

Escapable with silent transitions: The trace relates to a complete firing sequence in the given Petri net. All activities can be fired according to their order within the trace. After firing the last activity, only the firing of silent transitions is allowed to complete the sequence.

The following code creates a log for the formerly defined P/T-Net. The traces 1, 2, and 3 are complete sequences on the net, trace 6 is incomplete, and traces 4 and 5 are non-fitting traces for the given Petri net.

List<LogTrace<LogEntry>> log = new ArrayList<LogTrace<LogEntry>>();
log.add(LogTraceUtils.createTraceFromActivities(1, "t1","t3"));
log.add(LogTraceUtils.createTraceFromActivities(2, "t2","t3","t2","t3"));
log.add(LogTraceUtils.createTraceFromActivities(3, "t2","t2","t3","t3"));
log.add(LogTraceUtils.createTraceFromActivities(4, "t2","t1","t2","t3"));
log.add(LogTraceUtils.createTraceFromActivities(5, "t1","t2","t3"));
log.add(LogTraceUtils.createTraceFromActivities(6, "t2","t2","t3"));

The class ReplayCallableGenerator contains static methods to replay traces on a Petri net. The following example replays the log on the P/T-Net with the termination criterion possible firing sequence :

ReplayCallableGenerator gen = new ReplayCallableGenerator(ptnet);
gen.setLogTraces(log);
gen.setTerminationCriteria(TerminationCriteria.POSSIBLE_FIRING_SEQUENCE);
ReplayResult result = Replay.replayTraces(gen);

The corresponding output is the following, where the percentage of fitting and non- fitting traces is shown:

Replaying log on model "PetriNet"... done [fitting=0.666666666666666,not fitting=0.3333333333333333] [9 milliseconds]

Which traces were fitting and which traces were non-fitting can be retrieved from the object result using the following methods:

System.out.println( result.getFittingTraces() );
System.out.println( result.getNonFittingTraces() );