236
259
private void processQuery(File file, Tuple<TimedArcPetriNet, NameMapping> composedModel, pipe.dataLayer.TAPNQuery queryToVerify) throws Exception {
237
if(queryToVerify.isActive()) {
238
VerificationResult<TimedArcPetriNetTrace> verificationResult = verifyQuery(file, composedModel, queryToVerify);
260
if(queryToVerify.isActive()) {
262
if(isSoundnessCheck) {
263
processSoundnessCheck(file, composedModel, queryToVerify);
265
if(!isSoundnessCheck) {
266
VerificationResult<TimedArcPetriNetTrace> verificationResult = verifyQuery(file, composedModel, queryToVerify);
240
if(verificationResult != null)
241
processVerificationResult(file, queryToVerify, verificationResult);
268
if(verificationResult != null)
269
processVerificationResult(file, queryToVerify, verificationResult);
244
273
publishResult(file.getName(), queryToVerify, "Skipped - query is disabled because it contains propositions involving places from a deactivated component", 0, new NullStats());
245
275
fireVerificationTaskComplete();
248
private pipe.dataLayer.TAPNQuery overrideVerificationOptions(TimedArcPetriNet model, pipe.dataLayer.TAPNQuery query) throws Exception {
277
private void processSoundnessCheck(final File file, Tuple<TimedArcPetriNet, NameMapping> composedModel, final pipe.dataLayer.TAPNQuery queryToVerify) throws Exception{
278
VerificationResult<TimedArcPetriNetTrace> verificationResult;
279
if(queryToVerify.getWorkflowMode() == WorkflowMode.WORKFLOW_SOUNDNESS) {
281
verificationResult = verifyQuery(file, composedModel, queryToVerify);
282
if(verificationResult != null)
283
processVerificationResult(file, queryToVerify, verificationResult);
284
} catch (Exception e) {
285
publishResult(file.getName(), queryToVerify, "Skipped - model not supported by the verification method. Try running workflow analysis from the menu.", 0, new NullStats());
288
if(queryToVerify.getWorkflowMode() == WorkflowMode.WORKFLOW_STRONG_SOUNDNESS) {
289
//Test for Soundness before Strong Soundness
290
pipe.dataLayer.TAPNQuery queryToCheckIfSound = new pipe.dataLayer.TAPNQuery(
291
"Workflow soundness check", queryToVerify.getCapacity(),
292
new TCTLEFNode(new TCTLTrueNode()), TraceOption.SOME,
293
SearchOption.DEFAULT,
294
ReductionOption.VerifyTAPNdiscreteVerification, true, true,
295
false, true, false, null, ExtrapolationOption.AUTOMATIC,
296
WorkflowMode.WORKFLOW_SOUNDNESS);
299
final VerificationResult<TimedArcPetriNetTrace> resultOfSoundCheck = verifyQuery(file, composedModel, queryToCheckIfSound);
300
//Strong Soundness check
301
if(resultOfSoundCheck.isQuerySatisfied()) {
302
long m = resultOfSoundCheck.stats().exploredStates();
304
for (TimedPlace p : composedModel.value1().places()) {
305
if (p.invariant().upperBound().equals(Bound.Infinity)) {
308
B = Math.max(B, p.invariant().upperBound().value());
311
queryToVerify.setStrongSoundnessBound(c);
312
Verifier.runVerifyTAPNVerification(model.network(), queryToVerify, new VerificationCallback() {
319
public void run(VerificationResult<TAPNNetworkTrace> result) {
320
TraceType traceType = ((TimedTAPNNetworkTrace) result.getTrace()).getTraceType();
321
if(traceType == TraceType.EG_DELAY_FOREVER || traceType == TraceType.EG_LOOP) {
322
publishResult(file.getName(), queryToVerify, "Not Strongly Sound", result.verificationTime(), result.stats());
324
publishResult(file.getName(), queryToVerify, "Strongly Sound", result.verificationTime(), result.stats());
329
publishResult(file.getName(), queryToVerify, "Not Strongly Sound", resultOfSoundCheck.verificationTime(), resultOfSoundCheck.stats());
331
} catch (Exception e) {
332
publishResult(file.getName(), queryToVerify, "Skipped - model is not a workflow net. Try running workflow analysis from the menu.", time, new NullStats());
337
private pipe.dataLayer.TAPNQuery overrideVerificationOptions(TimedArcPetriNet model, pipe.dataLayer.TAPNQuery query, File fileToBeChecked) throws Exception {
249
338
if(batchProcessingVerificationOptions != null) {
250
SearchOption search = batchProcessingVerificationOptions.searchOption() == SearchOption.BatchProcessingKeepQueryOption ? query.getSearchOption() : batchProcessingVerificationOptions.searchOption();
251
ReductionOption option = query.getReductionOption();
252
TCTLAbstractProperty property;
254
if (batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.ExistDeadlock) {
255
property = generateExistDeadlock(model);
256
name = "Existence of a deadlock";
257
} else if (batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.SearchWholeStateSpace) {
258
property = generateSearchWholeStateSpaceProperty(model);
259
name = "Search whole state space";
261
property = query.getProperty();
262
name = query.getName();
264
boolean symmetry = batchProcessingVerificationOptions.symmetry() == SymmetryOption.KeepQueryOption ? query.useSymmetry() : getSymmetryFromBatchProcessingOptions();
265
boolean stubbornReduction = batchProcessingVerificationOptions.stubbornReductionOption() == StubbornReductionOption.KeepQueryOption ? query.isStubbornReductionEnabled() : getStubbornReductionFromBatchProcessingOptions();
266
339
int capacity = batchProcessingVerificationOptions.KeepCapacityFromQuery() ? query.getCapacity() : batchProcessingVerificationOptions.capacity();
267
boolean overApproximation = query.isOverApproximationEnabled();
268
boolean underApproximation = query.isUnderApproximationEnabled();
269
int approximationDenominator = query.approximationDenominator();
270
if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.None) {
271
overApproximation = false;
272
underApproximation = false;
273
} else if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.OverApproximation) {
274
overApproximation = true;
275
underApproximation = false;
276
} else if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.UnderApproximation) {
277
overApproximation = false;
278
underApproximation = true;
280
if (batchProcessingVerificationOptions.approximationDenominator() != 0) {
281
approximationDenominator = batchProcessingVerificationOptions.approximationDenominator();
284
pipe.dataLayer.TAPNQuery changedQuery = new pipe.dataLayer.TAPNQuery(name, capacity, property, TraceOption.NONE, search, option, symmetry, false, query.useTimeDarts(), query.usePTrie(), query.useOverApproximation(), query.useReduction(), query.getHashTableSize(), query.getExtrapolationOption(), query.inclusionPlaces(), overApproximation, underApproximation, approximationDenominator);
286
if(batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.KeepQueryOption)
287
changedQuery.setActive(query.isActive());
289
changedQuery.setCategory(query.getCategory());
290
changedQuery.setAlgorithmOption(query.getAlgorithmOption());
291
changedQuery.setUseSiphontrap(query.isSiphontrapEnabled());
292
changedQuery.setUseQueryReduction(query.isQueryReductionEnabled());
293
changedQuery.setUseStubbornReduction(stubbornReduction);
340
if(!(batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.StrongSoundness || batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.Soundness)) {
341
SearchOption search = batchProcessingVerificationOptions.searchOption() == SearchOption.BatchProcessingKeepQueryOption ? query.getSearchOption() : batchProcessingVerificationOptions.searchOption();
342
ReductionOption option = query.getReductionOption();
343
TCTLAbstractProperty property;
345
if (batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.ExistDeadlock) {
346
property = generateExistDeadlock(model);
347
name = "Existence of a deadlock";
348
filesProcessed.add(fileToBeChecked);
349
isModelCheckOnly = true;
350
} else if (batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.SearchWholeStateSpace) {
351
property = generateSearchWholeStateSpaceProperty(model);
352
name = "Search whole state space";
353
filesProcessed.add(fileToBeChecked);
354
isModelCheckOnly = true;
356
property = query.getProperty();
357
name = query.getName();
359
boolean symmetry = batchProcessingVerificationOptions.symmetry() == SymmetryOption.KeepQueryOption ? query.useSymmetry() : getSymmetryFromBatchProcessingOptions();
360
boolean stubbornReduction = batchProcessingVerificationOptions.stubbornReductionOption() == StubbornReductionOption.KeepQueryOption ? query.isStubbornReductionEnabled() : getStubbornReductionFromBatchProcessingOptions();
361
boolean overApproximation = query.isOverApproximationEnabled();
362
boolean underApproximation = query.isUnderApproximationEnabled();
363
int approximationDenominator = query.approximationDenominator();
364
if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.None) {
365
overApproximation = false;
366
underApproximation = false;
367
} else if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.OverApproximation) {
368
overApproximation = true;
369
underApproximation = false;
370
} else if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.UnderApproximation) {
371
overApproximation = false;
372
underApproximation = true;
374
if (batchProcessingVerificationOptions.approximationDenominator() != 0) {
375
approximationDenominator = batchProcessingVerificationOptions.approximationDenominator();
378
pipe.dataLayer.TAPNQuery changedQuery = new pipe.dataLayer.TAPNQuery(name, capacity, property, TraceOption.NONE, search, option, symmetry, false, query.useTimeDarts(), query.usePTrie(), query.useOverApproximation(), query.useReduction(), query.getHashTableSize(), query.getExtrapolationOption(), query.inclusionPlaces(), overApproximation, underApproximation, approximationDenominator);
380
if(batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.KeepQueryOption)
381
changedQuery.setActive(query.isActive());
383
changedQuery.setCategory(query.getCategory());
384
changedQuery.setAlgorithmOption(query.getAlgorithmOption());
385
changedQuery.setUseSiphontrap(query.isSiphontrapEnabled());
386
changedQuery.setUseQueryReduction(query.isQueryReductionEnabled());
387
changedQuery.setUseStubbornReduction(stubbornReduction);
389
} else if (batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.Soundness) {
390
isSoundnessCheck = true;
391
query = new pipe.dataLayer.TAPNQuery(
392
"Workflow soundness check", capacity,
393
new TCTLEFNode(new TCTLTrueNode()), TraceOption.SOME,
394
SearchOption.DEFAULT,
395
ReductionOption.VerifyTAPNdiscreteVerification, true, true,
396
false, true, false, null, ExtrapolationOption.AUTOMATIC,
397
WorkflowMode.WORKFLOW_SOUNDNESS);
398
filesProcessed.add(fileToBeChecked);
399
isModelCheckOnly = true;
401
} else if (batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.StrongSoundness) {
402
isSoundnessCheck = true;
403
query = new pipe.dataLayer.TAPNQuery(
404
"Workflow soundness check", capacity,
405
new TCTLEGNode(new TCTLTrueNode()), TraceOption.SOME,
406
SearchOption.DEFAULT,
407
ReductionOption.VerifyTAPNdiscreteVerification, true, true,
408
false, true, false, null, ExtrapolationOption.AUTOMATIC,
409
WorkflowMode.WORKFLOW_STRONG_SOUNDNESS);
410
filesProcessed.add(fileToBeChecked);
411
isModelCheckOnly = true;
418
private pipe.dataLayer.TAPNQuery createQueryFromQueryPropertyOption(TimedArcPetriNet model, QueryPropertyOption option, File fileToBeChecked) throws Exception {
419
int capacity = batchProcessingVerificationOptions.capacity();
420
ReductionOption reductionOption = model.isUntimed() ? ReductionOption.VerifyPN : ReductionOption.VerifyTAPN;
421
if(option == QueryPropertyOption.ExistDeadlock) {
422
filesProcessed.add(fileToBeChecked);
423
return new pipe.dataLayer.TAPNQuery(
424
"Existence of a deadlock", capacity,
425
generateExistDeadlock(model), TraceOption.NONE,
426
SearchOption.DEFAULT,
427
reductionOption, true, true,
428
false, true, false, null, ExtrapolationOption.AUTOMATIC,
429
WorkflowMode.WORKFLOW_SOUNDNESS);
431
if(option == QueryPropertyOption.SearchWholeStateSpace) {
432
filesProcessed.add(fileToBeChecked);
433
return new pipe.dataLayer.TAPNQuery(
434
"Search whole state space", capacity,
435
generateSearchWholeStateSpaceProperty(model), TraceOption.NONE,
436
SearchOption.DEFAULT,
437
reductionOption, true, true,
438
false, true, false, null, ExtrapolationOption.AUTOMATIC,
439
WorkflowMode.WORKFLOW_SOUNDNESS);
441
if (option == QueryPropertyOption.Soundness) {
442
isSoundnessCheck = true;
443
filesProcessed.add(fileToBeChecked);
444
return new pipe.dataLayer.TAPNQuery(
445
"Workflow soundness check", capacity,
446
new TCTLEFNode(new TCTLTrueNode()), TraceOption.SOME,
447
SearchOption.DEFAULT,
448
ReductionOption.VerifyTAPNdiscreteVerification, true, true,
449
false, true, false, null, ExtrapolationOption.AUTOMATIC,
450
WorkflowMode.WORKFLOW_SOUNDNESS);
452
if(option == QueryPropertyOption.StrongSoundness) {
453
isSoundnessCheck = true;
454
filesProcessed.add(fileToBeChecked);
455
return new pipe.dataLayer.TAPNQuery(
456
"Workflow soundness check", capacity,
457
new TCTLEGNode(new TCTLTrueNode()), TraceOption.SOME,
458
SearchOption.DEFAULT,
459
ReductionOption.VerifyTAPNdiscreteVerification, true, true,
460
false, true, false, null, ExtrapolationOption.AUTOMATIC,
461
WorkflowMode.WORKFLOW_STRONG_SOUNDNESS);
300
466
private boolean getSymmetryFromBatchProcessingOptions() {
301
467
return batchProcessingVerificationOptions.symmetry() == SymmetryOption.Yes;