Merge lp:~tapaal-approx/tapaal/tapaal-approx-new into lp:tapaal
- tapaal-approx-new
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Jiri Srba |
Approved revision: | 941 |
Merged at revision: | 861 |
Proposed branch: | lp:~tapaal-approx/tapaal/tapaal-approx-new |
Merge into: | lp:tapaal |
Diff against target: |
4202 lines (+2661/-154) 47 files modified
src/dk/aau/cs/approximation/ApproximationWorker.java (+671/-0) src/dk/aau/cs/approximation/ITAPNApproximation.java (+9/-0) src/dk/aau/cs/approximation/OverApproximation.java (+264/-0) src/dk/aau/cs/approximation/UnderApproximation.java (+191/-0) src/dk/aau/cs/gui/BatchProcessingDialog.java (+142/-9) src/dk/aau/cs/gui/TabContent.java (+4/-0) src/dk/aau/cs/io/TapnXmlLoader.java (+32/-2) src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java (+3/-0) src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java (+33/-2) src/dk/aau/cs/io/batchProcessing/BatchProcessingResultsExporter.java (+21/-3) src/dk/aau/cs/model/tapn/TAPNQuery.java (+4/-0) src/dk/aau/cs/model/tapn/TimeInterval.java (+8/-0) src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java (+2/-1) src/dk/aau/cs/model/tapn/TimedToken.java (+4/-0) src/dk/aau/cs/model/tapn/TransportArc.java (+2/-1) src/dk/aau/cs/model/tapn/simulation/TAPNNetworkTimeDelayStep.java (+4/-0) src/dk/aau/cs/model/tapn/simulation/TimeDelayStep.java (+4/-0) src/dk/aau/cs/model/tapn/simulation/TimedArcPetriNetTrace.java (+35/-0) src/dk/aau/cs/util/MemoryMonitor.java (+11/-2) src/dk/aau/cs/verification/ITAPNComposer.java (+12/-0) src/dk/aau/cs/verification/NameMapping.java (+2/-2) src/dk/aau/cs/verification/QueryResult.java (+30/-2) src/dk/aau/cs/verification/TAPNComposer.java (+2/-3) src/dk/aau/cs/verification/TAPNComposerWithGUI.java (+599/-0) src/dk/aau/cs/verification/UPPAAL/Verifyta.java (+6/-1) src/dk/aau/cs/verification/UPPAAL/VerifytaOptions.java (+30/-5) src/dk/aau/cs/verification/VerificationOptions.java (+5/-0) src/dk/aau/cs/verification/VerificationResult.java (+8/-0) src/dk/aau/cs/verification/VerifyTAPN/VerifyDTAPNOptions.java (+15/-10) src/dk/aau/cs/verification/VerifyTAPN/VerifyPNOptions.java (+4/-4) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNExporter.java (+3/-3) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNIconSelector.java (+2/-0) src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNOptions.java (+32/-7) src/dk/aau/cs/verification/batchProcessing/BatchProcessingVerificationOptions.java (+19/-3) src/dk/aau/cs/verification/batchProcessing/BatchProcessingWorker.java (+87/-24) src/pipe/dataLayer/DataLayer.java (+9/-1) src/pipe/dataLayer/TAPNQuery.java (+31/-2) src/pipe/gui/GuiFrame.java (+3/-3) src/pipe/gui/KBoundAnalyzer.java (+4/-4) src/pipe/gui/RunKBoundAnalysis.java (+1/-1) src/pipe/gui/RunVerification.java (+7/-4) src/pipe/gui/RunVerificationBase.java (+54/-25) src/pipe/gui/Verifier.java (+16/-8) src/pipe/gui/graphicElements/Arc.java (+4/-0) src/pipe/gui/widgets/InclusionPlaces.java (+15/-0) src/pipe/gui/widgets/QueryDialog.java (+214/-19) src/pipe/gui/widgets/QueryPane.java (+3/-3) |
To merge this branch: | bzr merge lp:~tapaal-approx/tapaal/tapaal-approx-new |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jakob Taankvist (community) | Approve | ||
Jiri Srba | Approve | ||
Mathias Grund Sørensen (community) | code | Approve | |
Kenneth Yrke Jørgensen | code | Needs Fixing | |
Review via email: mp+218200@code.launchpad.net |
Commit message
Implements over and under-approximation of time intervals both in the query dialog and for batch processing. A new net composed with GUI is
added too.
Description of the change
Implements over and under-approximation of time intervals both in the query dialog and for batch processing. A new net composed with GUI is
added too.
Mathias Grund Sørensen (mathias.grund) wrote : | # |
Jakob Taankvist (jakob-taankvist) wrote : | # |
I've looked through the code and one think i think should be fixed are some very long functions. Is it possible to split these into multiple functions in a logical way? Very long functions are e.g.:
makeTraceTAPN lines: 93 - 275
modifyTAPN lines: 315 - 421
verify lines: 2557 - 2841
doInBackground lines: 3135 - 3468
I also noticed a lot of nesting of for and if in these functions, it would be nice if could somehow be avoided:
reduceTraceForO
Some of the code in the action listener in lines 4020 - 4062 should maybe be done in the composer class - at least I think it's a very long action listener, which might make it hard to use the composer in other parts of the code later. (an option would be to move the code to a function somewhere logical, and then calling this function from the action listener).
Kenneth Yrke Jørgensen (yrke) wrote : | # |
Just a quick question about the following lines:
910 s.append((query != null) ? (query.
911 s.append(
912 s.append((query != null) ? getVerification
913 + s.append(
914 + s.append((query != null) ? getApproximatio
915 + s.append(
916 + s.append((query != null) ? query.approxima
For me it seems more natural to make one if one query and then do all the append stuff:
if (query != null) {
//build string
s.append(
s.append(....)
...
}
The other way seams a little strange to me (unless there is something special about how query works, which really should be fixed then). (i know i was done this way in the original code as well, but i still think it needs to be fixed)
Jakob Taankvist (jakob-taankvist) wrote : | # |
Another comment - should TAPNComposer be replaced by the new TAPNComposerExt
If not the name "TAPNComposerEx
Thomas Stig Jacobsen (tsja10) wrote : | # |
The dumpToConsole in the TAPNComposerExt
I am not quite sure where the code for verification aborts are, but if you can lead me the right direction I'll check it or add it to the code.
> Nothing major comes to mind, a few comments though:
>
> - Please remove dumpToConsole function (no debug code in trunk)
> - please remove commented code (I spotted a commented call to dumpToConsole
> and something around line 3935)
> - some funny comment thing is going on around line 1273, this should probably
> go
> - some funny thing going on with null in line 980, but I assume it's ok (looks
> A little hacksy)
> - maybe one could consider attaching to memory monitor with commulative flag
> for process, rather than the current design where you have to remember to turn
> it off again (I hope you remember to do this in all places! Have you handled
> aborts etc? I did not go through the code to verify this :) )
>
> The code generally looks okay, but I believe at least the first two comments
> should be addressed before merge.
Thomas Stig Jacobsen (tsja10) wrote : | # |
The verify and doInBackground methods could maybe be moved to the OverApproximation and UnderApproximation, however, since verify and doInBackground returns different and works with different types the code could not be reused. I can have a try with moving the code if you want to, but I am not quite sure that it would work perfectly at the moment.
Both makeTraceTAPN and modifyTAPN represents complete algorithms from the article and I think it is nicer to keep these together as a whole rather than splitting them up, even though the methods are 100+ lines of code.
The TAPNComposer should not be replaced by the new TAPNComposerExt
The TAPNComposerExt
> I've looked through the code and one think i think should be fixed are some
> very long functions. Is it possible to split these into multiple functions in
> a logical way? Very long functions are e.g.:
>
> makeTraceTAPN lines: 93 - 275
> modifyTAPN lines: 315 - 421
> verify lines: 2557 - 2841
> doInBackground lines: 3135 - 3468
>
> I also noticed a lot of nesting of for and if in these functions, it would be
> nice if could somehow be avoided:
> reduceTraceForO
>
> Some of the code in the action listener in lines 4020 - 4062 should maybe be
> done in the composer class - at least I think it's a very long action
> listener, which might make it hard to use the composer in other parts of the
> code later. (an option would be to move the code to a function somewhere
> logical, and then calling this function from the action listener).
Thomas Stig Jacobsen (tsja10) wrote : | # |
Regarding the exportToCSV method from which the lines 910-016 is from, we've used the style of code which was already used with the multiple appends, if the lines should be refactored, I think the rest of the method (or the class) should be refactored as well. A possible explanation to the way this is done now is that the XmlLoader when opening nets expects a certain number of delimiters for padding but I haven't check up on that. If not, I do agree this should be redone.
> Just a quick question about the following lines:
>
> 910 s.append((query != null) ?
> (query.
> 911 s.append(
> 912 s.append((query != null) ?
> getVerification
> 913 + s.append(
> 914 + s.append((query != null) ?
> getApproximatio
> 915 + s.append(
> 916 + s.append((query != null) ?
> query.approxima
>
> For me it seems more natural to make one if one query and then do all the
> append stuff:
>
> if (query != null) {
> //build string
> s.append(
> s.append(....)
> ...
> }
>
> The other way seams a little strange to me (unless there is something special
> about how query works, which really should be fixed then). (i know i was done
> this way in the original code as well, but i still think it needs to be fixed)
- 934. By Thomas Stig Jacobsen
-
Initial merge fixes
Jakob Taankvist (jakob-taankvist) wrote : | # |
> The verify and doInBackground methods could maybe be moved to the
> OverApproximation and UnderApproximation, however, since verify and
> doInBackground returns different and works with different types the code could
> not be reused. I can have a try with moving the code if you want to, but I am
> not quite sure that it would work perfectly at the moment.
I think it's a good idea to move this code somewhere else, I also think it would be crucial to split the functions (but I guess it's part of moving them)
> Both makeTraceTAPN and modifyTAPN represents complete algorithms from the
> article and I think it is nicer to keep these together as a whole rather than
> splitting them up, even though the methods are 100+ lines of code.
I think it would be fine to split these up, they have their own class anyway, and if they are doing something algorithmic it's probably hard to understand from the code what they are doing. So i think it would be better to make some more methods.
I don't think this would split up the algorithm. It would merely move technical details to helper methods.
All that said i think the two other comments are more important, and as the methods are in separate files it might be ok.
> The TAPNComposer should not be replaced by the new TAPNComposerExt
> the TAPNComposerExt
> is needed, otherwise the normal TAPNComposer should be used.
> The TAPNComposerExt
> nets in the network into one net), but is also builds a new DataLayer for this
> new net so it can be opened in TAPAAL for viewing. I'm not quite sure what it
> should be called but I'm open for suggestions.
To me it sounds like TAPNComposerExt
It feels like maybe they should inherit from each other or have a common superclass?
Maybe we could just send a flag to TAPNComposerExt
As for a name I think TAPNComposerWithGUI would be more explanatory.
PS: I'm looking forward to have this merged, it's a really cool idea, and the code will definitely raise the average code quality in TAPAAL :P
> > I've looked through the code and one think i think should be fixed are some
> > very long functions. Is it possible to split these into multiple functions
> in
> > a logical way? Very long functions are e.g.:
> >
> > makeTraceTAPN lines: 93 - 275
> > modifyTAPN lines: 315 - 421
> > verify lines: 2557 - 2841
> > doInBackground lines: 3135 - 3468
> >
> > I also noticed a lot of nesting of for and if in these functions, it would
> be
> > nice if could somehow be avoided:
> > reduceTraceForO
> >
> > Some of the code in the action listener in lines 4020 - 4062 should maybe be
> > done in the composer class - at least I think it's a very long action
> > listener, which might make it hard to use the composer in other parts of the
> > code later. (an option would be to move the code to a function somewhere
> > logica...
- 935. By Thomas Stig Jacobsen
-
Moving of functionality to its own class from action listeners
Thomas Stig Jacobsen (tsja10) wrote : | # |
I've pushed a move of the functionality in verify and doInBackground as discussed.
However, the TAPNComposerExt
Essentially the new composer takes a HashMap<
Mathias Grund Sørensen (mathias.grund) wrote : | # |
Bug regarding the way you enable cumulative memory reporting:
Open alternativ-
change k to 50,
run discrete engine with under-approxima
interrupt when memory has accumulated some higher number (I interrupted at 50-60MB),
open intro-example and verify.
Memory is now reported as 50-60MB (because the cumulative option is not turned off). I strongly suggest adding cumulative option as a parameter for the attach function call rather than as a separate function call as it is currently implemented (please also keep the function to attach without the flag).
Jiri Srba (srba) wrote : | # |
I tried to make a summary of what should be done with suggested solutions so that
we can merge this branch to trunk asap (other branches are waiting on this merge at the moment).
1. Issue with long methods that should be split into more functions.
(Not essential for merge, could be done in a separate branch and I could put it
on the bug list unless someone will take a look at this before the merge).
2. s.append issues by Kenneth is in other code as well; I suggest not to fix it in this
branch and make a separate branch for this (I will make a bug report so that we do not forget).
3. TAPNComposerExt
replaced with the one with GUI or use inheritance as Jakob suggested? Looking forward
to hear options on this.
4. The memory monitor is buggy at the moment and should be changed according to Mathias' suggestion
(extra argument that would signal that it is a commulative memory monitor). See the
issue in the comment just above.
Please, react to those comments so that we can merge it asap. Thanks.
Thomas Stig Jacobsen (tsja10) wrote : | # |
There is a problem doing the solution that Mathias suggested. Both solutions (the one that is now and Mathias’) are possible but there are tradeoffs.
Doing it the way it is now, it is possible to turn off the cumulative mode on and off from anywhere in the problem. For example as now, in the code for approximations and event listeners for when an verification is aborted (I’ve fixed that bug, just to see how easy it was).
In the way that Mathias’ suggested, it is “prettier”, I totally agree that – first off. I’ve implemented the solution and it works, but there is a but. The ProcessRunner class which attaches the MemoryMonitor to the verification process do not know if the cumulative mode should be turned on or off since it does not get the query of the verification passed on, and I don’t think that it should.
So there is a tradeoff here, so what solution do people think would be the best?
Mathias Grund Sørensen (mathias.grund) wrote : | # |
> There is a problem doing the solution that Mathias suggested. Both solutions
> (the one that is now and Mathias’) are possible but there are tradeoffs.
> Doing it the way it is now, it is possible to turn off the cumulative mode on
> and off from anywhere in the problem. For example as now, in the code for
> approximations and event listeners for when an verification is aborted (I’ve
> fixed that bug, just to see how easy it was).
> In the way that Mathias’ suggested, it is “prettier”, I totally agree that –
> first off. I’ve implemented the solution and it works, but there is a but. The
> ProcessRunner class which attaches the MemoryMonitor to the verification
> process do not know if the cumulative mode should be turned on or off since it
> does not get the query of the verification passed on, and I don’t think that
> it should.
> So there is a tradeoff here, so what solution do people think would be the
> best?
I see. I agree that it can be a function call by itself then (as we don't want to refactor too much of the existing code at the moment). I then suggest changing setCumulativePe
Thomas Stig Jacobsen (tsja10) wrote : | # |
Just pushed a commit to fix this.
Mathias Grund Sørensen (mathias.grund) wrote : | # |
Cumulative memory implementation nok looks as expected. I have not run the code or considered other parts of the code in this review.
- 940. By Christoffer Moesgaard
-
Splitting up large methods into smaller functions
Thomas Stig Jacobsen (tsja10) wrote : | # |
Sine and Christoffer have now tried to split up both makeTraceTAPN and modifyTAPN, please review these changes.
Jiri Srba (srba) wrote : | # |
Thomas, has it been pushed 16 hours ago by Christoffer or is it something new that has not been pushed yet?
Thomas Stig Jacobsen (tsja10) wrote : | # |
Yes it is the commit by Christoffer (#940).
Jiri Srba (srba) wrote : | # |
I have renamed TAPNComposerExt
We should take a look if we need both composers or only one, I will make a separate bug report.
Otherwise the rest should be fixed now. The s.append tests in batch processing cannot be
simply replaced by if block due to delimiters. I think it is ok as it is.
Jiri Srba (srba) : | # |
Jiri Srba (srba) : | # |
Jakob Taankvist (jakob-taankvist) : | # |
Preview Diff
1 | === added directory 'src/dk/aau/cs/approximation' |
2 | === added file 'src/dk/aau/cs/approximation/ApproximationWorker.java' |
3 | --- src/dk/aau/cs/approximation/ApproximationWorker.java 1970-01-01 00:00:00 +0000 |
4 | +++ src/dk/aau/cs/approximation/ApproximationWorker.java 2014-05-28 18:52:41 +0000 |
5 | @@ -0,0 +1,671 @@ |
6 | +package dk.aau.cs.approximation; |
7 | + |
8 | +import java.math.BigDecimal; |
9 | + |
10 | +import javax.swing.SwingWorker.StateValue; |
11 | + |
12 | +import pipe.dataLayer.TAPNQuery.SearchOption; |
13 | +import pipe.dataLayer.TAPNQuery.TraceOption; |
14 | +import pipe.gui.FileFinderImpl; |
15 | +import pipe.gui.MessengerImpl; |
16 | +import pipe.gui.RunVerificationBase; |
17 | +import pipe.gui.widgets.InclusionPlaces; |
18 | +import dk.aau.cs.Messenger; |
19 | +import dk.aau.cs.io.batchProcessing.LoadedBatchProcessingModel; |
20 | +import dk.aau.cs.model.tapn.TAPNQuery; |
21 | +import dk.aau.cs.model.tapn.TimedArcPetriNet; |
22 | +import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
23 | +import dk.aau.cs.model.tapn.TimedToken; |
24 | +import dk.aau.cs.model.tapn.simulation.TAPNNetworkTrace; |
25 | +import dk.aau.cs.model.tapn.simulation.TimeDelayStep; |
26 | +import dk.aau.cs.model.tapn.simulation.TimedArcPetriNetStep; |
27 | +import dk.aau.cs.model.tapn.simulation.TimedArcPetriNetTrace; |
28 | +import dk.aau.cs.model.tapn.simulation.TimedTransitionStep; |
29 | +import dk.aau.cs.translations.ReductionOption; |
30 | +import dk.aau.cs.util.MemoryMonitor; |
31 | +import dk.aau.cs.util.Tuple; |
32 | +import dk.aau.cs.verification.ITAPNComposer; |
33 | +import dk.aau.cs.verification.ModelChecker; |
34 | +import dk.aau.cs.verification.NameMapping; |
35 | +import dk.aau.cs.verification.QueryResult; |
36 | +import dk.aau.cs.verification.QueryType; |
37 | +import dk.aau.cs.verification.TAPNComposer; |
38 | +import dk.aau.cs.verification.TAPNTraceDecomposer; |
39 | +import dk.aau.cs.verification.VerificationOptions; |
40 | +import dk.aau.cs.verification.VerificationResult; |
41 | +import dk.aau.cs.verification.UPPAAL.Verifyta; |
42 | +import dk.aau.cs.verification.UPPAAL.VerifytaOptions; |
43 | +import dk.aau.cs.verification.VerifyTAPN.ModelReduction; |
44 | +import dk.aau.cs.verification.VerifyTAPN.VerifyPN; |
45 | +import dk.aau.cs.verification.VerifyTAPN.VerifyPNOptions; |
46 | +import dk.aau.cs.verification.VerifyTAPN.VerifyTAPN; |
47 | +import dk.aau.cs.verification.VerifyTAPN.VerifyTAPNDiscreteVerification; |
48 | +import dk.aau.cs.verification.VerifyTAPN.VerifyTAPNOptions; |
49 | +import dk.aau.cs.verification.batchProcessing.BatchProcessingWorker; |
50 | + |
51 | +public class ApproximationWorker { |
52 | + public VerificationResult<TAPNNetworkTrace> normalWorker(VerificationOptions options, ModelChecker modelChecker, |
53 | + Tuple<TimedArcPetriNet, NameMapping> transformedModel, ITAPNComposer composer, TAPNQuery clonedQuery, |
54 | + RunVerificationBase verificationBase, TimedArcPetriNetNetwork model) throws Exception { |
55 | + |
56 | + // If options is of an instance of VerifyTAPNOptions then save the inclusion places before verify alters them |
57 | + InclusionPlaces oldInclusionPlaces = null; |
58 | + if (options instanceof VerifyTAPNOptions) |
59 | + oldInclusionPlaces = ((VerifyTAPNOptions) options).inclusionPlaces(); |
60 | + |
61 | + // Enable SOME_TRACE if not already |
62 | + TraceOption oldTraceOption = options.traceOption(); |
63 | + if ((options.enableOverApproximation() || options.enableUnderApproximation()) && !(options instanceof VerifytaOptions)) { |
64 | + options.setTraceOption(TraceOption.SOME); |
65 | + } |
66 | + |
67 | + VerificationResult<TAPNNetworkTrace> value = null; |
68 | + VerificationResult<TimedArcPetriNetTrace> result = modelChecker.verify(options, transformedModel, clonedQuery); |
69 | + if (verificationBase.isCancelled()) { |
70 | + verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
71 | + } |
72 | + if (result.error()) { |
73 | + options.setTraceOption(oldTraceOption); |
74 | + return new VerificationResult<TAPNNetworkTrace>(result.errorMessage(), result.verificationTime()); |
75 | + } |
76 | + else if (options.enableOverApproximation()) { |
77 | + // Over-approximation |
78 | + if (options.approximationDenominator() == 1) { |
79 | + // If r = 1 |
80 | + // No matter what it answered -> return that answer |
81 | + QueryResult queryResult = result.getQueryResult(); |
82 | + value = new VerificationResult<TAPNNetworkTrace>( |
83 | + queryResult, |
84 | + decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
85 | + decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
86 | + result.verificationTime(), |
87 | + result.stats(), |
88 | + result.isOverApproximationResult()); |
89 | + value.setNameMapping(transformedModel.value2()); |
90 | + } else { |
91 | + // If r > 1 |
92 | + if (result.getTrace() != null && (((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && result.getQueryResult().isQuerySatisfied()) |
93 | + || ((result.getQueryResult().queryType() == QueryType.AG || result.getQueryResult().queryType() == QueryType.AF) && !result.getQueryResult().isQuerySatisfied()))) { |
94 | + // If we have a trace AND ((EF OR EG) AND satisfied) OR ((AG OR AF) AND not satisfied) |
95 | + // The results are inconclusive, but we get a trace and can use trace TAPN for verification. |
96 | + |
97 | + VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
98 | + value = new VerificationResult<TAPNNetworkTrace>( |
99 | + approxResult.getQueryResult(), |
100 | + decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
101 | + decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
102 | + approxResult.verificationTime(), |
103 | + approxResult.stats(), |
104 | + approxResult.isOverApproximationResult()); |
105 | + value.setNameMapping(transformedModel.value2()); |
106 | + |
107 | + OverApproximation overaprx = new OverApproximation(); |
108 | + |
109 | + //Create trace TAPN from the trace |
110 | + Tuple<TimedArcPetriNet, NameMapping> transformedOriginalModel = composer.transformModel(model); |
111 | + overaprx.makeTraceTAPN(transformedOriginalModel, value, clonedQuery); |
112 | + |
113 | + // Reset the inclusion places in order to avoid NullPointerExceptions |
114 | + if (options instanceof VerifyTAPNOptions && oldInclusionPlaces != null) |
115 | + ((VerifyTAPNOptions) options).setInclusionPlaces(oldInclusionPlaces); |
116 | + |
117 | + // run model checker again for trace TAPN |
118 | + MemoryMonitor.cumulateMemory(); |
119 | + result = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
120 | + if (verificationBase.isCancelled()) { |
121 | + verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
122 | + } |
123 | + if (result.error()) { |
124 | + options.setTraceOption(oldTraceOption); |
125 | + // if the old trace option was none, we need to set the results traces to null so GUI doesn't try to display the traces later |
126 | + if (oldTraceOption == TraceOption.NONE && value != null){ |
127 | + value.setTrace(null); |
128 | + value.setSecondaryTrace(null); |
129 | + } |
130 | + return new VerificationResult<TAPNNetworkTrace>(result.errorMessage(), result.verificationTime()); |
131 | + } |
132 | + //Create the result from trace TAPN |
133 | + renameTraceTransitions(result.getTrace()); |
134 | + renameTraceTransitions(result.getSecondaryTrace()); |
135 | + QueryResult queryResult = result.getQueryResult(); |
136 | + |
137 | + // If ((EG OR EG) AND not satisfied trace) OR ((AG OR AF) AND satisfied trace) -> inconclusive |
138 | + if (((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && !queryResult.isQuerySatisfied()) |
139 | + || ((result.getQueryResult().queryType() == QueryType.AG || result.getQueryResult().queryType() == QueryType.AF) && queryResult.isQuerySatisfied())){ |
140 | + queryResult.setApproximationInconclusive(true); |
141 | + } |
142 | + |
143 | + // If satisfied trace -> Return result |
144 | + // This is satisfied for EF and EG and not satisfied for AG and AF |
145 | + value = new VerificationResult<TAPNNetworkTrace>( |
146 | + queryResult, |
147 | + decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
148 | + decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
149 | + approxResult.verificationTime() + result.verificationTime(), |
150 | + approxResult.stats(), |
151 | + approxResult.isOverApproximationResult()); |
152 | + value.setNameMapping(transformedModel.value2()); |
153 | + } |
154 | + else if (((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && !result.getQueryResult().isQuerySatisfied()) |
155 | + || ((result.getQueryResult().queryType() == QueryType.AG || result.getQueryResult().queryType() == QueryType.AF) && result.getQueryResult().isQuerySatisfied())) { |
156 | + // If ((EF OR EG) AND not satisfied) OR ((AG OR AF) AND satisfied) |
157 | + |
158 | + QueryResult queryResult = result.getQueryResult(); |
159 | + |
160 | + if(queryResult.hasDeadlock() || result.getQueryResult().queryType() == QueryType.EG || result.getQueryResult().queryType() == QueryType.AF){ |
161 | + queryResult.setApproximationInconclusive(true); |
162 | + } |
163 | + |
164 | + VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
165 | + value = new VerificationResult<TAPNNetworkTrace>( |
166 | + approxResult.getQueryResult(), |
167 | + decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
168 | + decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
169 | + approxResult.verificationTime(), |
170 | + approxResult.stats(), |
171 | + approxResult.isOverApproximationResult()); |
172 | + value.setNameMapping(transformedModel.value2()); |
173 | + } else { |
174 | + // We cannot use the result directly, and did not get a trace. |
175 | + |
176 | + QueryResult queryResult = result.getQueryResult(); |
177 | + queryResult.setApproximationInconclusive(true); |
178 | + |
179 | + VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
180 | + value = new VerificationResult<TAPNNetworkTrace>( |
181 | + approxResult.getQueryResult(), |
182 | + decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
183 | + decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
184 | + approxResult.verificationTime(), |
185 | + approxResult.stats(), |
186 | + approxResult.isOverApproximationResult()); |
187 | + value.setNameMapping(transformedModel.value2()); |
188 | + |
189 | + } |
190 | + } |
191 | + } |
192 | + else if (options.enableUnderApproximation()) { |
193 | + // Under-approximation |
194 | + |
195 | + if (result.getTrace() != null) { |
196 | + for (TimedArcPetriNetStep k : result.getTrace()) { |
197 | + if (k instanceof TimeDelayStep){ |
198 | + ((TimeDelayStep) k).setDelay(((TimeDelayStep) k).delay().multiply(new BigDecimal(options.approximationDenominator()))); |
199 | + } |
200 | + else if (k instanceof TimedTransitionStep) { |
201 | + for (TimedToken a : ((TimedTransitionStep) k).consumedTokens()){ |
202 | + a.setAge(a.age().multiply(new BigDecimal(options.approximationDenominator()))); |
203 | + } |
204 | + } |
205 | + } |
206 | + } |
207 | + |
208 | + if (options.approximationDenominator() == 1) { |
209 | + // If r = 1 |
210 | + // No matter it answered -> return that answer |
211 | + QueryResult queryResult= result.getQueryResult(); |
212 | + value = new VerificationResult<TAPNNetworkTrace>( |
213 | + queryResult, |
214 | + decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
215 | + decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
216 | + result.verificationTime(), |
217 | + result.stats(), |
218 | + result.isOverApproximationResult()); |
219 | + value.setNameMapping(transformedModel.value2()); |
220 | + } |
221 | + else { |
222 | + // If r > 1 |
223 | + if ((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && ! result.getQueryResult().isQuerySatisfied() |
224 | + || ((result.getQueryResult().queryType() == QueryType.AG || result.getQueryResult().queryType() == QueryType.AF) && result.getQueryResult().isQuerySatisfied())) { |
225 | + // If ((EF OR EG) AND not satisfied) OR ((AG OR AF) and satisfied) -> Inconclusive |
226 | + QueryResult queryResult= result.getQueryResult(); |
227 | + queryResult.setApproximationInconclusive(true); |
228 | + value = new VerificationResult<TAPNNetworkTrace>( |
229 | + queryResult, |
230 | + decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
231 | + decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
232 | + result.verificationTime(), |
233 | + result.stats(), |
234 | + result.isOverApproximationResult()); |
235 | + value.setNameMapping(transformedModel.value2()); |
236 | + } else if ((result.getQueryResult().queryType() == QueryType.EF || result.getQueryResult().queryType() == QueryType.EG) && result.getQueryResult().isQuerySatisfied() |
237 | + || ((result.getQueryResult().queryType() == QueryType.AG || result.getQueryResult().queryType() == QueryType.AF) && ! result.getQueryResult().isQuerySatisfied())) { |
238 | + |
239 | + if (result.getTrace() != null){ |
240 | + // If query does have deadlock or EG or AF a trace -> create trace TAPN |
241 | + //Create the verification satisfied result for the approximation |
242 | + VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
243 | + value = new VerificationResult<TAPNNetworkTrace>( |
244 | + approxResult.getQueryResult(), |
245 | + decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
246 | + decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
247 | + approxResult.verificationTime(), |
248 | + approxResult.stats(), |
249 | + result.isOverApproximationResult()); |
250 | + value.setNameMapping(transformedModel.value2()); |
251 | + |
252 | + OverApproximation overaprx = new OverApproximation(); |
253 | + |
254 | + |
255 | + //Create trace TAPN from the trace |
256 | + Tuple<TimedArcPetriNet, NameMapping> transformedOriginalModel = composer.transformModel(model); |
257 | + overaprx.makeTraceTAPN(transformedOriginalModel, value, clonedQuery); |
258 | + |
259 | + // Reset the inclusion places in order to avoid NullPointerExceptions |
260 | + if (options instanceof VerifyTAPNOptions && oldInclusionPlaces != null) |
261 | + ((VerifyTAPNOptions) options).setInclusionPlaces(oldInclusionPlaces); |
262 | + |
263 | + //run model checker again for trace TAPN |
264 | + MemoryMonitor.cumulateMemory(); |
265 | + result = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
266 | + if (verificationBase.isCancelled()) { |
267 | + verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
268 | + } |
269 | + if (result.error()) { |
270 | + options.setTraceOption(oldTraceOption); |
271 | + // if the old trace option was none, we need to set the results traces to null so GUI doesn't try to display the traces later |
272 | + if (oldTraceOption == TraceOption.NONE && value != null){ |
273 | + value.setTrace(null); |
274 | + value.setSecondaryTrace(null); |
275 | + } |
276 | + return new VerificationResult<TAPNNetworkTrace>(result.errorMessage(), result.verificationTime()); |
277 | + } |
278 | + //Create the result from trace TAPN |
279 | + renameTraceTransitions(result.getTrace()); |
280 | + renameTraceTransitions(result.getSecondaryTrace()); |
281 | + QueryResult queryResult = result.getQueryResult(); |
282 | + |
283 | + |
284 | + // If (EF or EG AND not satisfied trace) OR (AG or AF AND satisfied trace) -> inconclusive |
285 | + if ((result.getQueryResult().queryType() == QueryType.EF && !queryResult.isQuerySatisfied()) |
286 | + || (result.getQueryResult().queryType() == QueryType.AG && queryResult.isQuerySatisfied()) |
287 | + || (result.getQueryResult().queryType() == QueryType.EG && !queryResult.isQuerySatisfied()) |
288 | + || (result.getQueryResult().queryType() == QueryType.AF && queryResult.isQuerySatisfied())) { |
289 | + queryResult.setApproximationInconclusive(true); |
290 | + } |
291 | + |
292 | + // If satisfied trace) -> Return result |
293 | + // This is satisfied for EF and EG and not satisfied for AG and AF |
294 | + value = new VerificationResult<TAPNNetworkTrace>( |
295 | + queryResult, |
296 | + decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
297 | + decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
298 | + approxResult.verificationTime() + result.verificationTime(), |
299 | + approxResult.stats(), |
300 | + approxResult.isOverApproximationResult()); |
301 | + value.setNameMapping(transformedModel.value2()); |
302 | + } |
303 | + else { |
304 | + // the query contains deadlock, but we do not have a trace. |
305 | + QueryResult queryResult = result.getQueryResult(); |
306 | + queryResult.setApproximationInconclusive(true); |
307 | + |
308 | + VerificationResult<TimedArcPetriNetTrace> approxResult = result; |
309 | + value = new VerificationResult<TAPNNetworkTrace>( |
310 | + approxResult.getQueryResult(), |
311 | + decomposeTrace(approxResult.getTrace(), transformedModel.value2(), model), |
312 | + decomposeTrace(approxResult.getSecondaryTrace(), transformedModel.value2(), model), |
313 | + approxResult.verificationTime(), |
314 | + approxResult.stats(), |
315 | + approxResult.isOverApproximationResult()); |
316 | + value.setNameMapping(transformedModel.value2()); |
317 | + } |
318 | + } |
319 | + } |
320 | + } |
321 | + else { |
322 | + value = new VerificationResult<TAPNNetworkTrace>( |
323 | + result.getQueryResult(), |
324 | + decomposeTrace(result.getTrace(), transformedModel.value2(), model), |
325 | + decomposeTrace(result.getSecondaryTrace(), transformedModel.value2(), model), |
326 | + result.verificationTime(), |
327 | + result.stats(), |
328 | + result.isOverApproximationResult()); |
329 | + value.setNameMapping(transformedModel.value2()); |
330 | + } |
331 | + |
332 | + options.setTraceOption(oldTraceOption); |
333 | + // if the old traceoption was none, we need to set the results traces to null so GUI doesn't try to display the traces later |
334 | + if (oldTraceOption == TraceOption.NONE){ |
335 | + value.setTrace(null); |
336 | + value.setSecondaryTrace(null); |
337 | + } |
338 | + |
339 | + return value; |
340 | + } |
341 | + |
342 | + public VerificationResult<TimedArcPetriNetTrace> batchWorker(Tuple<TimedArcPetriNet, NameMapping> composedModel, |
343 | + VerificationOptions options, pipe.dataLayer.TAPNQuery query, LoadedBatchProcessingModel model, |
344 | + ModelChecker modelChecker, TAPNQuery queryToVerify, TAPNQuery clonedQuery, BatchProcessingWorker verificationBase) throws Exception { |
345 | + InclusionPlaces oldInclusionPlaces = null; |
346 | + if (options instanceof VerifyTAPNOptions) |
347 | + oldInclusionPlaces = ((VerifyTAPNOptions) options).inclusionPlaces(); |
348 | + |
349 | + Tuple<TimedArcPetriNet, NameMapping> transformedOriginalModel = new Tuple<TimedArcPetriNet, NameMapping>(composedModel.value1().copy(), composedModel.value2()); |
350 | + |
351 | + TraceOption oldTraceOption = options.traceOption(); |
352 | + if (query != null && query.isOverApproximationEnabled()) { |
353 | + // Create a fresh model |
354 | + composedModel = composeModel(model); |
355 | + OverApproximation overaprx = new OverApproximation(); |
356 | + overaprx.modifyTAPN(composedModel.value1(), query.approximationDenominator()); |
357 | + options.setTraceOption(TraceOption.SOME); |
358 | + } else if (query != null && query.isUnderApproximationEnabled()) { |
359 | + // Create a fresh model |
360 | + composedModel = composeModel(model); |
361 | + UnderApproximation underaprx = new UnderApproximation(); |
362 | + underaprx.modifyTAPN(composedModel.value1(), query.approximationDenominator()); |
363 | + options.setTraceOption(TraceOption.SOME); |
364 | + } |
365 | + |
366 | + VerificationResult<TimedArcPetriNetTrace> verificationResult = modelChecker.verify(options, composedModel, queryToVerify); |
367 | + |
368 | + VerificationResult<TAPNNetworkTrace> valueNetwork = null; //The final result is meant to be a PetriNetTrace but to make traceTAPN we make a networktrace |
369 | + VerificationResult<TimedArcPetriNetTrace> value = null; |
370 | + if (verificationResult.error()) { |
371 | + options.setTraceOption(oldTraceOption); |
372 | + return new VerificationResult<TimedArcPetriNetTrace>(verificationResult.errorMessage(), verificationResult.verificationTime()); |
373 | + } |
374 | + else if (query != null && query.isOverApproximationEnabled()) { |
375 | + //Create the verification satisfied result for the approximation |
376 | + |
377 | + // Over-approximation |
378 | + if (query.approximationDenominator() == 1) { |
379 | + // If r = 1 |
380 | + // No matter what EF and AG answered -> return that answer |
381 | + QueryResult queryResult = verificationResult.getQueryResult(); |
382 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
383 | + queryResult, |
384 | + verificationResult.getTrace(), |
385 | + verificationResult.getSecondaryTrace(), |
386 | + verificationResult.verificationTime(), |
387 | + verificationResult.stats(), |
388 | + verificationResult.isOverApproximationResult()); |
389 | + value.setNameMapping(composedModel.value2()); |
390 | + } else { |
391 | + // If r > 1 |
392 | + if (verificationResult.getTrace() != null && (((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG ) && verificationResult.getQueryResult().isQuerySatisfied()) |
393 | + || ((verificationResult.getQueryResult().queryType() == QueryType.AG || verificationResult.getQueryResult().queryType() == QueryType.AF) && !verificationResult.getQueryResult().isQuerySatisfied()))) { |
394 | + // If ((EF OR EG) AND satisfied) OR ((AG OR AF) AND not satisfied) |
395 | + //Create the verification satisfied result for the approximation |
396 | + VerificationResult<TimedArcPetriNetTrace> approxResult = verificationResult; |
397 | + valueNetwork = new VerificationResult<TAPNNetworkTrace>( |
398 | + approxResult.getQueryResult(), |
399 | + decomposeTrace(approxResult.getTrace(), composedModel.value2(), model.network()), |
400 | + decomposeTrace(approxResult.getSecondaryTrace(), composedModel.value2(), model.network()), |
401 | + approxResult.verificationTime(), |
402 | + approxResult.stats(), |
403 | + verificationResult.isOverApproximationResult()); |
404 | + valueNetwork.setNameMapping(composedModel.value2()); |
405 | + |
406 | + OverApproximation overaprx = new OverApproximation(); |
407 | + |
408 | + //Create trace TAPN from the network trace |
409 | + overaprx.makeTraceTAPN(transformedOriginalModel, valueNetwork, clonedQuery); |
410 | + |
411 | + // Reset the inclusion places in order to avoid NullPointerExceptions |
412 | + if (options instanceof VerifyTAPNOptions && oldInclusionPlaces != null){ |
413 | + ((VerifyTAPNOptions) options).setInclusionPlaces(oldInclusionPlaces); |
414 | + } |
415 | + |
416 | + //run model checker again for trace TAPN |
417 | + MemoryMonitor.cumulateMemory(); |
418 | + verificationResult = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
419 | + if (verificationBase.isCancelled()) { |
420 | + verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
421 | + } |
422 | + if (verificationResult.error()) { |
423 | + options.setTraceOption(oldTraceOption); |
424 | + return new VerificationResult<TimedArcPetriNetTrace>( |
425 | + verificationResult.errorMessage(), |
426 | + verificationResult.verificationTime() + approxResult.verificationTime()); |
427 | + } |
428 | + //Create the result from trace TAPN |
429 | + renameTraceTransitions(verificationResult.getTrace()); |
430 | + renameTraceTransitions(verificationResult.getSecondaryTrace()); |
431 | + QueryResult queryResult = verificationResult.getQueryResult(); |
432 | + |
433 | + // If ((EF OR EG) AND not satisfied trace) OR ((AG OR AF) AND satisfied trace) -> inconclusive |
434 | + if (((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG) && !queryResult.isQuerySatisfied()) |
435 | + || ((verificationResult.getQueryResult().queryType() == QueryType.AG || verificationResult.getQueryResult().queryType() == QueryType.AF) && queryResult.isQuerySatisfied())){ |
436 | + queryResult.setApproximationInconclusive(true); |
437 | + } |
438 | + // If satisfied trace -> Return result |
439 | + // This is satisfied for EF and EG and not satisfied for AG and AF |
440 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
441 | + queryResult, |
442 | + approxResult.getTrace(), |
443 | + approxResult.getSecondaryTrace(), |
444 | + approxResult.verificationTime() + verificationResult.verificationTime(), |
445 | + approxResult.stats(), |
446 | + verificationResult.isOverApproximationResult()); |
447 | + value.setNameMapping(composedModel.value2()); |
448 | + } |
449 | + else if (((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG) && !verificationResult.getQueryResult().isQuerySatisfied()) |
450 | + || ((verificationResult.getQueryResult().queryType() == QueryType.AG || verificationResult.getQueryResult().queryType() == QueryType.AF) && verificationResult.getQueryResult().isQuerySatisfied())) { |
451 | + // If (EF AND EG not satisfied) OR (AG AND AF satisfied) |
452 | + |
453 | + QueryResult queryResult = verificationResult.getQueryResult(); |
454 | + |
455 | + if(queryResult.hasDeadlock() || queryResult.queryType() == QueryType.EG || queryResult.queryType() == QueryType.AF){ |
456 | + queryResult.setApproximationInconclusive(true); |
457 | + } |
458 | + |
459 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
460 | + queryResult, |
461 | + verificationResult.getTrace(), |
462 | + verificationResult.getSecondaryTrace(), |
463 | + verificationResult.verificationTime(), |
464 | + verificationResult.stats(), |
465 | + verificationResult.isOverApproximationResult()); |
466 | + value.setNameMapping(composedModel.value2()); |
467 | + } |
468 | + else { |
469 | + // We cannot use the result directly, and did not get a trace. |
470 | + |
471 | + QueryResult queryResult = verificationResult.getQueryResult(); |
472 | + |
473 | + queryResult.setApproximationInconclusive(true); |
474 | + |
475 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
476 | + queryResult, |
477 | + verificationResult.getTrace(), |
478 | + verificationResult.getSecondaryTrace(), |
479 | + verificationResult.verificationTime(), |
480 | + verificationResult.stats(), |
481 | + verificationResult.isOverApproximationResult()); |
482 | + value.setNameMapping(composedModel.value2()); |
483 | + |
484 | + } |
485 | + } |
486 | + } |
487 | + else if (query != null && query.isUnderApproximationEnabled()) { |
488 | + // Under-approximation |
489 | + |
490 | + if (query.approximationDenominator() == 1) { |
491 | + // If r = 1 |
492 | + // No matter what EF and AG answered -> return that answer |
493 | + QueryResult queryResult= verificationResult.getQueryResult(); |
494 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
495 | + queryResult, |
496 | + verificationResult.getTrace(), |
497 | + verificationResult.getSecondaryTrace(), |
498 | + verificationResult.verificationTime(), |
499 | + verificationResult.stats(), |
500 | + verificationResult.isOverApproximationResult()); |
501 | + value.setNameMapping(composedModel.value2()); |
502 | + } |
503 | + else { |
504 | + // If r > 1 |
505 | + if ((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG) && ! verificationResult.getQueryResult().isQuerySatisfied() |
506 | + || ((verificationResult.getQueryResult().queryType() == QueryType.AG || verificationResult.getQueryResult().queryType() == QueryType.AF) && verificationResult.getQueryResult().isQuerySatisfied())) { |
507 | + // If ((EF OR EG) AND not satisfied) OR ((AG OR AF) and satisfied) -> Inconclusive |
508 | + |
509 | + QueryResult queryResult = verificationResult.getQueryResult(); |
510 | + queryResult.setApproximationInconclusive(true); |
511 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
512 | + queryResult, |
513 | + verificationResult.getTrace(), |
514 | + verificationResult.getSecondaryTrace(), |
515 | + verificationResult.verificationTime(), |
516 | + verificationResult.stats(), |
517 | + verificationResult.isOverApproximationResult()); |
518 | + value.setNameMapping(composedModel.value2()); |
519 | + |
520 | + } else if ((verificationResult.getQueryResult().queryType() == QueryType.EF || verificationResult.getQueryResult().queryType() == QueryType.EG) && verificationResult.getQueryResult().isQuerySatisfied() |
521 | + || ((verificationResult.getQueryResult().queryType() == QueryType.AG || verificationResult.getQueryResult().queryType() == QueryType.AF) && ! verificationResult.getQueryResult().isQuerySatisfied())) { |
522 | + // ((EF OR EG) AND satisfied) OR ((AG OR AF) and not satisfied) -> Check for deadlock |
523 | + |
524 | + if(verificationResult.getTrace() != null) { |
525 | + // If query does have deadlock -> create trace TAPN |
526 | + //Create the verification satisfied result for the approximation |
527 | + VerificationResult<TimedArcPetriNetTrace> approxResult = verificationResult; |
528 | + valueNetwork = new VerificationResult<TAPNNetworkTrace>( |
529 | + approxResult.getQueryResult(), |
530 | + decomposeTrace(approxResult.getTrace(), composedModel.value2(), model.network()), |
531 | + decomposeTrace(approxResult.getSecondaryTrace(), composedModel.value2(), model.network()), |
532 | + approxResult.verificationTime(), |
533 | + approxResult.stats(), |
534 | + approxResult.isOverApproximationResult()); |
535 | + valueNetwork.setNameMapping(composedModel.value2()); |
536 | + |
537 | + OverApproximation overaprx = new OverApproximation(); |
538 | + |
539 | + //Create trace TAPN from the trace |
540 | + overaprx.makeTraceTAPN(transformedOriginalModel, valueNetwork, clonedQuery); |
541 | + |
542 | + // Reset the inclusion places in order to avoid NullPointerExceptions |
543 | + if (options instanceof VerifyTAPNOptions && oldInclusionPlaces != null) |
544 | + ((VerifyTAPNOptions) options).setInclusionPlaces(oldInclusionPlaces); |
545 | + |
546 | + //run model checker again for trace TAPN |
547 | + MemoryMonitor.cumulateMemory(); |
548 | + verificationResult = modelChecker.verify(options, transformedOriginalModel, clonedQuery); |
549 | + if (verificationBase.isCancelled()) { |
550 | + verificationBase.firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
551 | + } |
552 | + if (verificationResult.error()) { |
553 | + options.setTraceOption(oldTraceOption); |
554 | + return new VerificationResult<TimedArcPetriNetTrace>( |
555 | + verificationResult.errorMessage(), |
556 | + verificationResult.verificationTime() + approxResult.verificationTime()); |
557 | + } |
558 | + |
559 | + //Create the result from trace TAPN |
560 | + renameTraceTransitions(verificationResult.getTrace()); |
561 | + renameTraceTransitions(verificationResult.getSecondaryTrace()); |
562 | + QueryResult queryResult = verificationResult.getQueryResult(); |
563 | + |
564 | + // If (EF or EG AND not satisfied trace) OR (AG or AF AND satisfied trace) -> inconclusive |
565 | + if ((verificationResult.getQueryResult().queryType() == QueryType.EF && !queryResult.isQuerySatisfied()) |
566 | + || (verificationResult.getQueryResult().queryType() == QueryType.AG && queryResult.isQuerySatisfied()) |
567 | + || (verificationResult.getQueryResult().queryType() == QueryType.EG && !queryResult.isQuerySatisfied()) |
568 | + || (verificationResult.getQueryResult().queryType() == QueryType.AF && queryResult.isQuerySatisfied())) { |
569 | + queryResult.setApproximationInconclusive(true); |
570 | + } |
571 | + |
572 | + // If satisfied trace -> Return result |
573 | + // This is satisfied for EF and EG and not satisfied for AG and AF |
574 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
575 | + queryResult, |
576 | + verificationResult.getTrace(), |
577 | + verificationResult.getSecondaryTrace(), |
578 | + verificationResult.verificationTime() + approxResult.verificationTime(), |
579 | + verificationResult.stats(), |
580 | + verificationResult.isOverApproximationResult()); |
581 | + value.setNameMapping(composedModel.value2()); |
582 | + } |
583 | + else { |
584 | + QueryResult queryResult = verificationResult.getQueryResult(); |
585 | + |
586 | + queryResult.setApproximationInconclusive(true); |
587 | + |
588 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
589 | + queryResult, |
590 | + verificationResult.getTrace(), |
591 | + verificationResult.getSecondaryTrace(), |
592 | + verificationResult.verificationTime(), |
593 | + verificationResult.stats(), |
594 | + verificationResult.isOverApproximationResult()); |
595 | + value.setNameMapping(composedModel.value2()); |
596 | + } |
597 | + } |
598 | + } |
599 | + } else { |
600 | + value = new VerificationResult<TimedArcPetriNetTrace>( |
601 | + verificationResult.getQueryResult(), |
602 | + verificationResult.getTrace(), |
603 | + verificationResult.getSecondaryTrace(), |
604 | + verificationResult.verificationTime(), |
605 | + verificationResult.stats(), |
606 | + verificationResult.isOverApproximationResult()); |
607 | + value.setNameMapping(composedModel.value2()); |
608 | + } |
609 | + |
610 | + options.setTraceOption(oldTraceOption); |
611 | + return value; |
612 | + } |
613 | + |
614 | + private TAPNNetworkTrace decomposeTrace(TimedArcPetriNetTrace trace, NameMapping mapping, TimedArcPetriNetNetwork model) { |
615 | + if (trace == null) |
616 | + return null; |
617 | + |
618 | + TAPNTraceDecomposer decomposer = new TAPNTraceDecomposer(trace, model, mapping); |
619 | + return decomposer.decompose(); |
620 | + } |
621 | + |
622 | + private void renameTraceTransitions(TimedArcPetriNetTrace trace) { |
623 | + if (trace != null){ |
624 | + trace.reduceTraceForOriginalNet("_traceNet_", "PTRACE"); |
625 | + trace.removeTokens("PBLOCK"); |
626 | + } |
627 | + } |
628 | + |
629 | + private Tuple<TimedArcPetriNet, NameMapping> composeModel(LoadedBatchProcessingModel model) { |
630 | + ITAPNComposer composer = new TAPNComposer(new Messenger(){ |
631 | + public void displayInfoMessage(String message) { } |
632 | + public void displayInfoMessage(String message, String title) {} |
633 | + public void displayErrorMessage(String message) {} |
634 | + public void displayErrorMessage(String message, String title) {} |
635 | + public void displayWrappedErrorMessage(String message, String title) {} |
636 | + |
637 | + }); |
638 | + Tuple<TimedArcPetriNet, NameMapping> composedModel = composer.transformModel(model.network()); |
639 | + return composedModel; |
640 | + } |
641 | + |
642 | + private ModelChecker getModelChecker(pipe.dataLayer.TAPNQuery query) { |
643 | + if(query.getReductionOption() == ReductionOption.VerifyTAPN) |
644 | + return getVerifyTAPN(); |
645 | + else if(query.getReductionOption() == ReductionOption.VerifyTAPNdiscreteVerification) |
646 | + return getVerifyTAPNDiscreteVerification(); |
647 | + else if(query.getReductionOption() == ReductionOption.VerifyPN || query.getReductionOption() == ReductionOption.VerifyPNApprox || query.getReductionOption() == ReductionOption.VerifyPNReduce) |
648 | + return getVerifyPN(); |
649 | + else |
650 | + return getVerifyta(); |
651 | + } |
652 | + |
653 | + private Verifyta getVerifyta() { |
654 | + Verifyta verifyta = new Verifyta(new FileFinderImpl(), new MessengerImpl()); |
655 | + verifyta.setup(); |
656 | + return verifyta; |
657 | + } |
658 | + |
659 | + private static VerifyTAPN getVerifyTAPN() { |
660 | + VerifyTAPN verifytapn = new VerifyTAPN(new FileFinderImpl(), new MessengerImpl()); |
661 | + verifytapn.setup(); |
662 | + return verifytapn; |
663 | + } |
664 | + |
665 | + private static VerifyPN getVerifyPN() { |
666 | + VerifyPN verifypn = new VerifyPN(new FileFinderImpl(), new MessengerImpl()); |
667 | + verifypn.setup(); |
668 | + return verifypn; |
669 | + } |
670 | + |
671 | + private static VerifyTAPNDiscreteVerification getVerifyTAPNDiscreteVerification() { |
672 | + VerifyTAPNDiscreteVerification verifytapnDiscreteVerification = new VerifyTAPNDiscreteVerification(new FileFinderImpl(), new MessengerImpl()); |
673 | + verifytapnDiscreteVerification.setup(); |
674 | + return verifytapnDiscreteVerification; |
675 | + } |
676 | +} |
677 | |
678 | === added file 'src/dk/aau/cs/approximation/ITAPNApproximation.java' |
679 | --- src/dk/aau/cs/approximation/ITAPNApproximation.java 1970-01-01 00:00:00 +0000 |
680 | +++ src/dk/aau/cs/approximation/ITAPNApproximation.java 2014-05-28 18:52:41 +0000 |
681 | @@ -0,0 +1,9 @@ |
682 | +package dk.aau.cs.approximation; |
683 | + |
684 | +import dk.aau.cs.model.tapn.TimedArcPetriNet; |
685 | +import dk.aau.cs.verification.VerificationOptions; |
686 | + |
687 | +public interface ITAPNApproximation { |
688 | + //Returns a copy of a network which is the approximated network |
689 | + public void modifyTAPN(TimedArcPetriNet net, int approximationDenominator); |
690 | +} |
691 | |
692 | === added file 'src/dk/aau/cs/approximation/OverApproximation.java' |
693 | --- src/dk/aau/cs/approximation/OverApproximation.java 1970-01-01 00:00:00 +0000 |
694 | +++ src/dk/aau/cs/approximation/OverApproximation.java 2014-05-28 18:52:41 +0000 |
695 | @@ -0,0 +1,264 @@ |
696 | +package dk.aau.cs.approximation; |
697 | + |
698 | +import java.util.ArrayList; |
699 | +import java.util.HashMap; |
700 | +import java.util.Map.Entry; |
701 | + |
702 | +import dk.aau.cs.TCTL.TCTLAFNode; |
703 | +import dk.aau.cs.TCTL.TCTLAGNode; |
704 | +import dk.aau.cs.TCTL.TCTLAbstractProperty; |
705 | +import dk.aau.cs.TCTL.TCTLAndListNode; |
706 | +import dk.aau.cs.TCTL.TCTLAtomicPropositionNode; |
707 | +import dk.aau.cs.TCTL.TCTLConstNode; |
708 | +import dk.aau.cs.TCTL.TCTLEFNode; |
709 | +import dk.aau.cs.TCTL.TCTLEGNode; |
710 | +import dk.aau.cs.TCTL.TCTLNotNode; |
711 | +import dk.aau.cs.TCTL.TCTLOrListNode; |
712 | +import dk.aau.cs.TCTL.TCTLPlaceNode; |
713 | +import dk.aau.cs.model.tapn.*; |
714 | +import dk.aau.cs.model.tapn.simulation.*; |
715 | +import dk.aau.cs.util.Tuple; |
716 | +import dk.aau.cs.verification.NameMapping; |
717 | +import dk.aau.cs.verification.VerificationOptions; |
718 | +import dk.aau.cs.verification.VerificationResult; |
719 | +import pipe.dataLayer.TAPNQuery; |
720 | + |
721 | +public class OverApproximation implements ITAPNApproximation { |
722 | + @Override |
723 | + public void modifyTAPN(TimedArcPetriNet net, int approximationDenominator) { |
724 | + // Fix input arcs |
725 | + for (TimedInputArc arc : net.inputArcs()) { |
726 | + TimeInterval oldInterval = arc.interval(); |
727 | + TimeInterval newInterval = modifyIntervals(oldInterval, approximationDenominator); |
728 | + |
729 | + arc.setTimeInterval(newInterval); |
730 | + } |
731 | + |
732 | + // Fix transport arcs |
733 | + for (TransportArc arc : net.transportArcs()) { |
734 | + TimeInterval oldInterval = arc.interval(); |
735 | + TimeInterval newInterval = modifyIntervals(oldInterval, approximationDenominator); |
736 | + |
737 | + arc.setTimeInterval(newInterval); |
738 | + } |
739 | + |
740 | + // Fix invariants in places |
741 | + for (TimedPlace place : net.places()) { |
742 | + if ( ! (place.invariant().upperBound() instanceof Bound.InfBound) && place.invariant().upperBound().value() > 0) { |
743 | + TimeInvariant oldInvariant = place.invariant(); |
744 | + place.setInvariant(new TimeInvariant(oldInvariant.isUpperNonstrict(), new IntBound((int) Math.ceil(oldInvariant.upperBound().value() / (double)approximationDenominator)))); |
745 | + } |
746 | + } |
747 | + } |
748 | + |
749 | + //Returns a copy of an approximated interval |
750 | + private TimeInterval modifyIntervals(TimeInterval oldInterval, int denominator){ |
751 | + Bound newUpperBound; |
752 | + // Do not calculate upper bound for infinite |
753 | + if ( ! (oldInterval.upperBound() instanceof Bound.InfBound)) { |
754 | + // Calculate the new upper bound value. E.g. if the value is 22, the new value needs to be 3 given that r = 10 |
755 | + int oldUpperBoundValue = oldInterval.upperBound().value(); |
756 | + newUpperBound = new IntBound((int) Math.ceil((double)oldUpperBoundValue / denominator)); |
757 | + } else { |
758 | + newUpperBound = Bound.Infinity; |
759 | + } |
760 | + |
761 | + // Calculate the new lower bound |
762 | + IntBound newLowerBound = new IntBound((int) Math.floor(oldInterval.lowerBound().value() / denominator)); |
763 | + |
764 | + return new TimeInterval( |
765 | + oldInterval.IsLowerBoundNonStrict(), |
766 | + newLowerBound, |
767 | + newUpperBound, |
768 | + oldInterval.IsUpperBoundNonStrict() |
769 | + ); |
770 | + } |
771 | + |
772 | + public void makeTraceTAPN(Tuple<TimedArcPetriNet, NameMapping> transformedModel, VerificationResult<TAPNNetworkTrace> result, dk.aau.cs.model.tapn.TAPNQuery query) { |
773 | + TimedArcPetriNet net = transformedModel.value1(); |
774 | + |
775 | + LocalTimedPlace currentPlace = new LocalTimedPlace("PTRACE0"); |
776 | + TimedToken currentToken = new TimedToken(currentPlace); |
777 | + net.add(currentPlace); |
778 | + currentPlace.addToken(currentToken); |
779 | + |
780 | + // Block place, which secures the net makes at most one transition not in the trace. |
781 | + LocalTimedPlace blockPlace = new LocalTimedPlace("PBLOCK", TimeInvariant.LESS_THAN_INFINITY); |
782 | + TimedToken blockToken = new TimedToken(blockPlace); |
783 | + net.add(blockPlace); |
784 | + blockPlace.addToken(blockToken); |
785 | + |
786 | + // Copy the original transitions |
787 | + ArrayList<TimedTransition> originalTransitions = new ArrayList<TimedTransition>(); |
788 | + for (TimedTransition transition : net.transitions()) { |
789 | + originalTransitions.add(transition); |
790 | + } |
791 | + |
792 | + // Copy the original input arcs |
793 | + ArrayList<TimedInputArc> originalInput = new ArrayList<TimedInputArc>(); |
794 | + for (TimedInputArc inputarc : net.inputArcs()) { |
795 | + originalInput.add(inputarc); |
796 | + } |
797 | + |
798 | + // Copy the original output arcs |
799 | + ArrayList<TimedOutputArc> originalOutput = new ArrayList<TimedOutputArc>(); |
800 | + for (TimedOutputArc outputarc : net.outputArcs()) { |
801 | + originalOutput.add(outputarc); |
802 | + } |
803 | + |
804 | + // Copy the original inhibitor arcs |
805 | + ArrayList<TimedInhibitorArc> originalInhibitor = new ArrayList<TimedInhibitorArc>(); |
806 | + for (TimedInhibitorArc inhibitor : net.inhibitorArcs()) { |
807 | + originalInhibitor.add(inhibitor); |
808 | + } |
809 | + |
810 | + // Copy the original transport arcs |
811 | + ArrayList<TransportArc> originalTransport = new ArrayList<TransportArc>(); |
812 | + for (TransportArc transport : net.transportArcs()) { |
813 | + originalTransport.add(transport); |
814 | + } |
815 | + |
816 | + int placeInteger = 0; |
817 | + int transitionInteger = 0; |
818 | + TimedOutputArc next = null; |
819 | + boolean traceHasTransitionStep = false; |
820 | + |
821 | + TAPNNetworkTrace trace = result.getTrace(); |
822 | + HashMap<Tuple<String, String>, String> nameMap = transformedModel.value2().getOrgToMapped(); |
823 | + LocalTimedPlace loopStep = null; |
824 | + boolean delayIsLoopStep = false; |
825 | + |
826 | + for(TAPNNetworkTraceStep step : trace) { |
827 | + if (step instanceof TAPNNetworkTimeDelayStep){ |
828 | + // Skip if delay step, but check if this step is a delayStep |
829 | + if(step.isLoopStep()) |
830 | + { |
831 | + delayIsLoopStep = true; |
832 | + } |
833 | + } |
834 | + if (step instanceof TAPNNetworkTimedTransitionStep) { |
835 | + //TimedTransition firedTransition = net.getTransitionByName(reversedNameMap.get(((TAPNNetworkTimedTransitionStep) step).getTransition().name())); |
836 | + TAPNNetworkTimedTransitionStep tmpStep = (TAPNNetworkTimedTransitionStep)step; |
837 | + //If the transition in step is shared, use "" as model for lookup in namemap |
838 | + Tuple<String, String> key = new Tuple<String, String>( |
839 | + (((TAPNNetworkTimedTransitionStep) step).getTransition().sharedTransition() == null ? tmpStep.getTransition().model().name() : ""), |
840 | + tmpStep.getTransition().name()); |
841 | + TimedTransition firedTransition = net.getTransitionByName(nameMap.get(key)); |
842 | + TimedTransition copyTransition = new TimedTransition(firedTransition.name() + "_traceNet_" + Integer.toString(++transitionInteger), firedTransition.isUrgent()); |
843 | + |
844 | + net.add(copyTransition); |
845 | + net.add(new TimedInputArc(currentPlace, copyTransition, TimeInterval.ZERO_INF)); |
846 | + |
847 | + net.add(new TimedInputArc(blockPlace, copyTransition, TimeInterval.ZERO_INF)); |
848 | + net.add(new TimedOutputArc(copyTransition, blockPlace)); |
849 | + |
850 | + // EG queries, where there is a loopStep, we need to store it for later use. |
851 | + if(step.isLoopStep() || delayIsLoopStep) |
852 | + { |
853 | + loopStep = currentPlace; |
854 | + delayIsLoopStep = false; |
855 | + } |
856 | + |
857 | + currentPlace = new LocalTimedPlace("PTRACE" + Integer.toString(++placeInteger)); |
858 | + net.add(currentPlace); |
859 | + next = new TimedOutputArc(copyTransition, currentPlace); |
860 | + net.add(next); |
861 | + |
862 | + |
863 | + for (TimedInputArc arc : originalInput) { |
864 | + if (arc.destination() == firedTransition) { |
865 | + net.add(new TimedInputArc(arc.source(), copyTransition, arc.interval(), arc.getWeight())); |
866 | + } |
867 | + } |
868 | + for (TimedOutputArc arc : originalOutput) { |
869 | + if (arc.source() == firedTransition) { |
870 | + net.add(new TimedOutputArc(copyTransition, arc.destination(), arc.getWeight())); |
871 | + } |
872 | + } |
873 | + for (TimedInhibitorArc arc : originalInhibitor) { |
874 | + if (arc.destination() == firedTransition) { |
875 | + net.add(new TimedInhibitorArc(arc.source(), copyTransition, arc.interval(), arc.getWeight())); |
876 | + } |
877 | + } |
878 | + for (TransportArc arc : originalTransport) { |
879 | + if (arc.transition() == firedTransition) { |
880 | + net.add(new TransportArc(arc.source(), copyTransition, arc.destination(), arc.interval(), arc.getWeight())); |
881 | + } |
882 | + } |
883 | + |
884 | + traceHasTransitionStep = true; |
885 | + } |
886 | + } |
887 | + |
888 | + // If the trace is a EG trace with a loop, we need to incorporate the loop in traceTAPN |
889 | + if(loopStep != null){ |
890 | + net.add(new TimedOutputArc(next.source(), loopStep)); |
891 | + } |
892 | + |
893 | + if(traceHasTransitionStep){ |
894 | + net.remove(next); |
895 | + net.remove(currentPlace); |
896 | + } |
897 | + |
898 | + modifyQuery(query, blockPlace); |
899 | + |
900 | + // An input arc from pBlock to all original transitions makes sure, that we can do deadlock checks. |
901 | + for (TimedTransition transition : originalTransitions) { |
902 | + net.add(new TimedInputArc(blockPlace, transition, TimeInterval.ZERO_INF)); |
903 | + } |
904 | + } |
905 | + |
906 | + |
907 | + private void modifyQuery(dk.aau.cs.model.tapn.TAPNQuery query, LocalTimedPlace blockPlace) { |
908 | + TCTLAbstractProperty topNode = query.getProperty(); |
909 | + TCTLAtomicPropositionNode pBlock = new TCTLAtomicPropositionNode(new TCTLPlaceNode(blockPlace.name()), "=", new TCTLConstNode(1)); |
910 | + |
911 | + // We need to modify the query to also have pBlock = 1. |
912 | + if(topNode instanceof TCTLEFNode) |
913 | + { |
914 | + if(((TCTLEFNode) topNode).getProperty() instanceof TCTLAndListNode){ |
915 | + ((TCTLAndListNode) ((TCTLEFNode) topNode).getProperty()).addConjunct(pBlock); |
916 | + } |
917 | + else{ |
918 | + TCTLAndListNode andList = new TCTLAndListNode((((TCTLEFNode) topNode).getProperty()), pBlock); |
919 | + ((TCTLEFNode) topNode).setProperty(andList); |
920 | + } |
921 | + |
922 | + } |
923 | + else if(topNode instanceof TCTLAGNode) |
924 | + { |
925 | + TCTLNotNode notNode = new TCTLNotNode(pBlock); |
926 | + |
927 | + if(((TCTLAGNode) topNode).getProperty() instanceof TCTLOrListNode){ |
928 | + ((TCTLOrListNode) ((TCTLAGNode) topNode).getProperty()).addDisjunct(notNode);; |
929 | + } |
930 | + else{ |
931 | + TCTLOrListNode orList = new TCTLOrListNode((((TCTLAGNode) topNode).getProperty()), notNode); |
932 | + ((TCTLAGNode) topNode).setProperty(orList); |
933 | + } |
934 | + |
935 | + } |
936 | + else if(topNode instanceof TCTLEGNode) |
937 | + { |
938 | + if(((TCTLEGNode) topNode).getProperty() instanceof TCTLAndListNode){ |
939 | + ((TCTLAndListNode) ((TCTLEGNode) topNode).getProperty()).addConjunct(pBlock); |
940 | + } |
941 | + else{ |
942 | + TCTLAndListNode andList = new TCTLAndListNode((((TCTLEGNode) topNode).getProperty()), pBlock); |
943 | + ((TCTLEGNode) topNode).setProperty(andList); |
944 | + } |
945 | + } |
946 | + else if(topNode instanceof TCTLAFNode) |
947 | + { |
948 | + TCTLNotNode notNode = new TCTLNotNode(pBlock); |
949 | + |
950 | + if(((TCTLAFNode) topNode).getProperty() instanceof TCTLOrListNode){ |
951 | + ((TCTLOrListNode) ((TCTLAFNode) topNode).getProperty()).addDisjunct(notNode);; |
952 | + } |
953 | + else{ |
954 | + TCTLOrListNode orList = new TCTLOrListNode((((TCTLAFNode) topNode).getProperty()), notNode); |
955 | + ((TCTLAFNode) topNode).setProperty(orList); |
956 | + } |
957 | + } |
958 | + } |
959 | +} |
960 | |
961 | === added file 'src/dk/aau/cs/approximation/UnderApproximation.java' |
962 | --- src/dk/aau/cs/approximation/UnderApproximation.java 1970-01-01 00:00:00 +0000 |
963 | +++ src/dk/aau/cs/approximation/UnderApproximation.java 2014-05-28 18:52:41 +0000 |
964 | @@ -0,0 +1,191 @@ |
965 | +package dk.aau.cs.approximation; |
966 | + |
967 | +import java.lang.reflect.Array; |
968 | +import java.util.ArrayList; |
969 | + |
970 | +import dk.aau.cs.model.tapn.Bound; |
971 | +import dk.aau.cs.model.tapn.IntBound; |
972 | +import dk.aau.cs.model.tapn.TAPNElement; |
973 | +import dk.aau.cs.model.tapn.TimeInterval; |
974 | +import dk.aau.cs.model.tapn.TimeInvariant; |
975 | +import dk.aau.cs.model.tapn.TimedArcPetriNet; |
976 | +import dk.aau.cs.model.tapn.TimedInhibitorArc; |
977 | +import dk.aau.cs.model.tapn.TimedInputArc; |
978 | +import dk.aau.cs.model.tapn.TimedOutputArc; |
979 | +import dk.aau.cs.model.tapn.TimedPlace; |
980 | +import dk.aau.cs.model.tapn.TimedTransition; |
981 | +import dk.aau.cs.model.tapn.TransportArc; |
982 | +import dk.aau.cs.verification.VerificationOptions; |
983 | +import pipe.dataLayer.DataLayer; |
984 | +import pipe.dataLayer.TAPNQuery; |
985 | +import pipe.gui.graphicElements.Arc; |
986 | +import pipe.gui.graphicElements.Place; |
987 | +import pipe.gui.graphicElements.Transition; |
988 | +import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent; |
989 | +import pipe.gui.graphicElements.tapn.TimedInputArcComponent; |
990 | +import pipe.gui.graphicElements.tapn.TimedTransportArcComponent; |
991 | + |
992 | +public class UnderApproximation implements ITAPNApproximation { |
993 | + @Override |
994 | + public void modifyTAPN(TimedArcPetriNet net, int approximationDenominator) { |
995 | + modifyTAPN(net, approximationDenominator, null); |
996 | + } |
997 | + |
998 | + public void modifyTAPN(TimedArcPetriNet net, int approximationDenominator, DataLayer guiModel) { |
999 | + // Fix input arcs |
1000 | + ArrayList<TimedTransition> transitionsToDelete = new ArrayList<TimedTransition>(); |
1001 | + |
1002 | + for (TimedInputArc arc : net.inputArcs()) { |
1003 | + //Fix input arcs |
1004 | + TimeInterval oldInterval = arc.interval(); |
1005 | + |
1006 | + TimeInterval newInterval = modifyIntervals(oldInterval, approximationDenominator); |
1007 | + |
1008 | + //New interval can be null if lower bound surpassed upper bound in rounding |
1009 | + if (newInterval != null){ |
1010 | + arc.setTimeInterval(newInterval); |
1011 | + } |
1012 | + else{ |
1013 | + //If an arcs interval became invalid we need to delete it, as well as the destination transition and any other arcs that transition has |
1014 | + //otherwise we could enable behavior which is not allowed for under approximation |
1015 | + if(!transitionsToDelete.contains(arc.destination())){ |
1016 | + transitionsToDelete.add(arc.destination()); |
1017 | + } |
1018 | + } |
1019 | + } |
1020 | + |
1021 | + for (TransportArc arc : net.transportArcs()) { |
1022 | + //fix transport arcs |
1023 | + TimeInterval oldInterval = arc.interval(); |
1024 | + |
1025 | + TimeInterval newInterval = modifyIntervals(oldInterval, approximationDenominator); |
1026 | + |
1027 | + //New interval can be null if lower bound surpassed upper bound in rounding |
1028 | + if (newInterval != null) |
1029 | + arc.setTimeInterval(newInterval); |
1030 | + else{ |
1031 | + if(!transitionsToDelete.contains(arc.transition())){ |
1032 | + transitionsToDelete.add(arc.transition()); |
1033 | + } |
1034 | + } |
1035 | + } |
1036 | + |
1037 | + for(TimedTransition transitionToDelete : transitionsToDelete){ |
1038 | + if(guiModel != null){ |
1039 | + deleteTransitionFromGuiModel(transitionToDelete, guiModel); |
1040 | + } |
1041 | + else{ |
1042 | + deleteArcsFromTransition(transitionToDelete); |
1043 | + } |
1044 | + transitionToDelete.delete(); |
1045 | + } |
1046 | + |
1047 | + // Fix invariants in places |
1048 | + for (TimedPlace place1 : net.places()) { |
1049 | + if ( ! (place1.invariant().upperBound() instanceof Bound.InfBound) && place1.invariant().upperBound().value() > 0) { |
1050 | + TimeInvariant oldInvariant = place1.invariant(); |
1051 | + |
1052 | + int newInvariantBound = (int) Math.floor(oldInvariant.upperBound().value() / (double)approximationDenominator); |
1053 | + if(newInvariantBound != 0){ |
1054 | + place1.setInvariant(new TimeInvariant(oldInvariant.isUpperNonstrict(), new IntBound(newInvariantBound))); |
1055 | + } |
1056 | + else{ |
1057 | + place1.setInvariant(new TimeInvariant(true, new IntBound(0))); |
1058 | + } |
1059 | + } |
1060 | + } |
1061 | + } |
1062 | + |
1063 | + private void deleteTransitionFromGuiModel(TimedTransition transitionToDelete, DataLayer guiModel) { |
1064 | + // We assert here that deletions in the guimodel will also delete underlying model elements |
1065 | + Transition guiTransition = guiModel.getTransitionByName(transitionToDelete.name()); |
1066 | + |
1067 | + for (Arc arc1 : guiModel.getArcs()){ |
1068 | + if (arc1.getTarget() instanceof Place && arc1.getSource() == guiTransition) //If arc1 is an output arc |
1069 | + { |
1070 | + arc1.delete(); |
1071 | + } |
1072 | + else if (arc1.getTarget() instanceof Transition && arc1.getTarget() == guiTransition){ //Else if arc1 is an input arc |
1073 | + arc1.delete(); |
1074 | + } |
1075 | + } |
1076 | + guiTransition.delete(); |
1077 | + } |
1078 | + |
1079 | + private void deleteArcsFromTransition(TimedTransition transitionToDelete) { |
1080 | + ArrayList<TimedInputArc> inputArcs = new ArrayList<TimedInputArc>(); |
1081 | + //Add all did not work properly, so we do it manually. |
1082 | + for(TimedInputArc arc : transitionToDelete.getInputArcs()){ |
1083 | + inputArcs.add(arc); |
1084 | + } |
1085 | + for(TimedInputArc arc : inputArcs){ |
1086 | + arc.delete(); |
1087 | + } |
1088 | + |
1089 | + ArrayList<TimedOutputArc> outputArcs = new ArrayList<TimedOutputArc>(); |
1090 | + for(TimedOutputArc arc : transitionToDelete.getOutputArcs()){ |
1091 | + outputArcs.add(arc); |
1092 | + } |
1093 | + for(TimedOutputArc arc : outputArcs){ |
1094 | + arc.delete(); |
1095 | + } |
1096 | + |
1097 | + ArrayList<TransportArc> transportArcs = new ArrayList<TransportArc>(); |
1098 | + for(TransportArc arc : transitionToDelete.getTransportArcsGoingThrough()){ |
1099 | + transportArcs.add(arc); |
1100 | + } |
1101 | + for(TransportArc arc : transportArcs){ |
1102 | + arc.delete(); |
1103 | + } |
1104 | + |
1105 | + ArrayList<TimedInhibitorArc> inhibitorArcs = new ArrayList<TimedInhibitorArc>(); |
1106 | + for(TimedInhibitorArc arc : transitionToDelete.getInhibitorArcs()){ |
1107 | + inhibitorArcs.add(arc); |
1108 | + } |
1109 | + for(TimedInhibitorArc arc : inhibitorArcs){ |
1110 | + arc.delete(); |
1111 | + } |
1112 | + } |
1113 | + |
1114 | + //Returns a copy of an approximated interval |
1115 | + private TimeInterval modifyIntervals(TimeInterval oldInterval, int denominator){ |
1116 | + Bound newUpperBound; |
1117 | + // Do not calculate upper bound for infinite |
1118 | + if ( ! (oldInterval.upperBound() instanceof Bound.InfBound)) { |
1119 | + |
1120 | + // Calculate the new upper bound value. |
1121 | + int oldUpperBoundValue = oldInterval.upperBound().value(); |
1122 | + newUpperBound = new IntBound((int) Math.floor((double)oldUpperBoundValue / denominator)); |
1123 | + } |
1124 | + else |
1125 | + newUpperBound = Bound.Infinity; |
1126 | + |
1127 | + // Calculate the new lower bound |
1128 | + IntBound newLowerBound = new IntBound((int) Math.ceil((double)oldInterval.lowerBound().value() / denominator)); |
1129 | + |
1130 | + // if the lower bound has become greater than the upper bound by rounding |
1131 | + if ( ! (oldInterval.upperBound() instanceof Bound.InfBound) && newLowerBound.value() > newUpperBound.value()) |
1132 | + { |
1133 | + newLowerBound = new IntBound((int) Math.floor((double)oldInterval.lowerBound().value() / denominator)); |
1134 | + newUpperBound = new IntBound((int) Math.floor((double)oldInterval.upperBound().value() / denominator)); |
1135 | + } |
1136 | + |
1137 | + boolean isLowerBoundNonStrict = oldInterval.IsLowerBoundNonStrict(); |
1138 | + boolean isUpperBoundNonStrict = oldInterval.IsUpperBoundNonStrict(); |
1139 | + |
1140 | + // if the interval becomes too small we make it a bit bigger to secure, that we do not have to delete the arc |
1141 | + if ( (newUpperBound.value() == newLowerBound.value()) && !(oldInterval.IsLowerBoundNonStrict() && oldInterval.IsUpperBoundNonStrict())) |
1142 | + { |
1143 | + isUpperBoundNonStrict = true; |
1144 | + isLowerBoundNonStrict = true; |
1145 | + } |
1146 | + |
1147 | + return new TimeInterval( |
1148 | + isLowerBoundNonStrict, |
1149 | + newLowerBound, |
1150 | + newUpperBound, |
1151 | + isUpperBoundNonStrict |
1152 | + ); |
1153 | + } |
1154 | + |
1155 | +} |
1156 | |
1157 | === modified file 'src/dk/aau/cs/gui/BatchProcessingDialog.java' |
1158 | --- src/dk/aau/cs/gui/BatchProcessingDialog.java 2014-02-26 20:07:09 +0000 |
1159 | +++ src/dk/aau/cs/gui/BatchProcessingDialog.java 2014-05-28 18:52:41 +0000 |
1160 | @@ -76,6 +76,7 @@ |
1161 | import dk.aau.cs.util.StringComparator; |
1162 | import dk.aau.cs.verification.batchProcessing.BatchProcessingListener; |
1163 | import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationOptions; |
1164 | +import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationOptions.ApproximationMethodOption; |
1165 | import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationOptions.QueryPropertyOption; |
1166 | import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationOptions.SymmetryOption; |
1167 | import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationResult; |
1168 | @@ -99,7 +100,7 @@ |
1169 | private static final String name_BROADCAST = "UPPAAL: Broadcast Reduction"; |
1170 | private static final String name_BROADCASTDEG2 = "UPPAAL: Broadcast Degree 2 Reduction"; |
1171 | private static final String name_UNTIMED = "TAPAAL Untimed Engine (verifypn)"; |
1172 | - private static final String name_UNTIMED_APPROX = "TAPAAL Untimed Engine Over-Approximation Only"; |
1173 | + private static final String name_UNTIMED_APPROX = "TAPAAL Untimed Engine w. State-Equations Check Only"; |
1174 | private static final String name_UNTIMED_REDUCE = "TAPAAL Untimed Engine w. Net Reductions"; |
1175 | private static final String name_verifyTAPNWithLegend = "A: " |
1176 | + name_verifyTAPN; |
1177 | @@ -137,6 +138,9 @@ |
1178 | private static final String name_SEARCHWHOLESTATESPACE = "Search whole state space"; |
1179 | private static final String name_SYMMETRY = "Yes"; |
1180 | private static final String name_NOSYMMETRY = "No"; |
1181 | + private static final String name_NONE_APPROXIMATION = "None"; |
1182 | + private static final String name_OVER_APPROXIMATION = "Over-approximation"; |
1183 | + private static final String name_UNDER_APPROXIMATION = "Under-approximation"; |
1184 | |
1185 | //Tool tip strings |
1186 | //Tool tips for model panel |
1187 | @@ -162,6 +166,14 @@ |
1188 | private final static String TOOL_TIP_OOMLabel = null; |
1189 | private final static String TOOL_TIP_OOMValue = "<html>Enter the maximum amount of available memory to the verification.<br>Verification is skipped as soon as it is detected that this amount of memory is exceeded.</html>"; |
1190 | private final static String TOOL_TIP_NoOOMCheckBox = "Choose whether to use memory restrictions"; |
1191 | + private final static String TOOL_TIP_Approximation_method = null; |
1192 | + private final static String TOOL_TIP_Approximation_Method_Option_Keep = "Do not override the default approximation method."; |
1193 | + private final static String TOOL_TIP_Approximation_Method_Option_None = "No approximation method is used."; |
1194 | + private final static String TOOL_TIP_Approximation_Method_Option_Over = "Approximate by dividing all intervals with the approximation constant and enlarging the intervals."; |
1195 | + private final static String TOOL_TIP_Approximation_Method_Option_Under = "Approximate by dividing all intervals with the approximation constant and shrinking the intervals."; |
1196 | + private final static String TOOL_TIP_ApproximationDenominatorLabel = null; |
1197 | + private final static String TOOL_TIP_ApproximationDenominator = "Choose the approximation constant."; |
1198 | + private final static String TOOL_TIP_ApproximationDenominatorCheckbox = "Check to override the default approximation constant."; |
1199 | |
1200 | //Tool tips for monitor panel |
1201 | private final static String TOOL_TIP_FileLabel = "Currently verified net"; |
1202 | @@ -214,6 +226,10 @@ |
1203 | private JCheckBox noOOMCheckbox; |
1204 | private CustomJSpinner timeoutValue; |
1205 | private CustomJSpinner oomValue; |
1206 | + private JComboBox approximationMethodOption; |
1207 | + private CustomJSpinner approximationDenominator; |
1208 | + private JCheckBox approximationDenominatorCheckbox; |
1209 | + |
1210 | private Timer timeoutTimer = new Timer(30000, new ActionListener() { |
1211 | public void actionPerformed(ActionEvent e) { |
1212 | timeoutCurrentVerificationTask(); |
1213 | @@ -384,7 +400,6 @@ |
1214 | addFilesButton = new JButton("Add models"); |
1215 | addFilesButton.setToolTipText(TOOL_TIP_AddFilesButton); |
1216 | addFilesButton.addActionListener(new ActionListener() { |
1217 | - |
1218 | public void actionPerformed(ActionEvent arg0) { |
1219 | addFiles(); |
1220 | } |
1221 | @@ -489,6 +504,7 @@ |
1222 | initCapacityComponents(); |
1223 | initTimeoutComponents(); |
1224 | initOOMComponents(); |
1225 | + initApproximationMethodOptionsComponents(); |
1226 | |
1227 | GridBagConstraints gbc = new GridBagConstraints(); |
1228 | gbc.gridx = 1; |
1229 | @@ -526,6 +542,92 @@ |
1230 | gbc.insets = new Insets(0, 0, 5, 0); |
1231 | verificationOptionsPanel.add(queryPropertyOption, gbc); |
1232 | } |
1233 | + |
1234 | + private void initApproximationMethodOptionsComponents() { |
1235 | + JLabel approximationLabel = new JLabel("Approximation method:"); |
1236 | + approximationLabel.setToolTipText(TOOL_TIP_Approximation_method); |
1237 | + GridBagConstraints gbc = new GridBagConstraints(); |
1238 | + gbc.fill = GridBagConstraints.VERTICAL; |
1239 | + gbc.gridx = 0; |
1240 | + gbc.gridy = 8; |
1241 | + gbc.insets = new Insets(0, 0, 5, 0); |
1242 | + gbc.anchor = GridBagConstraints.WEST; |
1243 | + verificationOptionsPanel.add(approximationLabel, gbc); |
1244 | + |
1245 | + String[] options = new String[] { |
1246 | + name_KeepQueryOption, |
1247 | + name_NONE_APPROXIMATION, |
1248 | + name_OVER_APPROXIMATION, |
1249 | + name_UNDER_APPROXIMATION |
1250 | + }; |
1251 | + approximationMethodOption = new JComboBox(options); |
1252 | + approximationMethodOption.setToolTipText(TOOL_TIP_Approximation_Method_Option_Keep); |
1253 | + approximationMethodOption.addActionListener(new ActionListener() { |
1254 | + @Override |
1255 | + public void actionPerformed(ActionEvent arg0) { |
1256 | + if (approximationMethodOption.getSelectedItem() == name_NONE_APPROXIMATION) { |
1257 | + approximationMethodOption.setToolTipText(TOOL_TIP_Approximation_Method_Option_None); |
1258 | + } else if (approximationMethodOption.getSelectedItem() == name_OVER_APPROXIMATION) { |
1259 | + approximationMethodOption.setToolTipText(TOOL_TIP_Approximation_Method_Option_Over); |
1260 | + } else if (approximationMethodOption.getSelectedItem() == name_UNDER_APPROXIMATION) { |
1261 | + approximationMethodOption.setToolTipText(TOOL_TIP_Approximation_Method_Option_Under); |
1262 | + } else { |
1263 | + approximationMethodOption.setToolTipText(TOOL_TIP_Approximation_Method_Option_Keep); |
1264 | + } |
1265 | + } |
1266 | + }); |
1267 | + |
1268 | + gbc = new GridBagConstraints(); |
1269 | + gbc.fill = GridBagConstraints.HORIZONTAL; |
1270 | + gbc.gridx = 1; |
1271 | + gbc.gridy = 8; |
1272 | + gbc.anchor = GridBagConstraints.WEST; |
1273 | + gbc.gridwidth = 2; |
1274 | + gbc.insets = new Insets(0, 0, 5, 0); |
1275 | + verificationOptionsPanel.add(approximationMethodOption, gbc); |
1276 | + |
1277 | + JLabel approximationDenominatorLabel = new JLabel("Approximation constant: "); |
1278 | + approximationDenominatorLabel.setToolTipText(TOOL_TIP_ApproximationDenominatorLabel); |
1279 | + gbc = new GridBagConstraints(); |
1280 | + gbc.gridx = 0; |
1281 | + gbc.gridy = 9; |
1282 | + gbc.anchor = GridBagConstraints.WEST; |
1283 | + gbc.insets = new Insets(0, 0, 5, 0); |
1284 | + verificationOptionsPanel.add(approximationDenominatorLabel, gbc); |
1285 | + |
1286 | + approximationDenominator = new CustomJSpinner(2, 1,Integer.MAX_VALUE); |
1287 | + approximationDenominator.setToolTipText(TOOL_TIP_ApproximationDenominator); |
1288 | + approximationDenominator.setMaximumSize(new Dimension(70, 30)); |
1289 | + approximationDenominator.setMinimumSize(new Dimension(70, 30)); |
1290 | + approximationDenominator.setPreferredSize(new Dimension(70, 30)); |
1291 | + approximationDenominator.setEnabled(false); |
1292 | + |
1293 | + gbc = new GridBagConstraints(); |
1294 | + gbc.gridx = 1; |
1295 | + gbc.gridy = 9; |
1296 | + gbc.anchor = GridBagConstraints.WEST; |
1297 | + gbc.insets = new Insets(0, 0, 5, 10); |
1298 | + verificationOptionsPanel.add(approximationDenominator, gbc); |
1299 | + |
1300 | + approximationDenominatorCheckbox = new JCheckBox("Do not override"); |
1301 | + approximationDenominatorCheckbox.setToolTipText(TOOL_TIP_ApproximationDenominatorCheckbox); |
1302 | + approximationDenominatorCheckbox.setSelected(true); |
1303 | + approximationDenominatorCheckbox.addActionListener(new ActionListener() { |
1304 | + public void actionPerformed(ActionEvent e) { |
1305 | + if (approximationDenominatorCheckbox.isSelected()) |
1306 | + approximationDenominator.setEnabled(false); |
1307 | + else |
1308 | + approximationDenominator.setEnabled(true); |
1309 | + } |
1310 | + }); |
1311 | + |
1312 | + gbc = new GridBagConstraints(); |
1313 | + gbc.gridx = 2; |
1314 | + gbc.gridy = 9; |
1315 | + gbc.anchor = GridBagConstraints.WEST; |
1316 | + gbc.insets = new Insets(0, 0, 5, 0); |
1317 | + verificationOptionsPanel.add(approximationDenominatorCheckbox, gbc); |
1318 | + } |
1319 | |
1320 | private void initCapacityComponents() { |
1321 | JLabel capacityLabel = new JLabel("Extra tokens:"); |
1322 | @@ -734,6 +836,7 @@ |
1323 | c.setEnabled(true); |
1324 | |
1325 | numberOfExtraTokensInNet.setEnabled(!keepQueryCapacity.isSelected()); |
1326 | + approximationDenominator.setEnabled(!approximationDenominatorCheckbox.isSelected()); |
1327 | timeoutValue.setEnabled(useTimeout()); |
1328 | } |
1329 | |
1330 | @@ -744,7 +847,7 @@ |
1331 | keepQueryCapacity.isSelected(), getNumberOfExtraTokens(), |
1332 | getSearchOption(), getSymmetryOption(), reductionOption, |
1333 | reductionOptionChooser.isDiscreteInclusion(), reductionOptionChooser.useTimeDartsPTrie(), reductionOptionChooser.useTimeDarts(), |
1334 | - reductionOptionChooser.usePTrie(), reductionOptionChooser.getChoosenOptions()); |
1335 | + reductionOptionChooser.usePTrie(), getApproximationMethodOption(), getApproximationDenominator(), reductionOptionChooser.getChoosenOptions()); |
1336 | } |
1337 | |
1338 | private int getNumberOfExtraTokens() { |
1339 | @@ -762,13 +865,29 @@ |
1340 | } |
1341 | |
1342 | private QueryPropertyOption getQueryPropertyOption() { |
1343 | - String propertyOptionString = (String) queryPropertyOption |
1344 | - .getSelectedItem(); |
1345 | + String propertyOptionString = (String) queryPropertyOption.getSelectedItem(); |
1346 | if (propertyOptionString.equals(name_SEARCHWHOLESTATESPACE)) |
1347 | return QueryPropertyOption.SearchWholeStateSpace; |
1348 | else |
1349 | return QueryPropertyOption.KeepQueryOption; |
1350 | } |
1351 | + |
1352 | + private ApproximationMethodOption getApproximationMethodOption() { |
1353 | + String ApproximationMethodOptionString = (String) approximationMethodOption.getSelectedItem(); |
1354 | + if(ApproximationMethodOptionString.equals(name_OVER_APPROXIMATION)) { |
1355 | + return ApproximationMethodOption.OverApproximation; |
1356 | + } else if (ApproximationMethodOptionString.equals(name_UNDER_APPROXIMATION)) { |
1357 | + return ApproximationMethodOption.UnderApproximation; |
1358 | + } else if (ApproximationMethodOptionString.equals(name_NONE_APPROXIMATION)) { |
1359 | + return ApproximationMethodOption.None; |
1360 | + } else { |
1361 | + return ApproximationMethodOption.KeepQueryOption; |
1362 | + } |
1363 | + } |
1364 | + |
1365 | + private int getApproximationDenominator() { |
1366 | + return (approximationDenominatorCheckbox.isSelected()) ? 0 : (Integer) approximationDenominator.getValue(); |
1367 | + } |
1368 | |
1369 | private void initSearchOptionsComponents() { |
1370 | JLabel searchLabel = new JLabel("Search order:"); |
1371 | @@ -1106,8 +1225,7 @@ |
1372 | |
1373 | private void process() { |
1374 | tableModel.clear(); |
1375 | - currentWorker = new BatchProcessingWorker(files, tableModel, |
1376 | - getVerificationOptions()); |
1377 | + currentWorker = new BatchProcessingWorker(files, tableModel, getVerificationOptions()); |
1378 | currentWorker.addPropertyChangeListener(new PropertyChangeListener() { |
1379 | |
1380 | public void propertyChange(PropertyChangeEvent evt) { |
1381 | @@ -1329,8 +1447,10 @@ |
1382 | "Not Satisfied")) |
1383 | || (isQueryColumn && value.toString().equals( |
1384 | "FALSE"))) |
1385 | - setBackground(new Color(255, 91, 91)); // light |
1386 | - // green |
1387 | + setBackground(new Color(255, 91, 91)); // light green |
1388 | + else if (isResultColumn && value.toString().equals( |
1389 | + "Inconclusive")) |
1390 | + setBackground(new Color(255, 255, 120)); // light yellow |
1391 | else |
1392 | setBackground(table.getBackground()); |
1393 | } else { |
1394 | @@ -1445,6 +1565,19 @@ |
1395 | s.append(name_SEARCHWHOLESTATESPACE); |
1396 | else |
1397 | s.append(query.getProperty().toString()); |
1398 | + |
1399 | + s.append("\n\n"); |
1400 | + s.append("Approximation method: "); |
1401 | + if (query.isOverApproximationEnabled()) { |
1402 | + s.append(name_OVER_APPROXIMATION); |
1403 | + } else if (query.isUnderApproximationEnabled()) { |
1404 | + s.append(name_UNDER_APPROXIMATION); |
1405 | + } else { |
1406 | + s.append(name_NONE_APPROXIMATION); |
1407 | + } |
1408 | + s.append("\n"); |
1409 | + s.append("Approximation Constant: "); |
1410 | + s.append(query.approximationDenominator()); |
1411 | |
1412 | return s.toString(); |
1413 | } |
1414 | |
1415 | === modified file 'src/dk/aau/cs/gui/TabContent.java' |
1416 | --- src/dk/aau/cs/gui/TabContent.java 2014-02-25 12:56:09 +0000 |
1417 | +++ src/dk/aau/cs/gui/TabContent.java 2014-05-28 18:52:41 +0000 |
1418 | @@ -239,6 +239,10 @@ |
1419 | public DataLayer getModel() { |
1420 | return drawingSurface.getGuiModel(); |
1421 | } |
1422 | + |
1423 | + public HashMap<TimedArcPetriNet, DataLayer> getGuiModels() { |
1424 | + return this.guiModels; |
1425 | + } |
1426 | |
1427 | public void setDrawingSurface(DrawingSurfaceImpl drawingSurface) { |
1428 | this.drawingSurface = drawingSurface; |
1429 | |
1430 | === modified file 'src/dk/aau/cs/io/TapnXmlLoader.java' |
1431 | --- src/dk/aau/cs/io/TapnXmlLoader.java 2014-02-22 23:21:12 +0000 |
1432 | +++ src/dk/aau/cs/io/TapnXmlLoader.java 2014-05-28 18:52:41 +0000 |
1433 | @@ -792,6 +792,9 @@ |
1434 | boolean timeDarts = getReductionOption(queryElement, "timeDarts", true); |
1435 | boolean pTrie = getReductionOption(queryElement, "pTrie", true); |
1436 | boolean overApproximation = getReductionOption(queryElement, "overApproximation", true); |
1437 | + boolean isOverApproximationEnabled = getApproximationOption(queryElement, "enableOverApproximation", false); |
1438 | + boolean isUnderApproximationEnabled = getApproximationOption(queryElement, "enableUnderApproximation", false); |
1439 | + int approximationDenominator = getApproximationValue(queryElement, "approximationDenominator", 2); |
1440 | boolean discreteInclusion = getDiscreteInclusionOption(queryElement); |
1441 | boolean active = getActiveStatus(queryElement); |
1442 | InclusionPlaces inclusionPlaces = getInclusionPlaces(queryElement, network); |
1443 | @@ -801,8 +804,7 @@ |
1444 | query = parseQueryProperty(queryElement.getAttribute("query")); |
1445 | |
1446 | if (query != null) { |
1447 | - TAPNQuery parsedQuery = new TAPNQuery(comment, capacity, query, traceOption, |
1448 | - searchOption, reductionOption, symmetry, gcd, timeDarts, pTrie, overApproximation, reduction, hashTableSize, extrapolationOption, inclusionPlaces); |
1449 | + TAPNQuery parsedQuery = new TAPNQuery(comment, capacity, query, traceOption, searchOption, reductionOption, symmetry, gcd, timeDarts, pTrie, overApproximation, reduction, hashTableSize, extrapolationOption, inclusionPlaces, isOverApproximationEnabled, isUnderApproximationEnabled, approximationDenominator); |
1450 | parsedQuery.setActive(active); |
1451 | parsedQuery.setDiscreteInclusion(discreteInclusion); |
1452 | return parsedQuery; |
1453 | @@ -864,6 +866,34 @@ |
1454 | return result; |
1455 | } |
1456 | |
1457 | + private int getApproximationValue(Element queryElement, String attributeName, int defaultValue) |
1458 | + { |
1459 | + if(!queryElement.hasAttribute(attributeName)){ |
1460 | + return defaultValue; |
1461 | + } |
1462 | + int result; |
1463 | + try { |
1464 | + result = Integer.parseInt(queryElement.getAttribute(attributeName)); |
1465 | + } catch(Exception e) { |
1466 | + result = defaultValue; |
1467 | + } |
1468 | + return result; |
1469 | + } |
1470 | + |
1471 | + private boolean getApproximationOption(Element queryElement, String attributeName, boolean defaultValue) |
1472 | + { |
1473 | + if(!queryElement.hasAttribute(attributeName)){ |
1474 | + return defaultValue; |
1475 | + } |
1476 | + boolean result; |
1477 | + try { |
1478 | + result = queryElement.getAttribute(attributeName).equals("true"); |
1479 | + } catch(Exception e) { |
1480 | + result = defaultValue; |
1481 | + } |
1482 | + return result; |
1483 | + } |
1484 | + |
1485 | private boolean getDiscreteInclusionOption(Element queryElement) { |
1486 | boolean discreteInclusion; |
1487 | try { |
1488 | |
1489 | === modified file 'src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java' |
1490 | --- src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2014-02-22 23:21:12 +0000 |
1491 | +++ src/dk/aau/cs/io/TimedArcPetriNetNetworkWriter.java 2014-05-28 18:52:41 +0000 |
1492 | @@ -268,6 +268,9 @@ |
1493 | queryElement.setAttribute("inclusionPlaces", getInclusionPlacesString(query)); |
1494 | queryElement.setAttribute("overApproximation", "" + query.useOverApproximation()); |
1495 | queryElement.setAttribute("reduction", "" + query.useReduction()); |
1496 | + queryElement.setAttribute("enableOverApproximation", "" + query.isOverApproximationEnabled()); |
1497 | + queryElement.setAttribute("enableUnderApproximation", "" + query.isUnderApproximationEnabled()); |
1498 | + queryElement.setAttribute("approximationDenominator", "" + query.approximationDenominator()); |
1499 | |
1500 | return queryElement; |
1501 | } |
1502 | |
1503 | === modified file 'src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java' |
1504 | --- src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java 2014-02-22 23:21:12 +0000 |
1505 | +++ src/dk/aau/cs/io/batchProcessing/BatchProcessingLoader.java 2014-05-28 18:52:41 +0000 |
1506 | @@ -494,18 +494,21 @@ |
1507 | boolean timeDarts = getReductionOption(queryElement, "timeDarts", true); |
1508 | boolean pTrie = getReductionOption(queryElement, "pTrie", true); |
1509 | boolean overApproximation = getReductionOption(queryElement, "overApproximation", false); |
1510 | + boolean isOverApproximationEnabled = getApproximationOption(queryElement, "enableOverApproximation", false); |
1511 | + boolean isUnderApproximationEnabled = getApproximationOption(queryElement, "enableUnderApproximation", false); |
1512 | + int approximationDenominator = getApproximationValue(queryElement, "approximationDenominator", 2); |
1513 | boolean active = getActiveStatus(queryElement); |
1514 | boolean discreteInclusion = getDiscreteInclusionOption(queryElement); |
1515 | boolean reduction = getReductionOption(queryElement, "reduction", true); |
1516 | InclusionPlaces inclusionPlaces = getInclusionPlaces(queryElement, network); |
1517 | |
1518 | - |
1519 | TCTLAbstractProperty query; |
1520 | query = parseQueryProperty(queryElement.getAttribute("query")); |
1521 | |
1522 | if (query != null) { |
1523 | TAPNQuery parsedQuery = new TAPNQuery(comment, capacity, query, traceOption, |
1524 | - searchOption, reductionOption, symmetry, gcd, timeDarts, pTrie, overApproximation, reduction, hashTableSize, extrapolationOption, inclusionPlaces); |
1525 | + searchOption, reductionOption, symmetry, gcd, timeDarts, pTrie, overApproximation, reduction, hashTableSize, |
1526 | + extrapolationOption, inclusionPlaces, isOverApproximationEnabled, isUnderApproximationEnabled, approximationDenominator); |
1527 | parsedQuery.setActive(active); |
1528 | parsedQuery.setDiscreteInclusion(discreteInclusion); |
1529 | return parsedQuery; |
1530 | @@ -513,6 +516,34 @@ |
1531 | return null; |
1532 | } |
1533 | |
1534 | + private int getApproximationValue(Element queryElement, String attributeName, int defaultValue) |
1535 | + { |
1536 | + if(!queryElement.hasAttribute(attributeName)){ |
1537 | + return defaultValue; |
1538 | + } |
1539 | + int result; |
1540 | + try { |
1541 | + result = Integer.parseInt(queryElement.getAttribute(attributeName)); |
1542 | + } catch(Exception e) { |
1543 | + result = defaultValue; |
1544 | + } |
1545 | + return result; |
1546 | + } |
1547 | + |
1548 | + private boolean getApproximationOption(Element queryElement, String attributeName, boolean defaultValue) |
1549 | + { |
1550 | + if(!queryElement.hasAttribute(attributeName)){ |
1551 | + return defaultValue; |
1552 | + } |
1553 | + boolean result; |
1554 | + try { |
1555 | + result = queryElement.getAttribute(attributeName).equals("true"); |
1556 | + } catch(Exception e) { |
1557 | + result = defaultValue; |
1558 | + } |
1559 | + return result; |
1560 | + } |
1561 | + |
1562 | private boolean getDiscreteInclusionOption(Element queryElement) { |
1563 | boolean discreteInclusion; |
1564 | try { |
1565 | |
1566 | === modified file 'src/dk/aau/cs/io/batchProcessing/BatchProcessingResultsExporter.java' |
1567 | --- src/dk/aau/cs/io/batchProcessing/BatchProcessingResultsExporter.java 2014-02-26 20:07:09 +0000 |
1568 | +++ src/dk/aau/cs/io/batchProcessing/BatchProcessingResultsExporter.java 2014-05-28 18:52:41 +0000 |
1569 | @@ -21,12 +21,15 @@ |
1570 | private static final String name_BROADCAST = "J: UPPAAL: Broadcast Reduction"; |
1571 | private static final String name_BROADCASTDEG2 = "K: UPPAAL: Broadcast Degree 2 Reduction"; |
1572 | private static final String name_UNTIMED = "L: TAPAAL Untimed Engine"; |
1573 | - private static final String name_UNTIMEDAPPROX = "M: TAPAAL Untimed Engine, Over-Approximation Only"; |
1574 | + private static final String name_UNTIMEDAPPROX = "M: TAPAAL Untimed Engine, State-Equations Check Only"; |
1575 | private static final String name_UNTIMEDREDUCE = "N: TAPAAL Untimed engine w. Net Reductions"; |
1576 | private static final String name_BFS = "Breadth First Search"; |
1577 | private static final String name_DFS = "Depth First Search"; |
1578 | private static final String name_RandomDFS = "Random Depth First Search"; |
1579 | - private static final String DELIMITER = ";"; |
1580 | + private static final String name_NONE_APPROXIMATION = "None"; |
1581 | + private static final String name_OVER_APPROXIMATION = "Over-approximation"; |
1582 | + private static final String name_UNDER_APPROXIMATION = "Under-approximation"; |
1583 | + private static final String DELIMITER = ";"; |
1584 | |
1585 | public void exportToCSV(Iterable<BatchProcessingVerificationResult> results, File outputFile) throws Exception { |
1586 | PrintStream writer = new PrintStream(outputFile); |
1587 | @@ -43,7 +46,9 @@ |
1588 | "Extra Tokens" + DELIMITER + |
1589 | "Verification Method" + DELIMITER + |
1590 | "Symmetry" + DELIMITER + |
1591 | - "Search Order"); |
1592 | + "Search Order" + DELIMITER + |
1593 | + "Approximation Method" + DELIMITER + |
1594 | + "Approximation Constant"); |
1595 | |
1596 | for(BatchProcessingVerificationResult result : results) { |
1597 | TAPNQuery query = result.query(); |
1598 | @@ -77,6 +82,10 @@ |
1599 | s.append((query != null) ? (query.useSymmetry() ? "Yes" : "No") : ""); |
1600 | s.append(DELIMITER); |
1601 | s.append((query != null) ? getVerificationMethod(query) : ""); |
1602 | + s.append(DELIMITER); |
1603 | + s.append((query != null) ? getApproximationMethod(query) : ""); |
1604 | + s.append(DELIMITER); |
1605 | + s.append((query != null) ? query.approximationDenominator() : ""); |
1606 | |
1607 | writer.println(s.toString()); |
1608 | } |
1609 | @@ -93,6 +102,15 @@ |
1610 | return name_BFS; |
1611 | |
1612 | } |
1613 | + |
1614 | + private String getApproximationMethod(TAPNQuery query) { |
1615 | + if (query.isOverApproximationEnabled()) { |
1616 | + return name_OVER_APPROXIMATION; |
1617 | + } else if (query.isUnderApproximationEnabled()) { |
1618 | + return name_UNDER_APPROXIMATION; |
1619 | + } |
1620 | + return name_NONE_APPROXIMATION; |
1621 | + } |
1622 | |
1623 | private Object getSearchOrder(TAPNQuery query) { |
1624 | ReductionOption reduction = query.getReductionOption(); |
1625 | |
1626 | === modified file 'src/dk/aau/cs/model/tapn/TAPNQuery.java' |
1627 | --- src/dk/aau/cs/model/tapn/TAPNQuery.java 2013-09-28 12:16:32 +0000 |
1628 | +++ src/dk/aau/cs/model/tapn/TAPNQuery.java 2014-05-28 18:52:41 +0000 |
1629 | @@ -39,4 +39,8 @@ |
1630 | public String toString() { |
1631 | return property.toString(); |
1632 | } |
1633 | + |
1634 | + public void setProperty(TCTLAbstractProperty newProperty){ |
1635 | + this.property = newProperty; |
1636 | + } |
1637 | } |
1638 | |
1639 | === modified file 'src/dk/aau/cs/model/tapn/TimeInterval.java' |
1640 | --- src/dk/aau/cs/model/tapn/TimeInterval.java 2013-04-11 18:06:16 +0000 |
1641 | +++ src/dk/aau/cs/model/tapn/TimeInterval.java 2014-05-28 18:52:41 +0000 |
1642 | @@ -95,10 +95,18 @@ |
1643 | public Bound lowerBound() { |
1644 | return lower; |
1645 | } |
1646 | + |
1647 | + public void setLowerBound(Bound lower) { |
1648 | + this.lower = lower; |
1649 | + } |
1650 | |
1651 | public Bound upperBound() { |
1652 | return upper; |
1653 | } |
1654 | + |
1655 | + public void setUpperBound(Bound upper) { |
1656 | + this.upper = upper; |
1657 | + } |
1658 | |
1659 | public boolean IsLowerBoundNonStrict() { |
1660 | return isLowerIncluded; |
1661 | |
1662 | === modified file 'src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java' |
1663 | --- src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java 2013-11-14 21:32:09 +0000 |
1664 | +++ src/dk/aau/cs/model/tapn/TimedArcPetriNetNetwork.java 2014-05-28 18:52:41 +0000 |
1665 | @@ -15,6 +15,7 @@ |
1666 | import dk.aau.cs.util.Require; |
1667 | import dk.aau.cs.util.StringComparator; |
1668 | import dk.aau.cs.util.Tuple; |
1669 | +import dk.aau.cs.verification.ITAPNComposer; |
1670 | import dk.aau.cs.verification.NameMapping; |
1671 | import dk.aau.cs.verification.TAPNComposer; |
1672 | |
1673 | @@ -467,7 +468,7 @@ |
1674 | } |
1675 | |
1676 | public boolean isDegree2(){ |
1677 | - TAPNComposer composer = new TAPNComposer(new MessengerImpl()); |
1678 | + ITAPNComposer composer = new TAPNComposer(new MessengerImpl()); |
1679 | Tuple<TimedArcPetriNet,NameMapping> composedModel = composer.transformModel(this); |
1680 | |
1681 | return composedModel.value1().isDegree2(); |
1682 | |
1683 | === modified file 'src/dk/aau/cs/model/tapn/TimedToken.java' |
1684 | --- src/dk/aau/cs/model/tapn/TimedToken.java 2014-02-05 15:13:50 +0000 |
1685 | +++ src/dk/aau/cs/model/tapn/TimedToken.java 2014-05-28 18:52:41 +0000 |
1686 | @@ -26,6 +26,10 @@ |
1687 | return age; |
1688 | } |
1689 | |
1690 | + public void setAge(BigDecimal age) { |
1691 | + this.age = age; |
1692 | + } |
1693 | + |
1694 | public TimedToken clone() { |
1695 | return new TimedToken(place, age); // age is immutable so ok to pass it |
1696 | // to constructor |
1697 | |
1698 | === modified file 'src/dk/aau/cs/model/tapn/TransportArc.java' |
1699 | --- src/dk/aau/cs/model/tapn/TransportArc.java 2013-04-22 07:35:47 +0000 |
1700 | +++ src/dk/aau/cs/model/tapn/TransportArc.java 2014-05-28 18:52:41 +0000 |
1701 | @@ -90,7 +90,8 @@ |
1702 | |
1703 | @Override |
1704 | public void delete() { |
1705 | - model().remove(this); |
1706 | + if (model() != null) |
1707 | + model().remove(this); |
1708 | } |
1709 | |
1710 | public TransportArc copy(TimedArcPetriNet tapn) { |
1711 | |
1712 | === modified file 'src/dk/aau/cs/model/tapn/simulation/TAPNNetworkTimeDelayStep.java' |
1713 | --- src/dk/aau/cs/model/tapn/simulation/TAPNNetworkTimeDelayStep.java 2013-09-23 15:42:38 +0000 |
1714 | +++ src/dk/aau/cs/model/tapn/simulation/TAPNNetworkTimeDelayStep.java 2014-05-28 18:52:41 +0000 |
1715 | @@ -21,6 +21,10 @@ |
1716 | public BigDecimal getDelay(){ |
1717 | return delay; |
1718 | } |
1719 | + |
1720 | + public void setDelay(BigDecimal delay){ |
1721 | + this.delay = delay; |
1722 | + } |
1723 | |
1724 | @Override |
1725 | public String toString() { |
1726 | |
1727 | === modified file 'src/dk/aau/cs/model/tapn/simulation/TimeDelayStep.java' |
1728 | --- src/dk/aau/cs/model/tapn/simulation/TimeDelayStep.java 2012-06-27 15:30:31 +0000 |
1729 | +++ src/dk/aau/cs/model/tapn/simulation/TimeDelayStep.java 2014-05-28 18:52:41 +0000 |
1730 | @@ -21,6 +21,10 @@ |
1731 | public BigDecimal delay() { |
1732 | return delay; |
1733 | } |
1734 | + |
1735 | + public void setDelay(BigDecimal delay) { |
1736 | + this.delay = delay; |
1737 | + } |
1738 | |
1739 | @Override |
1740 | public String toString() { |
1741 | |
1742 | === modified file 'src/dk/aau/cs/model/tapn/simulation/TimedArcPetriNetTrace.java' |
1743 | --- src/dk/aau/cs/model/tapn/simulation/TimedArcPetriNetTrace.java 2012-07-05 13:51:28 +0000 |
1744 | +++ src/dk/aau/cs/model/tapn/simulation/TimedArcPetriNetTrace.java 2014-05-28 18:52:41 +0000 |
1745 | @@ -4,6 +4,8 @@ |
1746 | import java.util.Iterator; |
1747 | import java.util.List; |
1748 | |
1749 | +import dk.aau.cs.model.tapn.TimedOutputArc; |
1750 | +import dk.aau.cs.model.tapn.TimedToken; |
1751 | import dk.aau.cs.verification.VerifyTAPN.TraceType; |
1752 | |
1753 | public class TimedArcPetriNetTrace implements Iterable<TimedArcPetriNetStep> { |
1754 | @@ -60,4 +62,37 @@ |
1755 | public void setTraceType(TraceType traceType){ |
1756 | this.traceType = traceType; |
1757 | } |
1758 | + |
1759 | + public void reduceTraceForOriginalNet(String matchForTransition, String matchTokenRemoval) { |
1760 | + for (TimedArcPetriNetStep step : steps){ |
1761 | + if (step instanceof TimedTransitionStep) { |
1762 | + if (((TimedTransitionStep) step).transition().name().contains(matchForTransition)) { |
1763 | + ((TimedTransitionStep) step).transition().setName(((TimedTransitionStep) step).transition().name().substring(0, ((TimedTransitionStep) step).transition().name().indexOf(matchForTransition))); |
1764 | + } |
1765 | + if(((TimedTransitionStep) step).consumedTokens() != null){ |
1766 | + for (TimedToken token : ((TimedTransitionStep) step).consumedTokens()){ |
1767 | + if(token.place().name().contains(matchTokenRemoval)){ |
1768 | + ((TimedTransitionStep) step).consumedTokens().remove(token); |
1769 | + break; |
1770 | + } |
1771 | + } |
1772 | + } |
1773 | + } |
1774 | + } |
1775 | + } |
1776 | + |
1777 | + public void removeTokens(String matchTokenRemoval){ |
1778 | + for (TimedArcPetriNetStep step : steps){ |
1779 | + if (step instanceof TimedTransitionStep){ |
1780 | + if(((TimedTransitionStep) step).consumedTokens() != null){ |
1781 | + for (TimedToken token : ((TimedTransitionStep) step).consumedTokens()){ |
1782 | + if(token.place().name().contains(matchTokenRemoval)){ |
1783 | + ((TimedTransitionStep) step).consumedTokens().remove(token); |
1784 | + break; |
1785 | + } |
1786 | + } |
1787 | + } |
1788 | + } |
1789 | + } |
1790 | + } |
1791 | } |
1792 | |
1793 | === modified file 'src/dk/aau/cs/util/MemoryMonitor.java' |
1794 | --- src/dk/aau/cs/util/MemoryMonitor.java 2013-11-12 13:08:42 +0000 |
1795 | +++ src/dk/aau/cs/util/MemoryMonitor.java 2014-05-28 18:52:41 +0000 |
1796 | @@ -31,6 +31,7 @@ |
1797 | private static int PID = -1; |
1798 | private static Semaphore busy = new Semaphore(1); |
1799 | private static double peakMemory = -1; |
1800 | + private static Boolean cumulativePeakMemory = false; |
1801 | private static DecimalFormat formatter = null; |
1802 | |
1803 | private static DecimalFormat getFormatter(){ |
1804 | @@ -44,7 +45,12 @@ |
1805 | |
1806 | public static void attach(Process p){ |
1807 | PID = getPid(p); |
1808 | - peakMemory = -1; |
1809 | + |
1810 | + if( ! cumulativePeakMemory) { |
1811 | + peakMemory = -1; |
1812 | + } |
1813 | + |
1814 | + cumulativePeakMemory = false; |
1815 | } |
1816 | |
1817 | public static void detach(){ |
1818 | @@ -55,6 +61,10 @@ |
1819 | public static boolean isAttached(){ |
1820 | return PID != -1; |
1821 | } |
1822 | + |
1823 | + public static void cumulateMemory() { |
1824 | + cumulativePeakMemory = true; |
1825 | + } |
1826 | |
1827 | public static String getUsage(){ |
1828 | if(busy.tryAcquire()){ |
1829 | @@ -91,7 +101,6 @@ |
1830 | } |
1831 | |
1832 | busy.release(); |
1833 | - |
1834 | if(memory < 0){ |
1835 | return null; |
1836 | }else{ |
1837 | |
1838 | === added file 'src/dk/aau/cs/verification/ITAPNComposer.java' |
1839 | --- src/dk/aau/cs/verification/ITAPNComposer.java 1970-01-01 00:00:00 +0000 |
1840 | +++ src/dk/aau/cs/verification/ITAPNComposer.java 2014-05-28 18:52:41 +0000 |
1841 | @@ -0,0 +1,12 @@ |
1842 | +package dk.aau.cs.verification; |
1843 | + |
1844 | +import dk.aau.cs.model.tapn.TimedArcPetriNet; |
1845 | +import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
1846 | +import dk.aau.cs.util.Tuple; |
1847 | + |
1848 | +public interface ITAPNComposer { |
1849 | + |
1850 | + public abstract Tuple<TimedArcPetriNet, NameMapping> transformModel( |
1851 | + TimedArcPetriNetNetwork model); |
1852 | + |
1853 | +} |
1854 | \ No newline at end of file |
1855 | |
1856 | === modified file 'src/dk/aau/cs/verification/NameMapping.java' |
1857 | --- src/dk/aau/cs/verification/NameMapping.java 2012-05-02 13:40:18 +0000 |
1858 | +++ src/dk/aau/cs/verification/NameMapping.java 2014-05-28 18:52:41 +0000 |
1859 | @@ -35,7 +35,7 @@ |
1860 | return originalToMappedNames.get(new Tuple<String, String>(templateName, objectName)); |
1861 | } |
1862 | |
1863 | - public HashMap<String, Tuple<String, String>> getMappedToOrg(){ |
1864 | - return mappedNamesToOriginalNames; |
1865 | + public HashMap<Tuple<String, String>, String> getOrgToMapped(){ |
1866 | + return originalToMappedNames; |
1867 | } |
1868 | } |
1869 | |
1870 | === modified file 'src/dk/aau/cs/verification/QueryResult.java' |
1871 | --- src/dk/aau/cs/verification/QueryResult.java 2013-10-02 19:52:23 +0000 |
1872 | +++ src/dk/aau/cs/verification/QueryResult.java 2014-05-28 18:52:41 +0000 |
1873 | @@ -5,6 +5,7 @@ |
1874 | |
1875 | public class QueryResult { |
1876 | private boolean satisfied = false; |
1877 | + private boolean approximationInconclusive = false; |
1878 | private boolean discreteInclusion = false; |
1879 | private TAPNQuery query; |
1880 | private BoundednessAnalysisResult boundednessAnalysis; |
1881 | @@ -20,6 +21,14 @@ |
1882 | return satisfied; |
1883 | } |
1884 | |
1885 | + public boolean isApproximationInconclusive() { |
1886 | + return approximationInconclusive; |
1887 | + } |
1888 | + |
1889 | + public void setApproximationInconclusive(boolean result) { |
1890 | + approximationInconclusive = result; |
1891 | + } |
1892 | + |
1893 | public boolean isDiscreteIncludion() { |
1894 | return discreteInclusion; |
1895 | } |
1896 | @@ -30,8 +39,13 @@ |
1897 | |
1898 | @Override |
1899 | public String toString() { |
1900 | - StringBuffer buffer = new StringBuffer( "Property is "); |
1901 | - buffer.append(satisfied ? "satisfied." : "not satisfied."); |
1902 | + StringBuffer buffer = new StringBuffer(); |
1903 | + if(approximationInconclusive) |
1904 | + buffer.append(getInconclusiveString()); |
1905 | + else { |
1906 | + buffer.append("Property is "); |
1907 | + buffer.append(satisfied ? "satisfied." : "not satisfied."); |
1908 | + } |
1909 | if(shouldAddExplanation()) |
1910 | buffer.append(getExplanationString()); |
1911 | return buffer.toString(); |
1912 | @@ -54,8 +68,22 @@ |
1913 | protected String getExplanationString(){ |
1914 | return boundednessAnalysis.toString(); |
1915 | } |
1916 | + |
1917 | + protected String getInconclusiveString(){ |
1918 | + StringBuffer buffer = new StringBuffer(); |
1919 | + buffer.append("The result of the approximation was inconclusive."); |
1920 | + return buffer.toString(); |
1921 | + } |
1922 | + |
1923 | + public TAPNQuery getQuery() { |
1924 | + return query; |
1925 | + } |
1926 | |
1927 | public BoundednessAnalysisResult boundednessAnalysis() { |
1928 | return boundednessAnalysis; |
1929 | } |
1930 | + |
1931 | + public void flipResult() { |
1932 | + this.satisfied = !this.satisfied; |
1933 | + } |
1934 | } |
1935 | |
1936 | === modified file 'src/dk/aau/cs/verification/TAPNComposer.java' |
1937 | --- src/dk/aau/cs/verification/TAPNComposer.java 2013-11-25 12:16:37 +0000 |
1938 | +++ src/dk/aau/cs/verification/TAPNComposer.java 2014-05-28 18:52:41 +0000 |
1939 | @@ -16,7 +16,7 @@ |
1940 | import dk.aau.cs.model.tapn.TransportArc; |
1941 | import dk.aau.cs.util.Tuple; |
1942 | |
1943 | -public class TAPNComposer { |
1944 | +public class TAPNComposer implements ITAPNComposer { |
1945 | private static final String PLACE_FORMAT = "P%1$d"; |
1946 | private static final String TRANSITION_FORMAT = "T%1$d"; |
1947 | |
1948 | @@ -32,6 +32,7 @@ |
1949 | this.messenger = messenger; |
1950 | } |
1951 | |
1952 | + @Override |
1953 | public Tuple<TimedArcPetriNet, NameMapping> transformModel(TimedArcPetriNetNetwork model) { |
1954 | nextPlaceIndex = -1; |
1955 | nextTransitionIndex = -1; |
1956 | @@ -48,8 +49,6 @@ |
1957 | createTransportArcs(model, tapn, mapping); |
1958 | createInhibitorArcs(model, tapn, mapping); |
1959 | |
1960 | - //dumpToConsole(tapn, mapping); |
1961 | - |
1962 | return new Tuple<TimedArcPetriNet, NameMapping>(tapn, mapping); |
1963 | } |
1964 | |
1965 | |
1966 | === added file 'src/dk/aau/cs/verification/TAPNComposerWithGUI.java' |
1967 | --- src/dk/aau/cs/verification/TAPNComposerWithGUI.java 1970-01-01 00:00:00 +0000 |
1968 | +++ src/dk/aau/cs/verification/TAPNComposerWithGUI.java 2014-05-28 18:52:41 +0000 |
1969 | @@ -0,0 +1,599 @@ |
1970 | +package dk.aau.cs.verification; |
1971 | + |
1972 | +import java.util.HashMap; |
1973 | +import java.util.HashSet; |
1974 | +import java.util.Map.Entry; |
1975 | + |
1976 | +import pipe.dataLayer.DataLayer; |
1977 | +import pipe.gui.graphicElements.Arc; |
1978 | +import pipe.gui.graphicElements.ArcPath; |
1979 | +import pipe.gui.graphicElements.ArcPathPoint; |
1980 | +import pipe.gui.graphicElements.Place; |
1981 | +import pipe.gui.graphicElements.PlaceTransitionObject; |
1982 | +import pipe.gui.graphicElements.Transition; |
1983 | +import pipe.gui.graphicElements.tapn.TimedInhibitorArcComponent; |
1984 | +import pipe.gui.graphicElements.tapn.TimedInputArcComponent; |
1985 | +import pipe.gui.graphicElements.tapn.TimedOutputArcComponent; |
1986 | +import pipe.gui.graphicElements.tapn.TimedPlaceComponent; |
1987 | +import pipe.gui.graphicElements.tapn.TimedTransitionComponent; |
1988 | +import pipe.gui.graphicElements.tapn.TimedTransportArcComponent; |
1989 | +import dk.aau.cs.Messenger; |
1990 | +import dk.aau.cs.model.tapn.Bound; |
1991 | +import dk.aau.cs.model.tapn.IntBound; |
1992 | +import dk.aau.cs.model.tapn.LocalTimedPlace; |
1993 | +import dk.aau.cs.model.tapn.SharedPlace; |
1994 | +import dk.aau.cs.model.tapn.TimeInterval; |
1995 | +import dk.aau.cs.model.tapn.TimeInvariant; |
1996 | +import dk.aau.cs.model.tapn.TimedArcPetriNet; |
1997 | +import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
1998 | +import dk.aau.cs.model.tapn.TimedInhibitorArc; |
1999 | +import dk.aau.cs.model.tapn.TimedInputArc; |
2000 | +import dk.aau.cs.model.tapn.TimedOutputArc; |
2001 | +import dk.aau.cs.model.tapn.TimedPlace; |
2002 | +import dk.aau.cs.model.tapn.TimedToken; |
2003 | +import dk.aau.cs.model.tapn.TimedTransition; |
2004 | +import dk.aau.cs.model.tapn.TransportArc; |
2005 | +import dk.aau.cs.util.Tuple; |
2006 | + |
2007 | +public class TAPNComposerWithGUI implements ITAPNComposer { |
2008 | + private static final String PLACE_FORMAT = "P%1$d"; |
2009 | + private static final String TRANSITION_FORMAT = "T%1$d"; |
2010 | + |
2011 | + private Messenger messenger; |
2012 | + private boolean hasShownMessage = false; |
2013 | + |
2014 | + private int nextPlaceIndex; |
2015 | + private int nextTransitionIndex; |
2016 | + |
2017 | + private HashSet<String> processedSharedObjects; |
2018 | + private HashMap<TimedArcPetriNet, DataLayer> guiModels; |
2019 | + private DataLayer composedGuiModel; |
2020 | + |
2021 | + public TAPNComposerWithGUI(Messenger messenger, HashMap<TimedArcPetriNet, DataLayer> guiModels){ |
2022 | + this.messenger = messenger; |
2023 | + |
2024 | + HashMap<TimedArcPetriNet, DataLayer> newGuiModels = new HashMap<TimedArcPetriNet, DataLayer>(); |
2025 | + for(Entry<TimedArcPetriNet, DataLayer> entry : guiModels.entrySet()) { |
2026 | + newGuiModels.put(entry.getKey(), entry.getValue().copy(entry.getKey())); |
2027 | + } |
2028 | + |
2029 | + this.guiModels = newGuiModels; |
2030 | + } |
2031 | + |
2032 | + public Tuple<TimedArcPetriNet, NameMapping> transformModel(TimedArcPetriNetNetwork model) { |
2033 | + nextPlaceIndex = -1; |
2034 | + nextTransitionIndex = -1; |
2035 | + processedSharedObjects = new HashSet<String>(); |
2036 | + TimedArcPetriNet tapn = new TimedArcPetriNet("ComposedModel"); |
2037 | + DataLayer guiModel = new DataLayer(); |
2038 | + NameMapping mapping = new NameMapping(); |
2039 | + hasShownMessage = false; |
2040 | + |
2041 | + |
2042 | + double greatestWidth = 0, |
2043 | + greatestHeight = 0; |
2044 | + for (TimedArcPetriNet tapn1 : model.activeTemplates()) { |
2045 | + greatestWidth = greatestWidth >= getRightmostObject(guiModels.get(tapn1)).getPositionX() ? greatestWidth : getRightmostObject(guiModels.get(tapn1)).getPositionX(); |
2046 | + greatestHeight = greatestHeight >= getLowestObject(guiModels.get(tapn1)).getPositionY() ? greatestHeight : getLowestObject(guiModels.get(tapn1)).getPositionY(); |
2047 | + } |
2048 | + |
2049 | + createSharedPlaces(model, tapn, mapping, guiModel); |
2050 | + createPlaces(model, tapn, mapping, guiModel, greatestWidth, greatestHeight); |
2051 | + createTransitions(model, tapn, mapping, guiModel, greatestWidth, greatestHeight); |
2052 | + createInputArcs(model, tapn, mapping, guiModel, greatestWidth, greatestHeight); |
2053 | + createOutputArcs(model, tapn, mapping, guiModel, greatestWidth, greatestHeight); |
2054 | + createTransportArcs(model, tapn, mapping, guiModel, greatestWidth, greatestHeight); |
2055 | + createInhibitorArcs(model, tapn, mapping, guiModel, greatestWidth, greatestHeight); |
2056 | + |
2057 | + // Set composed guiModel in the instance variable |
2058 | + this.composedGuiModel = guiModel; |
2059 | + |
2060 | + return new Tuple<TimedArcPetriNet, NameMapping>(tapn, mapping); |
2061 | + } |
2062 | + |
2063 | + public DataLayer getGuiModel() { |
2064 | + return this.composedGuiModel; |
2065 | + } |
2066 | + |
2067 | + private Tuple<Integer, Integer> calculateComponentPosition(int netNumber) { |
2068 | + Integer x = netNumber % 2; |
2069 | + Integer y = (int) Math.floor(netNumber / 2d); |
2070 | + |
2071 | + return new Tuple<Integer, Integer>(x, y); |
2072 | + } |
2073 | + |
2074 | + private PlaceTransitionObject getRightmostObject(DataLayer guiModel) { |
2075 | + PlaceTransitionObject returnObject = null; |
2076 | + |
2077 | + for (PlaceTransitionObject currentObject : guiModel.getPlaces()) { |
2078 | + if (returnObject == null || returnObject.getPositionX() < currentObject.getPositionX()) { |
2079 | + returnObject = currentObject; |
2080 | + } |
2081 | + } |
2082 | + |
2083 | + for (PlaceTransitionObject currentObject : guiModel.getTransitions()) { |
2084 | + if (returnObject == null || returnObject.getPositionX() < currentObject.getPositionX()) { |
2085 | + returnObject = currentObject; |
2086 | + } |
2087 | + } |
2088 | + |
2089 | + return returnObject; |
2090 | + } |
2091 | + |
2092 | + private PlaceTransitionObject getLowestObject(DataLayer guiModel) { |
2093 | + PlaceTransitionObject returnObject = null; |
2094 | + |
2095 | + for (PlaceTransitionObject currentObject : guiModel.getPlaces()) { |
2096 | + if (returnObject == null || returnObject.getPositionY() < currentObject.getPositionY()) { |
2097 | + returnObject = currentObject; |
2098 | + } |
2099 | + } |
2100 | + |
2101 | + for (PlaceTransitionObject currentObject : guiModel.getTransitions()) { |
2102 | + if (returnObject == null || returnObject.getPositionY() < currentObject.getPositionY()) { |
2103 | + returnObject = currentObject; |
2104 | + } |
2105 | + } |
2106 | + |
2107 | + return returnObject; |
2108 | + } |
2109 | + |
2110 | + private Place getSharedPlace(String name) { |
2111 | + for(Entry<TimedArcPetriNet, DataLayer> hashmapEntry : guiModels.entrySet()) { |
2112 | + Place findPlace = hashmapEntry.getValue().getPlaceByName(name); |
2113 | + if (findPlace != null) |
2114 | + return findPlace; |
2115 | + } |
2116 | + return null; |
2117 | + } |
2118 | + |
2119 | + private void createSharedPlaces(TimedArcPetriNetNetwork model, TimedArcPetriNet constructedModel, NameMapping mapping, DataLayer guiModel) { |
2120 | + for(SharedPlace place : model.sharedPlaces()){ |
2121 | + String uniquePlaceName = (model.activeTemplates().size() > 1) ? "Shared_" + place.name() : place.name(); |
2122 | + |
2123 | + LocalTimedPlace constructedPlace = null; |
2124 | + if (place.invariant().upperBound() instanceof Bound.InfBound) { |
2125 | + constructedPlace = new LocalTimedPlace(uniquePlaceName, place.invariant()); |
2126 | + } else { |
2127 | + constructedPlace = new LocalTimedPlace(uniquePlaceName, new TimeInvariant(place.invariant().isUpperNonstrict(), new IntBound(place.invariant().upperBound().value()))); |
2128 | + } |
2129 | + constructedModel.add(constructedPlace); |
2130 | + mapping.addMappingForShared(place.name(), uniquePlaceName); |
2131 | + |
2132 | + if(model.isSharedPlaceUsedInTemplates(place)){ |
2133 | + for (TimedToken token : place.tokens()) { |
2134 | + constructedPlace.addToken(new TimedToken(constructedPlace, token.age())); |
2135 | + } |
2136 | + } |
2137 | + |
2138 | + Place oldPlace = getSharedPlace(place.name()); |
2139 | + TimedPlaceComponent newPlace = new TimedPlaceComponent( |
2140 | + oldPlace.getPositionX(), |
2141 | + oldPlace.getPositionY(), |
2142 | + oldPlace.getId(), |
2143 | + uniquePlaceName, |
2144 | + oldPlace.getNameOffsetX(), |
2145 | + oldPlace.getNameOffsetY(), |
2146 | + 0, |
2147 | + oldPlace.getMarkingOffsetXObject().doubleValue(), |
2148 | + oldPlace.getMarkingOffsetYObject().doubleValue(), |
2149 | + 0 |
2150 | + ); |
2151 | + newPlace.setGuiModel(guiModel); |
2152 | + newPlace.setUnderlyingPlace(constructedPlace); |
2153 | + newPlace.setName(uniquePlaceName); |
2154 | + guiModel.addPlace(newPlace); |
2155 | + } |
2156 | + } |
2157 | + |
2158 | + private void createPlaces(TimedArcPetriNetNetwork model, TimedArcPetriNet constructedModel, NameMapping mapping, DataLayer guiModel, double greatestWidth, double greatestHeight) { |
2159 | + int i = 0; |
2160 | + for (TimedArcPetriNet tapn : model.activeTemplates()) { |
2161 | + Tuple<Integer, Integer> offset = this.calculateComponentPosition(i); |
2162 | + DataLayer currentGuiModel = this.guiModels.get(tapn); |
2163 | + |
2164 | + for (TimedPlace timedPlace : tapn.places()) { |
2165 | + if(!timedPlace.isShared()){ |
2166 | + String uniquePlaceName = (model.activeTemplates().size() > 1) ? ((LocalTimedPlace)timedPlace).model().name() + "_" + timedPlace.name() : timedPlace.name(); |
2167 | + |
2168 | + LocalTimedPlace place = null; |
2169 | + if (timedPlace.invariant().upperBound() instanceof Bound.InfBound) { |
2170 | + place = new LocalTimedPlace(uniquePlaceName, timedPlace.invariant()); |
2171 | + } else { |
2172 | + place = new LocalTimedPlace(uniquePlaceName, new TimeInvariant(timedPlace.invariant().isUpperNonstrict(), new IntBound(timedPlace.invariant().upperBound().value()))); |
2173 | + } |
2174 | + constructedModel.add(place); |
2175 | + mapping.addMapping(tapn.name(), timedPlace.name(), uniquePlaceName); |
2176 | + |
2177 | + for (TimedToken token : timedPlace.tokens()) { |
2178 | + place.addToken(new TimedToken(place, token.age())); |
2179 | + } |
2180 | + |
2181 | + Place oldPlace = currentGuiModel.getPlaceByName(timedPlace.name()); |
2182 | + TimedPlaceComponent newPlace = new TimedPlaceComponent( |
2183 | + oldPlace.getPositionX() + offset.value1() * greatestWidth, |
2184 | + oldPlace.getPositionY() + offset.value2() * greatestHeight, |
2185 | + oldPlace.getId(), |
2186 | + uniquePlaceName, |
2187 | + oldPlace.getNameOffsetX(), |
2188 | + oldPlace.getNameOffsetY(), |
2189 | + 0, |
2190 | + oldPlace.getMarkingOffsetXObject().doubleValue(), |
2191 | + oldPlace.getMarkingOffsetYObject().doubleValue(), |
2192 | + 0 |
2193 | + ); |
2194 | + newPlace.setGuiModel(guiModel); |
2195 | + newPlace.setUnderlyingPlace(place); |
2196 | + newPlace.setName(uniquePlaceName); |
2197 | + guiModel.addPlace(newPlace); |
2198 | + } |
2199 | + } |
2200 | + i++; |
2201 | + } |
2202 | + } |
2203 | + |
2204 | + private String getUniquePlaceName() { |
2205 | + nextPlaceIndex++; |
2206 | + return String.format(PLACE_FORMAT, nextPlaceIndex); |
2207 | + } |
2208 | + |
2209 | + private void createTransitions(TimedArcPetriNetNetwork model, TimedArcPetriNet constructedModel, NameMapping mapping, DataLayer guiModel, double greatestWidth, double greatestHeight) { |
2210 | + int i = 0; |
2211 | + for (TimedArcPetriNet tapn : model.activeTemplates()) { |
2212 | + Tuple<Integer, Integer> offset = this.calculateComponentPosition(i); |
2213 | + DataLayer currentGuiModel = this.guiModels.get(tapn); |
2214 | + |
2215 | + for (TimedTransition timedTransition : tapn.transitions()) { |
2216 | + if(!processedSharedObjects.contains(timedTransition.name())){ |
2217 | + |
2218 | + // CAUTION: This if statement removes orphan transitions. |
2219 | + // This changes answers for e.g. DEADLOCK queries if |
2220 | + // support for such queries are added later. |
2221 | + // ONLY THE IF SENTENCE SHOULD BE REMOVED. REST OF CODE SHOULD BE LEFT INTACT |
2222 | + if(!timedTransition.isOrphan()){ |
2223 | + String uniqueTransitionName = ""; |
2224 | + if (model.activeTemplates().size() > 1) { |
2225 | + uniqueTransitionName = ( ! timedTransition.isShared()) ? timedTransition.model().name() + "_" + timedTransition.name() : "Shared_" + timedTransition.name(); |
2226 | + } else { |
2227 | + uniqueTransitionName = timedTransition.name(); |
2228 | + } |
2229 | + |
2230 | + TimedTransition transition = new TimedTransition(uniqueTransitionName, timedTransition.isUrgent()); |
2231 | + constructedModel.add(transition); |
2232 | + Transition oldTransition = currentGuiModel.getTransitionByName(timedTransition.name()); |
2233 | + TimedTransitionComponent newTransition = new TimedTransitionComponent( |
2234 | + oldTransition.getPositionX() + offset.value1() * greatestWidth, |
2235 | + oldTransition.getPositionY() + offset.value2() * greatestHeight, |
2236 | + oldTransition.getId(), |
2237 | + uniqueTransitionName, |
2238 | + oldTransition.getNameOffsetX(), |
2239 | + oldTransition.getNameOffsetY(), |
2240 | + true, |
2241 | + false, |
2242 | + oldTransition.getAngle(), |
2243 | + 0); |
2244 | + newTransition.setGuiModel(guiModel); |
2245 | + newTransition.setUnderlyingTransition(transition); |
2246 | + newTransition.setName(uniqueTransitionName); |
2247 | + guiModel.addTransition(newTransition); |
2248 | + |
2249 | + if(timedTransition.isShared()){ |
2250 | + String name = timedTransition.sharedTransition().name(); |
2251 | + processedSharedObjects.add(name); |
2252 | + mapping.addMappingForShared(name, uniqueTransitionName); |
2253 | + }else{ |
2254 | + mapping.addMapping(tapn.name(), timedTransition.name(), uniqueTransitionName); |
2255 | + } |
2256 | + }else{ |
2257 | + if(!hasShownMessage){ |
2258 | + messenger.displayInfoMessage("There are orphan transitions (no incoming and no outgoing arcs) in the model." |
2259 | + + System.getProperty("line.separator") + "They will be removed before the verification."); |
2260 | + hasShownMessage = true; |
2261 | + } |
2262 | + } |
2263 | + } |
2264 | + } |
2265 | + i++; |
2266 | + } |
2267 | + } |
2268 | + |
2269 | + private String getUniqueTransitionName() { |
2270 | + nextTransitionIndex++; |
2271 | + return String.format(TRANSITION_FORMAT, nextTransitionIndex); |
2272 | + } |
2273 | + |
2274 | + private ArcPath createArcPath(DataLayer currentGuiModel, PlaceTransitionObject source, PlaceTransitionObject target, Arc arc, double offsetX, double offsetY) { |
2275 | + Arc guiArc = currentGuiModel.getArcByEndpoints(source, target); |
2276 | + ArcPath arcPath = guiArc.getArcPath(); |
2277 | + int arcPathPointsNum = arcPath.getNumPoints(); |
2278 | + |
2279 | + // Build ArcPath |
2280 | + ArcPath newArcPath = new ArcPath(arc); |
2281 | + for(int k = 0; k < arcPathPointsNum; k++) { |
2282 | + ArcPathPoint point = arcPath.getArcPathPoint(k); |
2283 | + newArcPath.addPoint( |
2284 | + point.getPoint().x + offsetX, |
2285 | + point.getPoint().y + offsetY, |
2286 | + point.getPointType() |
2287 | + ); |
2288 | + } |
2289 | + |
2290 | + return newArcPath; |
2291 | + } |
2292 | + |
2293 | + private void createInputArcs(TimedArcPetriNetNetwork model, TimedArcPetriNet constructedModel, NameMapping mapping, DataLayer guiModel, double greatestWidth, double greatestHeight) { |
2294 | + int i = 0; |
2295 | + for (TimedArcPetriNet tapn : model.activeTemplates()) { |
2296 | + DataLayer currentGuiModel = this.guiModels.get(tapn); |
2297 | + Tuple<Integer, Integer> offset = this.calculateComponentPosition(i); |
2298 | + |
2299 | + for (TimedInputArc arc : tapn.inputArcs()) { |
2300 | + String sourceTemplate = arc.source().isShared() ? "" : tapn.name(); |
2301 | + TimedPlace source = constructedModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); |
2302 | + |
2303 | + String targetTemplate = arc.destination().isShared() ? "" : tapn.name(); |
2304 | + TimedTransition target = constructedModel.getTransitionByName(mapping.map(targetTemplate, arc.destination().name())); |
2305 | + |
2306 | + TimeInterval newInterval = new TimeInterval(arc.interval()); |
2307 | + newInterval.setLowerBound(new IntBound(newInterval.lowerBound().value())); |
2308 | + if (newInterval.upperBound() instanceof Bound.InfBound) { |
2309 | + newInterval.setUpperBound(newInterval.upperBound()); |
2310 | + } else { |
2311 | + newInterval.setUpperBound(new IntBound(newInterval.upperBound().value())); |
2312 | + } |
2313 | + TimedInputArc addedArc = new TimedInputArc(source, target, newInterval, arc.getWeight()); |
2314 | + constructedModel.add(addedArc); |
2315 | + |
2316 | + Place guiSource = guiModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); |
2317 | + Transition guiTarget = guiModel.getTransitionByName(mapping.map(targetTemplate, arc.destination().name())); |
2318 | + |
2319 | + Arc newArc = new TimedInputArcComponent(new TimedOutputArcComponent( |
2320 | + 0d, |
2321 | + 0d, |
2322 | + 0d, |
2323 | + 0d, |
2324 | + guiSource, |
2325 | + guiTarget, |
2326 | + arc.getWeight().value(), |
2327 | + mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(targetTemplate, arc.destination().name()), |
2328 | + false |
2329 | + )); |
2330 | + |
2331 | + // Build ArcPath |
2332 | + Place oldGuiSource = currentGuiModel.getPlaceByName(arc.source().name()); |
2333 | + Transition oldGuiTarget = currentGuiModel.getTransitionByName(arc.destination().name()); |
2334 | + ArcPath newArcPath = createArcPath(currentGuiModel, oldGuiSource, oldGuiTarget, newArc, offset.value1() * greatestWidth, offset.value2() * greatestHeight); |
2335 | + |
2336 | + // Set arcPath, guiModel and connectors |
2337 | + ((TimedInputArcComponent) newArc).setUnderlyingArc(addedArc); |
2338 | + newArc.setArcPath(newArcPath); |
2339 | + newArc.setGuiModel(guiModel); |
2340 | + newArc.updateArcPosition(); |
2341 | + guiModel.addPetriNetObject(newArc); |
2342 | + guiSource.addConnectFrom(newArc); |
2343 | + guiTarget.addConnectTo(newArc); |
2344 | + } |
2345 | + i++; |
2346 | + } |
2347 | + } |
2348 | + |
2349 | + private void createOutputArcs(TimedArcPetriNetNetwork model, TimedArcPetriNet constructedModel, NameMapping mapping, DataLayer guiModel, double greatestWidth, double greatestHeight) { |
2350 | + int i = 0; |
2351 | + for (TimedArcPetriNet tapn : model.activeTemplates()) { |
2352 | + DataLayer currentGuiModel = this.guiModels.get(tapn); |
2353 | + Tuple<Integer, Integer> offset = this.calculateComponentPosition(i); |
2354 | + |
2355 | + for (TimedOutputArc arc : tapn.outputArcs()) { |
2356 | + String sourceTemplate = arc.source().isShared() ? "" : tapn.name(); |
2357 | + TimedTransition source = constructedModel.getTransitionByName(mapping.map(sourceTemplate, arc.source().name())); |
2358 | + |
2359 | + String destinationTemplate = arc.destination().isShared() ? "" : tapn.name(); |
2360 | + TimedPlace target = constructedModel.getPlaceByName(mapping.map(destinationTemplate, arc.destination().name())); |
2361 | + |
2362 | + TimedOutputArc addedArc = new TimedOutputArc(source, target, arc.getWeight()); |
2363 | + constructedModel.add(addedArc); |
2364 | + |
2365 | + Transition guiSource = guiModel.getTransitionByName(mapping.map(sourceTemplate, arc.source().name())); |
2366 | + Place guiTarget = guiModel.getPlaceByName(mapping.map(destinationTemplate, arc.destination().name())); |
2367 | + |
2368 | + TimedOutputArcComponent newArc = new TimedOutputArcComponent( |
2369 | + 0d, |
2370 | + 0d, |
2371 | + 0d, |
2372 | + 0d, |
2373 | + guiModel.getTransitionByName(mapping.map(sourceTemplate, arc.source().name())), |
2374 | + guiModel.getPlaceByName(mapping.map(destinationTemplate, arc.destination().name())), |
2375 | + arc.getWeight().value(), |
2376 | + mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(destinationTemplate, arc.destination().name()), |
2377 | + false |
2378 | + ); |
2379 | + |
2380 | + // Build ArcPath |
2381 | + Transition oldGuiSource = currentGuiModel.getTransitionByName(arc.source().name()); |
2382 | + Place oldGuiTarget = currentGuiModel.getPlaceByName(arc.destination().name()); |
2383 | + ArcPath newArcPath = createArcPath(currentGuiModel, oldGuiSource, oldGuiTarget, newArc, offset.value1() * greatestWidth, offset.value2() * greatestHeight); |
2384 | + |
2385 | + // Set arcPath, guiModel and connectors |
2386 | + newArc.setUnderlyingArc(addedArc); |
2387 | + newArc.setArcPath(newArcPath); |
2388 | + newArc.setGuiModel(guiModel); |
2389 | + newArc.updateArcPosition(); |
2390 | + guiModel.addArc(newArc); |
2391 | + guiSource.addConnectTo(newArc); |
2392 | + guiTarget.addConnectFrom(newArc); |
2393 | + } |
2394 | + i++; |
2395 | + } |
2396 | + } |
2397 | + |
2398 | + private void createTransportArcs(TimedArcPetriNetNetwork model, TimedArcPetriNet constructedModel, NameMapping mapping, DataLayer guiModel, double greatestWidth, double greatestHeight) { |
2399 | + int i = 0; |
2400 | + int nextGroupNr = 0; |
2401 | + for (TimedArcPetriNet tapn : model.activeTemplates()) { |
2402 | + DataLayer currentGuiModel = this.guiModels.get(tapn); |
2403 | + Tuple<Integer, Integer> offset = this.calculateComponentPosition(i); |
2404 | + |
2405 | + for (TransportArc arc : tapn.transportArcs()) { |
2406 | + String sourceTemplate = arc.source().isShared() ? "" : tapn.name(); |
2407 | + String transitionTemplate = arc.transition().isShared() ? "" : tapn.name(); |
2408 | + String destinationTemplate = arc.destination().isShared() ? "" : tapn.name(); |
2409 | + |
2410 | + TimedPlace source = constructedModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); |
2411 | + TimedTransition transition = constructedModel.getTransitionByName(mapping.map(transitionTemplate, arc.transition().name())); |
2412 | + TimedPlace destination = constructedModel.getPlaceByName(mapping.map(destinationTemplate, arc.destination().name())); |
2413 | + |
2414 | + TimeInterval newInterval = new TimeInterval(arc.interval()); |
2415 | + newInterval.setLowerBound(new IntBound(newInterval.lowerBound().value())); |
2416 | + if (newInterval.upperBound() instanceof Bound.InfBound) { |
2417 | + newInterval.setUpperBound(newInterval.upperBound()); |
2418 | + } else { |
2419 | + newInterval.setUpperBound(new IntBound(newInterval.upperBound().value())); |
2420 | + } |
2421 | + TransportArc addedArc = new TransportArc(source, transition, destination, newInterval, arc.getWeight()); |
2422 | + constructedModel.add(addedArc); |
2423 | + |
2424 | + //Create input transport arc |
2425 | + Place guiSourceIn = guiModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); |
2426 | + Transition guiTargetIn = guiModel.getTransitionByName(mapping.map(transitionTemplate, arc.transition().name())); |
2427 | + |
2428 | + TimedTransportArcComponent newInArc = new TimedTransportArcComponent( |
2429 | + new TimedInputArcComponent(new TimedOutputArcComponent( |
2430 | + 0d, |
2431 | + 0d, |
2432 | + 0d, |
2433 | + 0d, |
2434 | + guiSourceIn, |
2435 | + guiTargetIn, |
2436 | + arc.getWeight().value(), |
2437 | + mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(transitionTemplate, arc.transition().name()), |
2438 | + false |
2439 | + )), |
2440 | + nextGroupNr, |
2441 | + true |
2442 | + ); |
2443 | + |
2444 | + // Build ArcPath |
2445 | + Place oldGuiSourceIn = currentGuiModel.getPlaceByName(arc.source().name()); |
2446 | + Transition oldGuiTargetIn = currentGuiModel.getTransitionByName(arc.transition().name()); |
2447 | + ArcPath newArcPathIn = createArcPath(currentGuiModel, oldGuiSourceIn, oldGuiTargetIn, newInArc, offset.value1() * greatestWidth, offset.value2() * greatestHeight); |
2448 | + |
2449 | + newInArc.setUnderlyingArc(addedArc); |
2450 | + newInArc.setArcPath(newArcPathIn); |
2451 | + newInArc.setGuiModel(guiModel); |
2452 | + newInArc.updateArcPosition(); |
2453 | + guiModel.addArc(newInArc); |
2454 | + |
2455 | + guiSourceIn.addConnectTo(newInArc); |
2456 | + guiTargetIn.addConnectFrom(newInArc); |
2457 | + |
2458 | + // Calculate the next group number for this transport arc |
2459 | + // By looking at the target of the newInArc -> a transition |
2460 | + // Then finding the largest existing group number of outgoing transport arcs from this transition |
2461 | + for (Object pt : newInArc.getTarget().getPostset()) { |
2462 | + if (pt instanceof TimedTransportArcComponent) { |
2463 | + if (((TimedTransportArcComponent) pt).getGroupNr() > nextGroupNr) { |
2464 | + nextGroupNr = ((TimedTransportArcComponent) pt).getGroupNr(); |
2465 | + } |
2466 | + } |
2467 | + } |
2468 | + |
2469 | + ((TimedTransportArcComponent) newInArc).setGroupNr(nextGroupNr + 1); |
2470 | + |
2471 | + //Create output transport arc |
2472 | + Transition guiSourceOut = guiModel.getTransitionByName(mapping.map(transitionTemplate, arc.transition().name())); |
2473 | + Place guiTargetOut = guiModel.getPlaceByName(mapping.map(destinationTemplate, arc.destination().name())); |
2474 | + |
2475 | + TimedTransportArcComponent newOutArc = new TimedTransportArcComponent( |
2476 | + new TimedInputArcComponent(new TimedOutputArcComponent( |
2477 | + 0d, |
2478 | + 0d, |
2479 | + 0d, |
2480 | + 0d, |
2481 | + guiSourceOut, |
2482 | + guiTargetOut, |
2483 | + 1, |
2484 | + mapping.map(transitionTemplate, arc.transition().name()) + "_to_" + mapping.map(destinationTemplate, arc.destination().name()), |
2485 | + false |
2486 | + )), |
2487 | + nextGroupNr + 1, |
2488 | + false |
2489 | + ); |
2490 | + |
2491 | + // Build ArcPath |
2492 | + Transition oldGuiSourceOut = currentGuiModel.getTransitionByName(arc.transition().name()); |
2493 | + Place oldGuiTargetOut = currentGuiModel.getPlaceByName(arc.destination().name()); |
2494 | + ArcPath newArcPathOut = createArcPath(currentGuiModel, oldGuiSourceOut, oldGuiTargetOut, newOutArc, offset.value1() * greatestWidth, offset.value2() * greatestHeight); |
2495 | + |
2496 | + newOutArc.setUnderlyingArc(addedArc); |
2497 | + newOutArc.setArcPath(newArcPathOut); |
2498 | + newOutArc.setGuiModel(guiModel); |
2499 | + newOutArc.updateArcPosition(); |
2500 | + guiModel.addArc(newOutArc); |
2501 | + |
2502 | + // Add connection references to the two transport arcs |
2503 | + newInArc.setConnectedTo(newOutArc); |
2504 | + newOutArc.setConnectedTo(newInArc); |
2505 | + |
2506 | + guiSourceOut.addConnectTo(newOutArc); |
2507 | + guiTargetOut.addConnectFrom(newOutArc); |
2508 | + } |
2509 | + i++; |
2510 | + } |
2511 | + } |
2512 | + |
2513 | + |
2514 | + |
2515 | + private void createInhibitorArcs(TimedArcPetriNetNetwork model, TimedArcPetriNet constructedModel, NameMapping mapping, DataLayer guiModel, double greatestWidth, double greatestHeight) { |
2516 | + int i = 0; |
2517 | + for (TimedArcPetriNet tapn : model.activeTemplates()) { |
2518 | + DataLayer currentGuiModel = this.guiModels.get(tapn); |
2519 | + Tuple<Integer, Integer> offset = this.calculateComponentPosition(i); |
2520 | + |
2521 | + for (TimedInhibitorArc arc : tapn.inhibitorArcs()) { |
2522 | + String sourceTemplate = arc.source().isShared() ? "" : tapn.name(); |
2523 | + String destinationTemplate = arc.destination().isShared() ? "" : tapn.name(); |
2524 | + |
2525 | + TimedPlace source = constructedModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); |
2526 | + TimedTransition target = constructedModel.getTransitionByName(mapping.map(destinationTemplate, arc.destination().name())); |
2527 | + |
2528 | + TimeInterval newInterval = new TimeInterval(arc.interval()); |
2529 | + newInterval.setLowerBound(new IntBound(newInterval.lowerBound().value())); |
2530 | + if (newInterval.upperBound() instanceof Bound.InfBound) { |
2531 | + newInterval.setUpperBound(newInterval.upperBound()); |
2532 | + } else { |
2533 | + newInterval.setUpperBound(new IntBound(newInterval.upperBound().value())); |
2534 | + } |
2535 | + TimedInhibitorArc addedArc = new TimedInhibitorArc(source, target, newInterval, arc.getWeight()); |
2536 | + constructedModel.add(addedArc); |
2537 | + |
2538 | + Place guiSource = guiModel.getPlaceByName(mapping.map(sourceTemplate, arc.source().name())); |
2539 | + Transition guiTarget = guiModel.getTransitionByName(mapping.map(destinationTemplate, arc.destination().name())); |
2540 | + Arc newArc = new TimedInhibitorArcComponent(new TimedOutputArcComponent( |
2541 | + 0d, |
2542 | + 0d, |
2543 | + 0d, |
2544 | + 0d, |
2545 | + guiSource, |
2546 | + guiTarget, |
2547 | + arc.getWeight().value(), |
2548 | + mapping.map(sourceTemplate, arc.source().name()) + "_to_" + mapping.map(destinationTemplate, arc.destination().name()), |
2549 | + false |
2550 | + ), ""); |
2551 | + |
2552 | + // Build ArcPath |
2553 | + Place oldGuiSource = currentGuiModel.getPlaceByName(arc.source().name()); |
2554 | + Transition oldGuiTarget = currentGuiModel.getTransitionByName(arc.destination().name()); |
2555 | + ArcPath newArcPath = createArcPath(currentGuiModel, oldGuiSource, oldGuiTarget, newArc, offset.value1() * greatestWidth, offset.value2() * greatestHeight); |
2556 | + |
2557 | + ((TimedInhibitorArcComponent) newArc).setUnderlyingArc(addedArc); |
2558 | + newArc.setArcPath(newArcPath); |
2559 | + newArc.setGuiModel(guiModel); |
2560 | + newArc.updateArcPosition(); |
2561 | + guiModel.addPetriNetObject(newArc); |
2562 | + guiSource.addConnectTo(newArc); |
2563 | + guiTarget.addConnectFrom(newArc); |
2564 | + } |
2565 | + i++; |
2566 | + } |
2567 | + } |
2568 | +} |
2569 | |
2570 | === modified file 'src/dk/aau/cs/verification/UPPAAL/Verifyta.java' |
2571 | --- src/dk/aau/cs/verification/UPPAAL/Verifyta.java 2014-02-25 12:29:17 +0000 |
2572 | +++ src/dk/aau/cs/verification/UPPAAL/Verifyta.java 2014-05-28 18:52:41 +0000 |
2573 | @@ -10,6 +10,7 @@ |
2574 | import java.util.regex.Pattern; |
2575 | |
2576 | import net.tapaal.Preferences; |
2577 | +import pipe.dataLayer.TAPNQuery.SearchOption; |
2578 | import pipe.dataLayer.TAPNQuery.TraceOption; |
2579 | import pipe.gui.FileFinder; |
2580 | import pipe.gui.FileFinderImpl; |
2581 | @@ -285,6 +286,10 @@ |
2582 | } |
2583 | } |
2584 | |
2585 | + if (((VerifytaOptions) options).traceOption() == TraceOption.SOME && ((VerifytaOptions) options).symmetry() == true) { |
2586 | + return false; |
2587 | + } |
2588 | + |
2589 | return true; |
2590 | } |
2591 | |
2592 | @@ -363,7 +368,7 @@ |
2593 | UppaalTrace trace = traceParser.parseTrace(new BufferedReader(new StringReader(output)), (VerifytaOptions) options); |
2594 | |
2595 | if (trace == null) { |
2596 | - if (((VerifytaOptions) options).trace() != TraceOption.NONE) { |
2597 | + if (((VerifytaOptions) options).traceOption() != TraceOption.NONE) { |
2598 | if((query.getProperty() instanceof TCTLEFNode && !queryResult.isQuerySatisfied()) || (query.getProperty() instanceof TCTLAGNode && queryResult.isQuerySatisfied()) || |
2599 | (query.getProperty() instanceof TCTLEGNode && !queryResult.isQuerySatisfied()) || (query.getProperty() instanceof TCTLAFNode && queryResult.isQuerySatisfied())) |
2600 | return null; |
2601 | |
2602 | === modified file 'src/dk/aau/cs/verification/UPPAAL/VerifytaOptions.java' |
2603 | --- src/dk/aau/cs/verification/UPPAAL/VerifytaOptions.java 2013-06-25 20:49:54 +0000 |
2604 | +++ src/dk/aau/cs/verification/UPPAAL/VerifytaOptions.java 2014-05-28 18:52:41 +0000 |
2605 | @@ -15,27 +15,33 @@ |
2606 | private ReductionOption reduction; |
2607 | private boolean symmetry; |
2608 | private boolean useOverApproximation; |
2609 | + private boolean enableOverApproximation; |
2610 | + private boolean enableUnderApproximation; |
2611 | + private int approximationDenominator; |
2612 | |
2613 | private static final Map<TraceOption, String> traceMap = createTraceOptionsMap(); |
2614 | private static final Map<SearchOption, String> searchMap = createSearchOptionsMap(); |
2615 | |
2616 | public VerifytaOptions(TraceOption trace, SearchOption search, |
2617 | - boolean untimedTrace, ReductionOption reduction, boolean symmetry, boolean useOverApproximation) { |
2618 | + boolean untimedTrace, ReductionOption reduction, boolean symmetry, boolean useOverApproximation, boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2619 | traceOption = trace; |
2620 | searchOption = search; |
2621 | this.untimedTrace = untimedTrace; |
2622 | this.reduction = reduction; |
2623 | this.symmetry = symmetry; |
2624 | this.useOverApproximation = useOverApproximation; |
2625 | + this.enableOverApproximation = enableOverApproximation; |
2626 | + this.enableUnderApproximation = enableUnderApproximation; |
2627 | + this.approximationDenominator = approximationDenominator; |
2628 | } |
2629 | |
2630 | - public TraceOption trace() { |
2631 | - return traceOption; |
2632 | - } |
2633 | - |
2634 | public boolean symmetry() { |
2635 | return symmetry; |
2636 | } |
2637 | + |
2638 | + public void setSymmetry(boolean newOption) { |
2639 | + this.symmetry = newOption; |
2640 | + } |
2641 | |
2642 | @Override |
2643 | public String toString() { |
2644 | @@ -88,9 +94,28 @@ |
2645 | public TraceOption traceOption() { |
2646 | return traceOption; |
2647 | } |
2648 | + |
2649 | + public void setTraceOption(TraceOption option) { |
2650 | + traceOption = option; |
2651 | + } |
2652 | |
2653 | @Override |
2654 | public SearchOption searchOption() { |
2655 | return searchOption; |
2656 | } |
2657 | + |
2658 | + @Override |
2659 | + public boolean enableOverApproximation() { |
2660 | + return enableOverApproximation; |
2661 | + } |
2662 | + |
2663 | + @Override |
2664 | + public boolean enableUnderApproximation() { |
2665 | + return enableUnderApproximation; |
2666 | + } |
2667 | + |
2668 | + @Override |
2669 | + public int approximationDenominator() { |
2670 | + return approximationDenominator; |
2671 | + } |
2672 | } |
2673 | |
2674 | === modified file 'src/dk/aau/cs/verification/VerificationOptions.java' |
2675 | --- src/dk/aau/cs/verification/VerificationOptions.java 2013-06-25 20:49:54 +0000 |
2676 | +++ src/dk/aau/cs/verification/VerificationOptions.java 2014-05-28 18:52:41 +0000 |
2677 | @@ -2,6 +2,7 @@ |
2678 | |
2679 | import pipe.dataLayer.TAPNQuery.SearchOption; |
2680 | import pipe.dataLayer.TAPNQuery.TraceOption; |
2681 | +import pipe.gui.widgets.InclusionPlaces; |
2682 | |
2683 | public interface VerificationOptions { |
2684 | // Probably need something like this in reality, but for now we dont need it |
2685 | @@ -11,7 +12,11 @@ |
2686 | |
2687 | String toString(); |
2688 | boolean useOverApproximation(); |
2689 | + boolean enableOverApproximation(); |
2690 | + boolean enableUnderApproximation(); |
2691 | + int approximationDenominator(); |
2692 | int extraTokens(); |
2693 | TraceOption traceOption(); |
2694 | + void setTraceOption(TraceOption option); |
2695 | SearchOption searchOption(); |
2696 | } |
2697 | |
2698 | === modified file 'src/dk/aau/cs/verification/VerificationResult.java' |
2699 | --- src/dk/aau/cs/verification/VerificationResult.java 2014-03-16 19:13:22 +0000 |
2700 | +++ src/dk/aau/cs/verification/VerificationResult.java 2014-05-28 18:52:41 +0000 |
2701 | @@ -110,6 +110,14 @@ |
2702 | return queryResult; |
2703 | } |
2704 | |
2705 | + public void setTrace(TTrace newTrace){ |
2706 | + trace = newTrace; |
2707 | + } |
2708 | + |
2709 | + public void setSecondaryTrace(TTrace newTrace){ |
2710 | + secondaryTrace = newTrace; |
2711 | + } |
2712 | + |
2713 | public TTrace getTrace() { |
2714 | return trace; |
2715 | } |
2716 | |
2717 | === modified file 'src/dk/aau/cs/verification/VerifyTAPN/VerifyDTAPNOptions.java' |
2718 | --- src/dk/aau/cs/verification/VerifyTAPN/VerifyDTAPNOptions.java 2014-02-19 18:31:29 +0000 |
2719 | +++ src/dk/aau/cs/verification/VerifyTAPN/VerifyDTAPNOptions.java 2014-05-28 18:52:41 +0000 |
2720 | @@ -16,36 +16,41 @@ |
2721 | |
2722 | public VerifyDTAPNOptions(int extraTokens, TraceOption traceOption, |
2723 | SearchOption search, boolean symmetry, boolean gcd, boolean timeDarts, |
2724 | - boolean pTrie, WorkflowMode workflowMode) { |
2725 | - this(extraTokens, traceOption, search, symmetry, gcd, timeDarts, pTrie, false); |
2726 | + boolean pTrie, WorkflowMode workflowMode, |
2727 | + boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2728 | + this(extraTokens, traceOption, search, symmetry, gcd, timeDarts, pTrie, false, enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2729 | this.workflow = workflowMode; |
2730 | } |
2731 | |
2732 | public VerifyDTAPNOptions(int extraTokens, TraceOption traceOption, |
2733 | SearchOption search, boolean symmetry, boolean gcd, boolean timeDarts, |
2734 | - boolean pTrie, boolean useOverApproximation) { |
2735 | - this(extraTokens, traceOption, search, symmetry, gcd, timeDarts, pTrie, useOverApproximation, false, new InclusionPlaces(), WorkflowMode.NOT_WORKFLOW); |
2736 | + boolean pTrie, boolean useOverApproximation, |
2737 | + boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2738 | + this(extraTokens, traceOption, search, symmetry, gcd, timeDarts, pTrie, useOverApproximation, false, new InclusionPlaces(), WorkflowMode.NOT_WORKFLOW, enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2739 | } |
2740 | |
2741 | //Only used for boundedness analysis |
2742 | public VerifyDTAPNOptions(boolean dontUseDeadPlaces, int extraTokens, TraceOption traceOption, |
2743 | SearchOption search, boolean symmetry, boolean timeDarts, |
2744 | - boolean pTrie) { |
2745 | - this(extraTokens, traceOption, search, symmetry, true, timeDarts, pTrie, false, false, new InclusionPlaces(), WorkflowMode.NOT_WORKFLOW); |
2746 | + boolean pTrie, |
2747 | + boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2748 | + this(extraTokens, traceOption, search, symmetry, true, timeDarts, pTrie, false, false, new InclusionPlaces(), WorkflowMode.NOT_WORKFLOW, enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2749 | this.dontUseDeadPlaces = dontUseDeadPlaces; |
2750 | } |
2751 | |
2752 | public VerifyDTAPNOptions(int extraTokens, TraceOption traceOption, |
2753 | SearchOption search, boolean symmetry, boolean discreteInclusion, boolean gcd, |
2754 | - boolean timeDarts, boolean pTrie, boolean useOverApproximation) { |
2755 | - this(extraTokens, traceOption, search, symmetry, gcd, timeDarts, pTrie, useOverApproximation, discreteInclusion, new InclusionPlaces(), WorkflowMode.NOT_WORKFLOW); |
2756 | + boolean timeDarts, boolean pTrie, boolean useOverApproximation, |
2757 | + boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2758 | + this(extraTokens, traceOption, search, symmetry, gcd, timeDarts, pTrie, useOverApproximation, discreteInclusion, new InclusionPlaces(), WorkflowMode.NOT_WORKFLOW, enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2759 | } |
2760 | |
2761 | public VerifyDTAPNOptions(int extraTokens, TraceOption traceOption, |
2762 | SearchOption search, boolean symmetry, boolean gcd, boolean timeDarts, |
2763 | boolean pTrie, boolean useOverApproximation, boolean discreteInclusion, |
2764 | - InclusionPlaces inclusionPlaces, WorkflowMode workflow) { |
2765 | - super(extraTokens, traceOption, search, symmetry, useOverApproximation, discreteInclusion, inclusionPlaces); |
2766 | + InclusionPlaces inclusionPlaces, WorkflowMode workflow, |
2767 | + boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2768 | + super(extraTokens, traceOption, search, symmetry, useOverApproximation, discreteInclusion, inclusionPlaces, enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2769 | this.timeDarts = timeDarts; |
2770 | this.pTrie = pTrie; |
2771 | this.workflow = workflow; |
2772 | |
2773 | === modified file 'src/dk/aau/cs/verification/VerifyTAPN/VerifyPNOptions.java' |
2774 | --- src/dk/aau/cs/verification/VerifyTAPN/VerifyPNOptions.java 2014-02-25 11:36:28 +0000 |
2775 | +++ src/dk/aau/cs/verification/VerifyTAPN/VerifyPNOptions.java 2014-05-28 18:52:41 +0000 |
2776 | @@ -12,13 +12,13 @@ |
2777 | private static final Map<SearchOption, String> searchMap = createSearchOptionsMap(); |
2778 | private ModelReduction modelReduction; |
2779 | |
2780 | - public VerifyPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean useOverApproximation, ModelReduction modelReduction) { |
2781 | - super(extraTokens, traceOption, search, true, useOverApproximation, false, new InclusionPlaces()); |
2782 | + public VerifyPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean useOverApproximation, ModelReduction modelReduction, boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2783 | + super(extraTokens, traceOption, search, true, useOverApproximation, false, new InclusionPlaces(), enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2784 | this.modelReduction = modelReduction; |
2785 | } |
2786 | |
2787 | - public VerifyPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean useOverApproximation, boolean useModelReduction) { |
2788 | - this(extraTokens, traceOption, search, useOverApproximation, useModelReduction? ModelReduction.AGGRESSIVE:ModelReduction.NO_REDUCTION); |
2789 | + public VerifyPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean useOverApproximation, boolean useModelReduction, boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2790 | + this(extraTokens, traceOption, search, useOverApproximation, useModelReduction? ModelReduction.AGGRESSIVE:ModelReduction.NO_REDUCTION, enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2791 | } |
2792 | |
2793 | @Override |
2794 | |
2795 | === modified file 'src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNExporter.java' |
2796 | --- src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNExporter.java 2013-11-25 14:26:43 +0000 |
2797 | +++ src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNExporter.java 2014-05-28 18:52:41 +0000 |
2798 | @@ -42,11 +42,11 @@ |
2799 | |
2800 | VerifyTAPNOptions options = null; |
2801 | if(dataLayerQuery == null){ |
2802 | - options = new VerifyTAPNOptions(query.getExtraTokens(), TraceOption.NONE, SearchOption.HEURISTIC, true, true); |
2803 | + options = new VerifyTAPNOptions(query.getExtraTokens(), TraceOption.NONE, SearchOption.HEURISTIC, true, true, false, false, 1); |
2804 | }else if(dataLayerQuery.getReductionOption() == ReductionOption.VerifyTAPNdiscreteVerification){ |
2805 | - options = new VerifyDTAPNOptions(dataLayerQuery.getCapacity()+model.getNumberOfTokensInNet(), dataLayerQuery.getTraceOption(), dataLayerQuery.getSearchOption(),dataLayerQuery.useSymmetry(), dataLayerQuery.useGCD(), dataLayerQuery.useTimeDarts(), dataLayerQuery.usePTrie(), dataLayerQuery.useOverApproximation()); |
2806 | + options = new VerifyDTAPNOptions(dataLayerQuery.getCapacity()+model.getNumberOfTokensInNet(), dataLayerQuery.getTraceOption(), dataLayerQuery.getSearchOption(),dataLayerQuery.useSymmetry(), dataLayerQuery.useGCD(), dataLayerQuery.useTimeDarts(), dataLayerQuery.usePTrie(), dataLayerQuery.useOverApproximation(), dataLayerQuery.isOverApproximationEnabled(), dataLayerQuery.isUnderApproximationEnabled(), dataLayerQuery.approximationDenominator()); |
2807 | } else { |
2808 | - options = new VerifyTAPNOptions(dataLayerQuery.getCapacity()+model.getNumberOfTokensInNet(), dataLayerQuery.getTraceOption(), dataLayerQuery.getSearchOption(),dataLayerQuery.useSymmetry(), dataLayerQuery.useOverApproximation()); |
2809 | + options = new VerifyTAPNOptions(dataLayerQuery.getCapacity()+model.getNumberOfTokensInNet(), dataLayerQuery.getTraceOption(), dataLayerQuery.getSearchOption(),dataLayerQuery.useSymmetry(), dataLayerQuery.useOverApproximation(), dataLayerQuery.isOverApproximationEnabled(), dataLayerQuery.isUnderApproximationEnabled(), dataLayerQuery.approximationDenominator()); |
2810 | } |
2811 | } catch(FileNotFoundException e) { |
2812 | System.err.append("An error occurred while exporting the model to verifytapn. Verification cancelled."); |
2813 | |
2814 | === modified file 'src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNIconSelector.java' |
2815 | --- src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNIconSelector.java 2013-12-05 13:46:06 +0000 |
2816 | +++ src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNIconSelector.java 2014-05-28 18:52:41 +0000 |
2817 | @@ -11,6 +11,8 @@ |
2818 | |
2819 | @Override |
2820 | public ImageIcon getIconFor(VerificationResult<?> result) { |
2821 | + if (result.getQueryResult().isApproximationInconclusive()) |
2822 | + return rerunIcon; |
2823 | switch(result.getQueryResult().queryType()) |
2824 | { |
2825 | case EF: |
2826 | |
2827 | === modified file 'src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNOptions.java' |
2828 | --- src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNOptions.java 2013-10-02 20:25:38 +0000 |
2829 | +++ src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNOptions.java 2014-05-28 18:52:41 +0000 |
2830 | @@ -20,6 +20,9 @@ |
2831 | private boolean useOverApproximation; |
2832 | private boolean discreteInclusion; |
2833 | private InclusionPlaces inclusionPlaces; |
2834 | + private boolean enableOverApproximation; |
2835 | + private boolean enableUnderApproximation; |
2836 | + private int approximationDenominator; |
2837 | |
2838 | //only used for boundedness analysis |
2839 | private boolean dontUseDeadPlaces = false; |
2840 | @@ -27,21 +30,21 @@ |
2841 | private static final Map<TraceOption, String> traceMap = createTraceOptionsMap(); |
2842 | private static final Map<SearchOption, String> searchMap = createSearchOptionsMap(); |
2843 | |
2844 | - public VerifyTAPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation) { |
2845 | - this(extraTokens, traceOption, search, symmetry, useOverApproximation, false, new InclusionPlaces()); |
2846 | + public VerifyTAPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation, boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2847 | + this(extraTokens, traceOption, search, symmetry, useOverApproximation, false, new InclusionPlaces(), enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2848 | } |
2849 | |
2850 | //Only used for boundedness analysis |
2851 | - public VerifyTAPNOptions(boolean dontUseDeadPLaces, int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation) { |
2852 | - this(extraTokens, traceOption, search, symmetry, useOverApproximation, false, new InclusionPlaces()); |
2853 | + public VerifyTAPNOptions(boolean dontUseDeadPLaces, int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation, boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2854 | + this(extraTokens, traceOption, search, symmetry, useOverApproximation, false, new InclusionPlaces(), enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2855 | this.dontUseDeadPlaces = dontUseDeadPLaces; |
2856 | } |
2857 | |
2858 | - public VerifyTAPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation, boolean discreteInclusion) { |
2859 | - this(extraTokens,traceOption, search, symmetry, useOverApproximation, discreteInclusion, new InclusionPlaces()); |
2860 | + public VerifyTAPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation, boolean discreteInclusion, boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2861 | + this(extraTokens,traceOption, search, symmetry, useOverApproximation, discreteInclusion, new InclusionPlaces(), enableOverApproximation, enableUnderApproximation, approximationDenominator); |
2862 | } |
2863 | |
2864 | - public VerifyTAPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation, boolean discreteInclusion, InclusionPlaces inclusionPlaces) { |
2865 | + public VerifyTAPNOptions(int extraTokens, TraceOption traceOption, SearchOption search, boolean symmetry, boolean useOverApproximation, boolean discreteInclusion, InclusionPlaces inclusionPlaces, boolean enableOverApproximation, boolean enableUnderApproximation, int approximationDenominator) { |
2866 | this.extraTokens = extraTokens; |
2867 | this.traceOption = traceOption; |
2868 | searchOption = search; |
2869 | @@ -49,6 +52,9 @@ |
2870 | this.discreteInclusion = discreteInclusion; |
2871 | this.useOverApproximation = useOverApproximation; |
2872 | this.inclusionPlaces = inclusionPlaces; |
2873 | + this.enableOverApproximation = enableOverApproximation; |
2874 | + this.enableUnderApproximation = enableUnderApproximation; |
2875 | + this.approximationDenominator = approximationDenominator; |
2876 | } |
2877 | |
2878 | public TraceOption trace() { |
2879 | @@ -144,9 +150,28 @@ |
2880 | public TraceOption traceOption() { |
2881 | return traceOption; |
2882 | } |
2883 | + |
2884 | + public void setTraceOption(TraceOption option) { |
2885 | + traceOption = option; |
2886 | + } |
2887 | |
2888 | @Override |
2889 | public SearchOption searchOption() { |
2890 | return searchOption; |
2891 | } |
2892 | + |
2893 | + @Override |
2894 | + public boolean enableOverApproximation() { |
2895 | + return enableOverApproximation; |
2896 | + } |
2897 | + |
2898 | + @Override |
2899 | + public boolean enableUnderApproximation() { |
2900 | + return enableUnderApproximation; |
2901 | + } |
2902 | + |
2903 | + @Override |
2904 | + public int approximationDenominator() { |
2905 | + return approximationDenominator; |
2906 | + } |
2907 | } |
2908 | |
2909 | === modified file 'src/dk/aau/cs/verification/batchProcessing/BatchProcessingVerificationOptions.java' |
2910 | --- src/dk/aau/cs/verification/batchProcessing/BatchProcessingVerificationOptions.java 2013-03-03 11:14:15 +0000 |
2911 | +++ src/dk/aau/cs/verification/batchProcessing/BatchProcessingVerificationOptions.java 2014-05-28 18:52:41 +0000 |
2912 | @@ -16,11 +16,17 @@ |
2913 | KeepQueryOption, Yes, No |
2914 | }; |
2915 | |
2916 | + public enum ApproximationMethodOption { |
2917 | + KeepQueryOption, None, OverApproximation, UnderApproximation |
2918 | + } |
2919 | + |
2920 | private List<ReductionOption> reductionOptions; |
2921 | private ReductionOption reductionOption; |
2922 | private SearchOption searchOption; |
2923 | private QueryPropertyOption queryPropertyOption; |
2924 | private SymmetryOption symmetryOption; |
2925 | + private ApproximationMethodOption approximationMethodOption; |
2926 | + private int approximationDenominator = 0; |
2927 | private boolean keepQueryCapacity; |
2928 | private int capacity; |
2929 | private boolean discreteInclusion = false; // only for VerifyTAPN |
2930 | @@ -29,7 +35,7 @@ |
2931 | private boolean usePTrie = false; |
2932 | |
2933 | public BatchProcessingVerificationOptions(QueryPropertyOption queryPropertyOption, boolean keepQueryCapacity, int capacity, SearchOption searchOption, SymmetryOption symmetryOption, ReductionOption reductionOption, boolean discreteInclusion, |
2934 | - boolean useTimeDartPTrie, boolean useTimeDart, boolean usePTrie, List<ReductionOption> reductionOptions) { |
2935 | + boolean useTimeDartPTrie, boolean useTimeDart, boolean usePTrie, ApproximationMethodOption approximationMethodOption, int approximationDenominator, List<ReductionOption> reductionOptions) { |
2936 | Require.that(!(reductionOptions == null && reductionOption == ReductionOption.BatchProcessingUserDefinedReductions), "ReductionOption was given as userdefined but a list of reductionoptions was not given"); |
2937 | this.searchOption = searchOption; |
2938 | this.reductionOption = reductionOption; |
2939 | @@ -42,11 +48,13 @@ |
2940 | this.useTimeDart = useTimeDart; |
2941 | this.usePTrie = usePTrie; |
2942 | this.reductionOptions = reductionOptions; |
2943 | + this.approximationMethodOption = approximationMethodOption; |
2944 | + this.approximationDenominator = approximationDenominator; |
2945 | } |
2946 | |
2947 | public BatchProcessingVerificationOptions(QueryPropertyOption queryPropertyOption, boolean keepQueryCapacity, int capacity, SearchOption searchOption, SymmetryOption symmetryOption, ReductionOption reductionOption, boolean discreteInclusion, |
2948 | - boolean useTimeDartPTrie, boolean useTimeDart, boolean usePTrie) { |
2949 | - this(queryPropertyOption, keepQueryCapacity, capacity, searchOption, symmetryOption, reductionOption, discreteInclusion, useTimeDartPTrie, useTimeDart, usePTrie, null); |
2950 | + boolean useTimeDartPTrie, boolean useTimeDart, boolean usePTrie, ApproximationMethodOption approximationMethodOption, int approximationRValue) { |
2951 | + this(queryPropertyOption, keepQueryCapacity, capacity, searchOption, symmetryOption, reductionOption, discreteInclusion, useTimeDartPTrie, useTimeDart, usePTrie, approximationMethodOption, approximationRValue, null); |
2952 | } |
2953 | |
2954 | public boolean isReductionOptionUserdefined(){ |
2955 | @@ -93,4 +101,12 @@ |
2956 | public int capacity() { |
2957 | return capacity; |
2958 | } |
2959 | + |
2960 | + public ApproximationMethodOption approximationMethodOption() { |
2961 | + return approximationMethodOption; |
2962 | + } |
2963 | + |
2964 | + public int approximationDenominator() { |
2965 | + return approximationDenominator; |
2966 | + } |
2967 | } |
2968 | |
2969 | === modified file 'src/dk/aau/cs/verification/batchProcessing/BatchProcessingWorker.java' |
2970 | --- src/dk/aau/cs/verification/batchProcessing/BatchProcessingWorker.java 2014-05-22 19:02:06 +0000 |
2971 | +++ src/dk/aau/cs/verification/batchProcessing/BatchProcessingWorker.java 2014-05-28 18:52:41 +0000 |
2972 | @@ -1,6 +1,7 @@ |
2973 | package dk.aau.cs.verification.batchProcessing; |
2974 | |
2975 | import java.io.File; |
2976 | +import java.math.BigDecimal; |
2977 | import java.util.ArrayList; |
2978 | import java.util.List; |
2979 | |
2980 | @@ -10,19 +11,33 @@ |
2981 | import pipe.dataLayer.TAPNQuery.TraceOption; |
2982 | import pipe.gui.FileFinderImpl; |
2983 | import pipe.gui.MessengerImpl; |
2984 | +import pipe.gui.widgets.InclusionPlaces; |
2985 | import dk.aau.cs.Messenger; |
2986 | import dk.aau.cs.TCTL.TCTLAGNode; |
2987 | import dk.aau.cs.TCTL.TCTLAbstractProperty; |
2988 | import dk.aau.cs.TCTL.TCTLTrueNode; |
2989 | import dk.aau.cs.TCTL.visitors.RenameAllPlacesVisitor; |
2990 | +import dk.aau.cs.approximation.ApproximationWorker; |
2991 | +import dk.aau.cs.approximation.OverApproximation; |
2992 | +import dk.aau.cs.approximation.UnderApproximation; |
2993 | import dk.aau.cs.gui.BatchProcessingDialog; |
2994 | import dk.aau.cs.gui.components.BatchProcessingResultsTableModel; |
2995 | import dk.aau.cs.io.batchProcessing.BatchProcessingModelLoader; |
2996 | import dk.aau.cs.io.batchProcessing.LoadedBatchProcessingModel; |
2997 | import dk.aau.cs.model.tapn.TAPNQuery; |
2998 | import dk.aau.cs.model.tapn.TimedArcPetriNet; |
2999 | +import dk.aau.cs.model.tapn.TimedInhibitorArc; |
3000 | +import dk.aau.cs.model.tapn.TimedInputArc; |
3001 | +import dk.aau.cs.model.tapn.TimedOutputArc; |
3002 | import dk.aau.cs.model.tapn.TimedPlace; |
3003 | +import dk.aau.cs.model.tapn.TimedToken; |
3004 | +import dk.aau.cs.model.tapn.TimedTransition; |
3005 | +import dk.aau.cs.model.tapn.TransportArc; |
3006 | +import dk.aau.cs.model.tapn.simulation.TAPNNetworkTrace; |
3007 | +import dk.aau.cs.model.tapn.simulation.TimeDelayStep; |
3008 | +import dk.aau.cs.model.tapn.simulation.TimedArcPetriNetStep; |
3009 | import dk.aau.cs.model.tapn.simulation.TimedArcPetriNetTrace; |
3010 | +import dk.aau.cs.model.tapn.simulation.TimedTransitionStep; |
3011 | import dk.aau.cs.translations.ReductionOption; |
3012 | import dk.aau.cs.util.MemoryMonitor; |
3013 | import dk.aau.cs.util.Require; |
3014 | @@ -30,6 +45,7 @@ |
3015 | import dk.aau.cs.util.UnsupportedModelException; |
3016 | import dk.aau.cs.util.UnsupportedQueryException; |
3017 | import dk.aau.cs.verification.Boundedness; |
3018 | +import dk.aau.cs.verification.ITAPNComposer; |
3019 | import dk.aau.cs.verification.ModelChecker; |
3020 | import dk.aau.cs.verification.NameMapping; |
3021 | import dk.aau.cs.verification.NullStats; |
3022 | @@ -37,6 +53,7 @@ |
3023 | import dk.aau.cs.verification.QueryType; |
3024 | import dk.aau.cs.verification.Stats; |
3025 | import dk.aau.cs.verification.TAPNComposer; |
3026 | +import dk.aau.cs.verification.TAPNTraceDecomposer; |
3027 | import dk.aau.cs.verification.VerificationOptions; |
3028 | import dk.aau.cs.verification.VerificationResult; |
3029 | import dk.aau.cs.verification.UPPAAL.Verifyta; |
3030 | @@ -47,6 +64,7 @@ |
3031 | import dk.aau.cs.verification.VerifyTAPN.VerifyTAPN; |
3032 | import dk.aau.cs.verification.VerifyTAPN.VerifyTAPNDiscreteVerification; |
3033 | import dk.aau.cs.verification.VerifyTAPN.VerifyTAPNOptions; |
3034 | +import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationOptions.ApproximationMethodOption; |
3035 | import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationOptions.QueryPropertyOption; |
3036 | import dk.aau.cs.verification.batchProcessing.BatchProcessingVerificationOptions.SymmetryOption; |
3037 | |
3038 | @@ -62,7 +80,9 @@ |
3039 | private boolean timeoutCurrentVerification = false; |
3040 | private boolean oomCurrentVerification = false; |
3041 | private int verificationTasksCompleted; |
3042 | - |
3043 | + private LoadedBatchProcessingModel model; |
3044 | + |
3045 | + |
3046 | public BatchProcessingWorker(List<File> files, BatchProcessingResultsTableModel tableModel, BatchProcessingVerificationOptions batchProcessingVerificationOptions) { |
3047 | super(); |
3048 | this.files = files; |
3049 | @@ -107,17 +127,18 @@ |
3050 | |
3051 | fireFileChanged(file.getName()); |
3052 | LoadedBatchProcessingModel model = loadModel(file); |
3053 | - if(model != null) { |
3054 | - Tuple<TimedArcPetriNet, NameMapping> composedModel = composeModel(model); |
3055 | - |
3056 | + this.model = model; |
3057 | + if(model != null) { |
3058 | for(pipe.dataLayer.TAPNQuery query : model.queries()) { |
3059 | - if(exiting()) { |
3060 | - return null; |
3061 | - } |
3062 | + if(exiting()) { |
3063 | + return null; |
3064 | + } |
3065 | + Tuple<TimedArcPetriNet, NameMapping> composedModel = composeModel(model); |
3066 | + |
3067 | pipe.dataLayer.TAPNQuery queryToVerify = overrideVerificationOptions(composedModel.value1(), query); |
3068 | |
3069 | if (batchProcessingVerificationOptions.isReductionOptionUserdefined()){ |
3070 | - processQueryForUserdefinedReductions(file,composedModel, queryToVerify); |
3071 | + processQueryForUserdefinedReductions(file, composedModel, queryToVerify); |
3072 | } else { |
3073 | processQuery(file, composedModel, queryToVerify); |
3074 | } |
3075 | @@ -236,8 +257,24 @@ |
3076 | boolean symmetry = batchProcessingVerificationOptions.symmetry() == SymmetryOption.KeepQueryOption ? query.useSymmetry() : getSymmetryFromBatchProcessingOptions(); |
3077 | int capacity = batchProcessingVerificationOptions.KeepCapacityFromQuery() ? query.getCapacity() : batchProcessingVerificationOptions.capacity(); |
3078 | String name = batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.KeepQueryOption ? query.getName() : "Search Whole State Space"; |
3079 | + boolean overApproximation = query.isOverApproximationEnabled(); |
3080 | + boolean underApproximation = query.isUnderApproximationEnabled(); |
3081 | + int approximationDenominator = query.approximationDenominator(); |
3082 | + if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.None) { |
3083 | + overApproximation = false; |
3084 | + underApproximation = false; |
3085 | + } else if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.OverApproximation) { |
3086 | + overApproximation = true; |
3087 | + underApproximation = false; |
3088 | + } else if (batchProcessingVerificationOptions.approximationMethodOption() == ApproximationMethodOption.UnderApproximation) { |
3089 | + overApproximation = false; |
3090 | + underApproximation = true; |
3091 | + } |
3092 | + if (batchProcessingVerificationOptions.approximationDenominator() != 0) { |
3093 | + approximationDenominator = batchProcessingVerificationOptions.approximationDenominator(); |
3094 | + } |
3095 | |
3096 | - 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()); |
3097 | + 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); |
3098 | |
3099 | if(batchProcessingVerificationOptions.queryPropertyOption() == QueryPropertyOption.KeepQueryOption) |
3100 | changedQuery.setActive(query.isActive()); |
3101 | @@ -253,7 +290,7 @@ |
3102 | } |
3103 | |
3104 | private Tuple<TimedArcPetriNet, NameMapping> composeModel(LoadedBatchProcessingModel model) { |
3105 | - TAPNComposer composer = new TAPNComposer(new Messenger(){ |
3106 | + ITAPNComposer composer = new TAPNComposer(new Messenger(){ |
3107 | public void displayInfoMessage(String message) { } |
3108 | public void displayInfoMessage(String message, String title) {} |
3109 | public void displayErrorMessage(String message) {} |
3110 | @@ -295,16 +332,24 @@ |
3111 | publishResult(file.getName(), query, "Skipped - due to OOM", verificationResult.verificationTime(), new NullStats()); |
3112 | oomCurrentVerification = false; |
3113 | } else if(!verificationResult.error()) { |
3114 | - String queryResult = verificationResult.getQueryResult().isQuerySatisfied() ? "Satisfied" : "Not Satisfied"; |
3115 | - if (query.discreteInclusion() && !verificationResult.isBounded() && |
3116 | - ((query.queryType().equals(QueryType.EF) && !verificationResult.getQueryResult().isQuerySatisfied()) |
3117 | - || |
3118 | - (query.queryType().equals(QueryType.AG) && verificationResult.getQueryResult().isQuerySatisfied()))) |
3119 | - {queryResult = "Inconclusive answer";} |
3120 | + String queryResult = ""; |
3121 | + if (verificationResult.getQueryResult().isApproximationInconclusive()) |
3122 | + { |
3123 | + queryResult = "Inconclusive"; |
3124 | + } |
3125 | + else |
3126 | + { |
3127 | + queryResult = verificationResult.getQueryResult().isQuerySatisfied() ? "Satisfied" : "Not Satisfied"; |
3128 | + } |
3129 | + if (query.discreteInclusion() && !verificationResult.isBounded() && |
3130 | + ((query.queryType().equals(QueryType.EF) && !verificationResult.getQueryResult().isQuerySatisfied()) |
3131 | + || |
3132 | + (query.queryType().equals(QueryType.AG) && verificationResult.getQueryResult().isQuerySatisfied()))) |
3133 | + {queryResult = "Inconclusive";} |
3134 | if(query.getReductionOption().equals(ReductionOption.VerifyPNApprox) && |
3135 | ((query.queryType().equals(QueryType.EF) && verificationResult.getQueryResult().isQuerySatisfied()) || |
3136 | (query.queryType().equals(QueryType.AG) && !verificationResult.getQueryResult().isQuerySatisfied()))){ |
3137 | - queryResult = "Inconclusive answer"; |
3138 | + queryResult = "Inconclusive"; |
3139 | } |
3140 | publishResult(file.getName(), query, queryResult, verificationResult.verificationTime(), verificationResult.stats()); |
3141 | } else { |
3142 | @@ -317,15 +362,33 @@ |
3143 | publish(result); |
3144 | } |
3145 | |
3146 | - private VerificationResult<TimedArcPetriNetTrace> verify(Tuple<TimedArcPetriNet, NameMapping> composedModel, pipe.dataLayer.TAPNQuery query) throws Exception { |
3147 | + |
3148 | + private void renameTraceTransitions(TimedArcPetriNetTrace trace) { |
3149 | + if (trace != null) |
3150 | + trace.reduceTraceForOriginalNet("_traceNet_", "PTRACE"); |
3151 | + } |
3152 | + |
3153 | + private TAPNNetworkTrace decomposeTrace(TimedArcPetriNetTrace trace, NameMapping mapping) { |
3154 | + if (trace == null) |
3155 | + return null; |
3156 | + |
3157 | + TAPNTraceDecomposer decomposer = new TAPNTraceDecomposer(trace, model.network(), mapping); |
3158 | + return decomposer.decompose(); |
3159 | + } |
3160 | + |
3161 | + private VerificationResult<TimedArcPetriNetTrace> verify(Tuple<TimedArcPetriNet, NameMapping> composedModel, pipe.dataLayer.TAPNQuery query) throws Exception { |
3162 | TAPNQuery queryToVerify = getTAPNQuery(composedModel.value1(),query); |
3163 | MapQueryToNewNames(queryToVerify, composedModel.value2()); |
3164 | |
3165 | + TAPNQuery clonedQuery = new TAPNQuery(query.getProperty().copy(), queryToVerify.getExtraTokens()); |
3166 | + MapQueryToNewNames(clonedQuery, composedModel.value2()); |
3167 | + |
3168 | VerificationOptions options = getVerificationOptionsFromQuery(query); |
3169 | modelChecker = getModelChecker(query); |
3170 | fireVerificationTaskStarted(); |
3171 | - VerificationResult<TimedArcPetriNetTrace> verificationResult = modelChecker.verify(options, composedModel, queryToVerify); |
3172 | - return verificationResult; |
3173 | + |
3174 | + ApproximationWorker worker = new ApproximationWorker(); |
3175 | + return worker.batchWorker(composedModel, options, query, model, modelChecker, queryToVerify, clonedQuery, this); |
3176 | } |
3177 | |
3178 | private TAPNQuery getTAPNQuery(TimedArcPetriNet model, pipe.dataLayer.TAPNQuery query) throws Exception { |
3179 | @@ -353,13 +416,13 @@ |
3180 | |
3181 | private VerificationOptions getVerificationOptionsFromQuery(pipe.dataLayer.TAPNQuery query) { |
3182 | if(query.getReductionOption() == ReductionOption.VerifyTAPN) |
3183 | - return new VerifyTAPNOptions(query.getCapacity(), TraceOption.NONE, query.getSearchOption(), query.useSymmetry(), false, query.discreteInclusion(), query.inclusionPlaces()); // XXX DISABLES OverApprox |
3184 | + return new VerifyTAPNOptions(query.getCapacity(), TraceOption.NONE, query.getSearchOption(), query.useSymmetry(), false, query.discreteInclusion(), query.inclusionPlaces(), query.isOverApproximationEnabled(), query.isUnderApproximationEnabled(), query.approximationDenominator()); // XXX DISABLES OverApprox |
3185 | else if(query.getReductionOption() == ReductionOption.VerifyTAPNdiscreteVerification) |
3186 | - return new VerifyDTAPNOptions(query.getCapacity(), TraceOption.NONE, query.getSearchOption(), query.useSymmetry(), query.useGCD(), query.useTimeDarts(), query.usePTrie(), false, query.discreteInclusion(), query.inclusionPlaces(), query.getWorkflowMode()); |
3187 | + return new VerifyDTAPNOptions(query.getCapacity(), TraceOption.NONE, query.getSearchOption(), query.useSymmetry(), query.useGCD(), query.useTimeDarts(), query.usePTrie(), false, query.discreteInclusion(), query.inclusionPlaces(), query.getWorkflowMode(), query.isOverApproximationEnabled(), query.isUnderApproximationEnabled(), query.approximationDenominator()); |
3188 | else if(query.getReductionOption() == ReductionOption.VerifyPN || query.getReductionOption() == ReductionOption.VerifyPNApprox || query.getReductionOption() == ReductionOption.VerifyPNReduce) |
3189 | - return new VerifyPNOptions(query.getCapacity(), TraceOption.NONE, query.getSearchOption(), query.useOverApproximation(), query.useReduction()); |
3190 | + return new VerifyPNOptions(query.getCapacity(), TraceOption.NONE, query.getSearchOption(), query.useOverApproximation(), query.useReduction(), query.isOverApproximationEnabled(), query.isUnderApproximationEnabled(), query.approximationDenominator()); |
3191 | else |
3192 | - return new VerifytaOptions(TraceOption.NONE, query.getSearchOption(), false, query.getReductionOption(), query.useSymmetry(), false); |
3193 | + return new VerifytaOptions(TraceOption.NONE, query.getSearchOption(), false, query.getReductionOption(), query.useSymmetry(), false, query.isOverApproximationEnabled(), query.isUnderApproximationEnabled(), query.approximationDenominator()); |
3194 | } |
3195 | |
3196 | private void MapQueryToNewNames(TAPNQuery query, NameMapping mapping) { |
3197 | |
3198 | === modified file 'src/pipe/dataLayer/DataLayer.java' |
3199 | --- src/pipe/dataLayer/DataLayer.java 2011-09-25 09:35:57 +0000 |
3200 | +++ src/pipe/dataLayer/DataLayer.java 2014-05-28 18:52:41 +0000 |
3201 | @@ -665,7 +665,15 @@ |
3202 | return returnArray; |
3203 | } |
3204 | |
3205 | - |
3206 | + public Arc getArcByEndpoints(PlaceTransitionObject source, PlaceTransitionObject target) { |
3207 | + Arc returnArc = null; |
3208 | + for (Arc arc : arcsArray) { |
3209 | + if (arc.getSource() == source && arc.getTarget() == target) { |
3210 | + returnArc = arc; |
3211 | + } |
3212 | + } |
3213 | + return returnArc; |
3214 | + } |
3215 | |
3216 | /** |
3217 | * Return the Transition called transitionName from the Petri-Net |
3218 | |
3219 | === modified file 'src/pipe/dataLayer/TAPNQuery.java' |
3220 | --- src/pipe/dataLayer/TAPNQuery.java 2014-02-22 23:21:12 +0000 |
3221 | +++ src/pipe/dataLayer/TAPNQuery.java 2014-05-28 18:52:41 +0000 |
3222 | @@ -45,6 +45,10 @@ |
3223 | private WorkflowMode workflow; |
3224 | private boolean useReduction; |
3225 | |
3226 | + private boolean enableOverApproximation = false; |
3227 | + private boolean enableUnderApproximation = false; |
3228 | + private int denominator = 2; |
3229 | + |
3230 | private boolean discreteInclusion = false; // Only for VerifyTAPN |
3231 | |
3232 | private TCTLAbstractProperty property = null; |
3233 | @@ -64,6 +68,19 @@ |
3234 | public String getName() { |
3235 | return name; |
3236 | } |
3237 | + |
3238 | + public boolean isOverApproximationEnabled() { |
3239 | + return this.enableOverApproximation; |
3240 | + } |
3241 | + |
3242 | + public boolean isUnderApproximationEnabled() { |
3243 | + return this.enableUnderApproximation; |
3244 | + } |
3245 | + |
3246 | + |
3247 | + public int approximationDenominator() { |
3248 | + return this.denominator; |
3249 | + } |
3250 | |
3251 | public void setDiscreteInclusion(boolean value){ |
3252 | discreteInclusion = value; |
3253 | @@ -237,6 +254,14 @@ |
3254 | TraceOption traceOption, SearchOption searchOption, |
3255 | ReductionOption reductionOption, boolean symmetry, boolean gcd, boolean timeDart, boolean pTrie, boolean overApproximation, boolean reduction, HashTableSize hashTabelSize, |
3256 | ExtrapolationOption extrapolationOption, InclusionPlaces inclusionPlaces) { |
3257 | + this(name, capacity, property, traceOption, searchOption, reductionOption, symmetry, gcd, timeDart, pTrie, false, reduction, hashTabelSize, extrapolationOption, new InclusionPlaces(), false, false, 0); |
3258 | + } |
3259 | + |
3260 | + public TAPNQuery(String name, int capacity, TCTLAbstractProperty property, |
3261 | + TraceOption traceOption, SearchOption searchOption, |
3262 | + ReductionOption reductionOption, boolean symmetry, boolean gcd, boolean timeDart, boolean pTrie, boolean overApproximation, boolean reduction, HashTableSize hashTabelSize, |
3263 | + ExtrapolationOption extrapolationOption, InclusionPlaces inclusionPlaces, boolean enableOverApproximation, boolean enableUnderApproximation, |
3264 | + int approximationDenominator) { |
3265 | this.setName(name); |
3266 | this.setCapacity(capacity); |
3267 | this.property = property; |
3268 | @@ -252,8 +277,12 @@ |
3269 | this.setExtrapolationOption(extrapolationOption); |
3270 | this.inclusionPlaces = inclusionPlaces; |
3271 | this.useReduction = reduction; |
3272 | + this.enableOverApproximation = enableOverApproximation; |
3273 | + this.enableUnderApproximation = enableUnderApproximation; |
3274 | + this.denominator = approximationDenominator; |
3275 | } |
3276 | - |
3277 | + |
3278 | + |
3279 | @Override |
3280 | public String toString() { |
3281 | return getName(); |
3282 | @@ -286,7 +315,7 @@ |
3283 | } |
3284 | |
3285 | public TAPNQuery copy() { |
3286 | - TAPNQuery copy = new TAPNQuery(name, capacity, property.copy(), traceOption, searchOption, reductionOption, symmetry, gcd, timeDart, pTrie, overApproximation, useReduction, hashTableSize, extrapolationOption, inclusionPlaces); |
3287 | + TAPNQuery copy = new TAPNQuery(name, capacity, property.copy(), traceOption, searchOption, reductionOption, symmetry, gcd, timeDart, pTrie, overApproximation, useReduction, hashTableSize, extrapolationOption, inclusionPlaces, enableOverApproximation, enableUnderApproximation, denominator); |
3288 | copy.setDiscreteInclusion(discreteInclusion); |
3289 | copy.setActive(isActive); |
3290 | |
3291 | |
3292 | === modified file 'src/pipe/gui/GuiFrame.java' |
3293 | --- src/pipe/gui/GuiFrame.java 2014-03-03 23:13:48 +0000 |
3294 | +++ src/pipe/gui/GuiFrame.java 2014-05-28 18:52:41 +0000 |
3295 | @@ -2251,9 +2251,9 @@ |
3296 | buffer.append("License information and more is availabe at: www.tapaal.net\n\n"); |
3297 | buffer.append("Credits\n\n"); |
3298 | buffer.append("TAPAAL GUI and Translations:\n"); |
3299 | - buffer.append("Mathias Andersen, Joakim Byg, Louise Foshammer, Malte Neve-Graesboell,\n"); |
3300 | - buffer.append("Lasse Jacobsen, Morten Jacobsen, Peter G. Jensen, "); |
3301 | - buffer.append("Kenneth Y. Joergensen,\nMikael H. Moeller, Jiri Srba, Mathias G. Soerensen and Jakob H. Taankvist\n"); |
3302 | + buffer.append("Mathias Andersen, Sine V. Birch, Joakim Byg, Louise Foshammer, Malte Neve-Graesboell,\n"); |
3303 | + buffer.append("Lasse Jacobsen, Morten Jacobsen, Thomas S. Jacobsen, Jacob J. Jensen, Peter G. Jensen, "); |
3304 | + buffer.append("\nKenneth Y. Joergensen, Mikael H. Moeller, Christoffer Moesgaard, Niels N. Samuelsen,\nJiri Srba, Mathias G. Soerensen and Jakob H. Taankvist\n"); |
3305 | buffer.append("Aalborg University 2009-2014\n\n"); |
3306 | buffer.append("TAPAAL Continuous Engine (verifytapn):\n"); |
3307 | buffer.append("Alexandre David, Lasse Jacobsen, Morten Jacobsen and Jiri Srba\n"); |
3308 | |
3309 | === modified file 'src/pipe/gui/KBoundAnalyzer.java' |
3310 | --- src/pipe/gui/KBoundAnalyzer.java 2014-02-25 10:13:00 +0000 |
3311 | +++ src/pipe/gui/KBoundAnalyzer.java 2014-05-28 18:52:41 +0000 |
3312 | @@ -45,17 +45,17 @@ |
3313 | RunningVerificationDialog dialog = new RunningVerificationDialog(CreateGui.getApp()); |
3314 | dialog.setupListeners(analyzer); |
3315 | |
3316 | - analyzer.execute(options, tapnNetwork, query); |
3317 | + analyzer.execute(options, tapnNetwork, query, null); |
3318 | dialog.setVisible(true); |
3319 | } |
3320 | |
3321 | protected VerifyTAPNOptions verificationOptions() { |
3322 | if(modelChecker instanceof VerifyPN){ |
3323 | - return new VerifyPNOptions(k, TraceOption.NONE, SearchOption.BFS, false, ModelReduction.BOUNDPRESERVING); |
3324 | + return new VerifyPNOptions(k, TraceOption.NONE, SearchOption.BFS, false, ModelReduction.BOUNDPRESERVING, false, false, 1); |
3325 | } else if(modelChecker instanceof VerifyTAPN){ |
3326 | - return new VerifyTAPNOptions(k, TraceOption.NONE, SearchOption.BFS, true, false, true); |
3327 | + return new VerifyTAPNOptions(k, TraceOption.NONE, SearchOption.BFS, true, false, true, false, false, 1); |
3328 | } else if(modelChecker instanceof VerifyTAPNDiscreteVerification){ |
3329 | - return new VerifyDTAPNOptions(true, k, TraceOption.NONE, SearchOption.BFS, true, tapnNetwork.hasUrgentTransitions()?false:true, true); |
3330 | + return new VerifyDTAPNOptions(true, k, TraceOption.NONE, SearchOption.BFS, true, tapnNetwork.hasUrgentTransitions()?false:true, true, false, false, 1); |
3331 | } |
3332 | return null; |
3333 | } |
3334 | |
3335 | === modified file 'src/pipe/gui/RunKBoundAnalysis.java' |
3336 | --- src/pipe/gui/RunKBoundAnalysis.java 2011-09-08 08:43:34 +0000 |
3337 | +++ src/pipe/gui/RunKBoundAnalysis.java 2014-05-28 18:52:41 +0000 |
3338 | @@ -15,7 +15,7 @@ |
3339 | private final JSpinner spinner; |
3340 | |
3341 | public RunKBoundAnalysis(ModelChecker modelChecker, Messenger messenger,JSpinner spinner) { |
3342 | - super(modelChecker, messenger); |
3343 | + super(modelChecker, messenger, null); |
3344 | this.spinner = spinner; |
3345 | } |
3346 | |
3347 | |
3348 | === modified file 'src/pipe/gui/RunVerification.java' |
3349 | --- src/pipe/gui/RunVerification.java 2014-03-16 20:40:17 +0000 |
3350 | +++ src/pipe/gui/RunVerification.java 2014-05-28 18:52:41 +0000 |
3351 | @@ -19,6 +19,7 @@ |
3352 | import java.awt.event.HierarchyListener; |
3353 | import java.util.ArrayList; |
3354 | import java.util.Comparator; |
3355 | +import java.util.HashMap; |
3356 | import java.util.List; |
3357 | |
3358 | import javax.swing.JButton; |
3359 | @@ -38,9 +39,11 @@ |
3360 | import javax.swing.table.TableModel; |
3361 | import javax.swing.table.TableRowSorter; |
3362 | |
3363 | +import pipe.dataLayer.DataLayer; |
3364 | import pipe.gui.GuiFrame.GUIMode; |
3365 | import pipe.gui.widgets.RunningVerificationDialog; |
3366 | import dk.aau.cs.Messenger; |
3367 | +import dk.aau.cs.model.tapn.TimedArcPetriNet; |
3368 | import dk.aau.cs.model.tapn.simulation.TAPNNetworkTrace; |
3369 | import dk.aau.cs.util.MemoryMonitor; |
3370 | import dk.aau.cs.util.Tuple; |
3371 | @@ -54,14 +57,14 @@ |
3372 | public class RunVerification extends RunVerificationBase { |
3373 | private IconSelector iconSelector; |
3374 | private VerificationCallback callback; |
3375 | - public RunVerification(ModelChecker modelChecker, IconSelector selector, Messenger messenger, VerificationCallback callback) { |
3376 | - super(modelChecker, messenger); |
3377 | + public RunVerification(ModelChecker modelChecker, IconSelector selector, Messenger messenger, VerificationCallback callback, HashMap<TimedArcPetriNet, DataLayer> guiModels) { |
3378 | + super(modelChecker, messenger, guiModels); |
3379 | iconSelector = selector; |
3380 | this.callback = callback; |
3381 | } |
3382 | |
3383 | public RunVerification(ModelChecker modelChecker, IconSelector selector, Messenger messenger) { |
3384 | - this(modelChecker, selector, messenger, null); |
3385 | + this(modelChecker, selector, messenger, null, null); |
3386 | } |
3387 | |
3388 | @Override |
3389 | @@ -330,7 +333,7 @@ |
3390 | gbc.gridy = 4; |
3391 | gbc.insets = new Insets(0,0,15,0); |
3392 | gbc.anchor = GridBagConstraints.WEST; |
3393 | - panel.add(new JLabel(toHTML("The query was resolved using the over-approximation.")), gbc); |
3394 | + panel.add(new JLabel(toHTML("The query was resolved using state equations.")), gbc); |
3395 | } |
3396 | |
3397 | gbc = new GridBagConstraints(); |
3398 | |
3399 | === modified file 'src/pipe/gui/RunVerificationBase.java' |
3400 | --- src/pipe/gui/RunVerificationBase.java 2014-02-25 10:13:00 +0000 |
3401 | +++ src/pipe/gui/RunVerificationBase.java 2014-05-28 18:52:41 +0000 |
3402 | @@ -1,30 +1,47 @@ |
3403 | package pipe.gui; |
3404 | |
3405 | +import java.math.BigDecimal; |
3406 | +import java.util.HashMap; |
3407 | import java.util.concurrent.ExecutionException; |
3408 | |
3409 | import javax.swing.SwingUtilities; |
3410 | import javax.swing.SwingWorker; |
3411 | |
3412 | +import pipe.dataLayer.DataLayer; |
3413 | +import pipe.dataLayer.TAPNQuery.TraceOption; |
3414 | import pipe.dataLayer.TAPNQuery.SearchOption; |
3415 | +import pipe.gui.widgets.InclusionPlaces; |
3416 | import dk.aau.cs.Messenger; |
3417 | import dk.aau.cs.TCTL.visitors.RenameAllPlacesVisitor; |
3418 | +import dk.aau.cs.approximation.ApproximationWorker; |
3419 | +import dk.aau.cs.approximation.OverApproximation; |
3420 | +import dk.aau.cs.approximation.UnderApproximation; |
3421 | import dk.aau.cs.model.tapn.TAPNQuery; |
3422 | import dk.aau.cs.model.tapn.TimedArcPetriNet; |
3423 | import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
3424 | +import dk.aau.cs.model.tapn.TimedToken; |
3425 | import dk.aau.cs.model.tapn.simulation.TAPNNetworkTrace; |
3426 | +import dk.aau.cs.model.tapn.simulation.TimeDelayStep; |
3427 | +import dk.aau.cs.model.tapn.simulation.TimedArcPetriNetStep; |
3428 | import dk.aau.cs.model.tapn.simulation.TimedArcPetriNetTrace; |
3429 | +import dk.aau.cs.model.tapn.simulation.TimedTransitionStep; |
3430 | +import dk.aau.cs.util.MemoryMonitor; |
3431 | import dk.aau.cs.util.Tuple; |
3432 | import dk.aau.cs.util.UnsupportedModelException; |
3433 | +import dk.aau.cs.verification.ITAPNComposer; |
3434 | import dk.aau.cs.verification.ModelChecker; |
3435 | import dk.aau.cs.verification.NameMapping; |
3436 | import dk.aau.cs.verification.QueryType; |
3437 | +import dk.aau.cs.verification.QueryResult; |
3438 | import dk.aau.cs.verification.TAPNComposer; |
3439 | import dk.aau.cs.verification.TAPNTraceDecomposer; |
3440 | import dk.aau.cs.verification.VerificationOptions; |
3441 | import dk.aau.cs.verification.VerificationResult; |
3442 | +import dk.aau.cs.verification.UPPAAL.VerifytaOptions; |
3443 | import dk.aau.cs.verification.VerifyTAPN.ModelReduction; |
3444 | import dk.aau.cs.verification.VerifyTAPN.VerifyPN; |
3445 | import dk.aau.cs.verification.VerifyTAPN.VerifyPNOptions; |
3446 | +import dk.aau.cs.verification.VerifyTAPN.VerifyTAPNOptions; |
3447 | |
3448 | public abstract class RunVerificationBase extends SwingWorker<VerificationResult<TAPNNetworkTrace>, Void> { |
3449 | |
3450 | @@ -33,30 +50,47 @@ |
3451 | private VerificationOptions options; |
3452 | protected TimedArcPetriNetNetwork model; |
3453 | protected TAPNQuery query; |
3454 | - |
3455 | + protected pipe.dataLayer.TAPNQuery dataLayerQuery; |
3456 | + protected HashMap<TimedArcPetriNet, DataLayer> guiModels; |
3457 | + |
3458 | + |
3459 | protected Messenger messenger; |
3460 | |
3461 | - public RunVerificationBase(ModelChecker modelChecker, Messenger messenger) { |
3462 | + public RunVerificationBase(ModelChecker modelChecker, Messenger messenger, HashMap<TimedArcPetriNet, DataLayer> guiModels) { |
3463 | super(); |
3464 | this.modelChecker = modelChecker; |
3465 | this.messenger = messenger; |
3466 | + this.guiModels = guiModels; |
3467 | } |
3468 | |
3469 | - public void execute(VerificationOptions options, TimedArcPetriNetNetwork model, TAPNQuery query) { |
3470 | + |
3471 | + public void execute(VerificationOptions options, TimedArcPetriNetNetwork model, TAPNQuery query, pipe.dataLayer.TAPNQuery dataLayerQuery) { |
3472 | this.model = model; |
3473 | this.options = options; |
3474 | this.query = query; |
3475 | + this.dataLayerQuery = dataLayerQuery; |
3476 | execute(); |
3477 | } |
3478 | |
3479 | @Override |
3480 | protected VerificationResult<TAPNNetworkTrace> doInBackground() throws Exception { |
3481 | - TAPNComposer composer = new TAPNComposer(messenger); |
3482 | + ITAPNComposer composer = new TAPNComposer(messenger); |
3483 | Tuple<TimedArcPetriNet, NameMapping> transformedModel = composer.transformModel(model); |
3484 | + |
3485 | + if (options.enableOverApproximation()) |
3486 | + { |
3487 | + OverApproximation overaprx = new OverApproximation(); |
3488 | + overaprx.modifyTAPN(transformedModel.value1(), options.approximationDenominator()); |
3489 | + } |
3490 | + else if (options.enableUnderApproximation()) |
3491 | + { |
3492 | + UnderApproximation underaprx = new UnderApproximation(); |
3493 | + underaprx.modifyTAPN(transformedModel.value1(), options.approximationDenominator()); |
3494 | + } |
3495 | |
3496 | TAPNQuery clonedQuery = new TAPNQuery(query.getProperty().copy(), query.getExtraTokens()); |
3497 | MapQueryToNewNames(clonedQuery, transformedModel.value2()); |
3498 | - |
3499 | + |
3500 | if(options.useOverApproximation() && |
3501 | (query.queryType() == QueryType.EF || query.queryType() == QueryType.AG) && |
3502 | !query.hasDeadlock() && !(options instanceof VerifyPNOptions)){ |
3503 | @@ -65,10 +99,12 @@ |
3504 | // Skip over-approximation if model is not supported. |
3505 | // Prevents verification from displaying error. |
3506 | } |
3507 | + |
3508 | + |
3509 | if(!verifypn.setup()){ |
3510 | messenger.displayInfoMessage("Over-approximation check is skipped because VerifyPN is not available.", "VerifyPN unavailable"); |
3511 | }else{ |
3512 | - VerificationResult<TimedArcPetriNetTrace> overapprox_result = verifypn.verify(new VerifyPNOptions(options.extraTokens(), options.traceOption(), SearchOption.OVERAPPROXIMATE, true, ModelReduction.AGGRESSIVE), transformedModel, clonedQuery); |
3513 | + VerificationResult<TimedArcPetriNetTrace> overapprox_result = verifypn.verify(new VerifyPNOptions(options.extraTokens(), options.traceOption(), SearchOption.OVERAPPROXIMATE, true, ModelReduction.AGGRESSIVE, options.enableOverApproximation(), options.enableUnderApproximation(), options.approximationDenominator()), transformedModel, clonedQuery); |
3514 | if(!overapprox_result.error() && ( |
3515 | (query.queryType() == QueryType.EF && !overapprox_result.getQueryResult().isQuerySatisfied()) || |
3516 | (query.queryType() == QueryType.AG && overapprox_result.getQueryResult().isQuerySatisfied())) |
3517 | @@ -83,26 +119,19 @@ |
3518 | } |
3519 | } |
3520 | } |
3521 | + |
3522 | + ApproximationWorker worker = new ApproximationWorker(); |
3523 | + |
3524 | + return worker.normalWorker(options, modelChecker, transformedModel, composer, clonedQuery, this, model); |
3525 | + } |
3526 | + |
3527 | + private void renameTraceTransitions(TimedArcPetriNetTrace trace) { |
3528 | + if (trace != null){ |
3529 | + trace.reduceTraceForOriginalNet("_traceNet_", "PTRACE"); |
3530 | + trace.removeTokens("PBLOCK"); |
3531 | + } |
3532 | + } |
3533 | |
3534 | - VerificationResult<TimedArcPetriNetTrace> result = modelChecker.verify(options, transformedModel, clonedQuery); |
3535 | - if (isCancelled()) { |
3536 | - firePropertyChange("state", StateValue.PENDING, StateValue.DONE); |
3537 | - } |
3538 | - if (result.error()) { |
3539 | - return new VerificationResult<TAPNNetworkTrace>(result.errorMessage(), result.verificationTime()); |
3540 | - } else { |
3541 | - VerificationResult<TAPNNetworkTrace> value = new VerificationResult<TAPNNetworkTrace>( |
3542 | - result.getQueryResult(), |
3543 | - decomposeTrace(result.getTrace(), transformedModel.value2()), |
3544 | - decomposeTrace(result.getSecondaryTrace(), transformedModel.value2()), |
3545 | - result.verificationTime(), |
3546 | - result.stats(), |
3547 | - result.isOverApproximationResult()); |
3548 | - value.setNameMapping(transformedModel.value2()); |
3549 | - return value; |
3550 | - } |
3551 | - } |
3552 | - |
3553 | protected int kBound(){ |
3554 | return model.marking().size() + query.getExtraTokens(); |
3555 | } |
3556 | |
3557 | === modified file 'src/pipe/gui/Verifier.java' |
3558 | --- src/pipe/gui/Verifier.java 2014-02-25 10:13:00 +0000 |
3559 | +++ src/pipe/gui/Verifier.java 2014-05-28 18:52:41 +0000 |
3560 | @@ -1,11 +1,15 @@ |
3561 | package pipe.gui; |
3562 | |
3563 | +import java.util.HashMap; |
3564 | + |
3565 | import javax.swing.JOptionPane; |
3566 | import javax.swing.JSpinner; |
3567 | |
3568 | +import pipe.dataLayer.DataLayer; |
3569 | import pipe.dataLayer.TAPNQuery; |
3570 | import pipe.gui.widgets.RunningVerificationDialog; |
3571 | import dk.aau.cs.TCTL.TCTLAbstractProperty; |
3572 | +import dk.aau.cs.model.tapn.TimedArcPetriNet; |
3573 | import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
3574 | import dk.aau.cs.translations.ReductionOption; |
3575 | import dk.aau.cs.util.VerificationCallback; |
3576 | @@ -103,7 +107,7 @@ |
3577 | |
3578 | TCTLAbstractProperty inputQuery = input.getProperty(); |
3579 | |
3580 | - VerifytaOptions verifytaOptions = new VerifytaOptions(input.getTraceOption(), input.getSearchOption(), untimedTrace, input.getReductionOption(), input.useSymmetry(), input.useOverApproximation()); |
3581 | + VerifytaOptions verifytaOptions = new VerifytaOptions(input.getTraceOption(), input.getSearchOption(), untimedTrace, input.getReductionOption(), input.useSymmetry(), input.useOverApproximation(), input.isOverApproximationEnabled(), input.isUnderApproximationEnabled(), input.approximationDenominator()); |
3582 | |
3583 | if (inputQuery == null) { |
3584 | return; |
3585 | @@ -113,7 +117,7 @@ |
3586 | RunVerificationBase thread = new RunVerification(verifyta, new UppaalIconSelector(), new MessengerImpl()); |
3587 | RunningVerificationDialog dialog = new RunningVerificationDialog(CreateGui.getApp()); |
3588 | dialog.setupListeners(thread); |
3589 | - thread.execute(verifytaOptions, timedArcPetriNetNetwork, new dk.aau.cs.model.tapn.TAPNQuery(input.getProperty(), input.getCapacity())); |
3590 | + thread.execute(verifytaOptions, timedArcPetriNetNetwork, new dk.aau.cs.model.tapn.TAPNQuery(input.getProperty(), input.getCapacity()), null); |
3591 | dialog.setVisible(true); |
3592 | } else { |
3593 | JOptionPane.showMessageDialog(CreateGui.getApp(), |
3594 | @@ -127,8 +131,12 @@ |
3595 | public static void runVerifyTAPNVerification(TimedArcPetriNetNetwork tapnNetwork, TAPNQuery query) { |
3596 | runVerifyTAPNVerification(tapnNetwork, query, null); |
3597 | } |
3598 | - |
3599 | + |
3600 | public static void runVerifyTAPNVerification(TimedArcPetriNetNetwork tapnNetwork, TAPNQuery query, VerificationCallback callback) { |
3601 | + runVerifyTAPNVerification(tapnNetwork, query, callback, null); |
3602 | + } |
3603 | + |
3604 | + public static void runVerifyTAPNVerification(TimedArcPetriNetNetwork tapnNetwork, TAPNQuery query, VerificationCallback callback, HashMap<TimedArcPetriNet, DataLayer> guiModels) { |
3605 | ModelChecker verifytapn = getModelChecker(query); |
3606 | |
3607 | if (!verifytapn.isCorrectVersion()) { |
3608 | @@ -144,11 +152,11 @@ |
3609 | |
3610 | VerifyTAPNOptions verifytapnOptions; |
3611 | if(query.getReductionOption() == ReductionOption.VerifyTAPNdiscreteVerification){ |
3612 | - verifytapnOptions = new VerifyDTAPNOptions(bound, query.getTraceOption(), query.getSearchOption(), query.useSymmetry(), query.useGCD(), query.useTimeDarts(), query.usePTrie(), query.useOverApproximation(), query.discreteInclusion(), query.inclusionPlaces(), query.getWorkflowMode()); |
3613 | + verifytapnOptions = new VerifyDTAPNOptions(bound, query.getTraceOption(), query.getSearchOption(), query.useSymmetry(), query.useGCD(), query.useTimeDarts(), query.usePTrie(), query.useOverApproximation(), query.discreteInclusion(), query.inclusionPlaces(), query.getWorkflowMode(), query.isOverApproximationEnabled(), query.isUnderApproximationEnabled(), query.approximationDenominator()); |
3614 | } else if(query.getReductionOption() == ReductionOption.VerifyPN){ |
3615 | - verifytapnOptions = new VerifyPNOptions(bound, query.getTraceOption(), query.getSearchOption(), query.useOverApproximation(), query.useReduction()? ModelReduction.AGGRESSIVE:ModelReduction.NO_REDUCTION); |
3616 | + verifytapnOptions = new VerifyPNOptions(bound, query.getTraceOption(), query.getSearchOption(), query.useOverApproximation(), query.useReduction()? ModelReduction.AGGRESSIVE:ModelReduction.NO_REDUCTION, query.isOverApproximationEnabled(), query.isUnderApproximationEnabled(), query.approximationDenominator()); |
3617 | } else { |
3618 | - verifytapnOptions = new VerifyTAPNOptions(bound, query.getTraceOption(), query.getSearchOption(), query.useSymmetry(), query.useOverApproximation(), query.discreteInclusion(), query.inclusionPlaces()); |
3619 | + verifytapnOptions = new VerifyTAPNOptions(bound, query.getTraceOption(), query.getSearchOption(), query.useSymmetry(), query.useOverApproximation(), query.discreteInclusion(), query.inclusionPlaces(), query.isOverApproximationEnabled(), query.isUnderApproximationEnabled(), query.approximationDenominator()); |
3620 | } |
3621 | |
3622 | if (inputQuery == null) { |
3623 | @@ -156,10 +164,10 @@ |
3624 | } |
3625 | |
3626 | if (tapnNetwork != null) { |
3627 | - RunVerificationBase thread = new RunVerification(verifytapn, new VerifyTAPNIconSelector(), new MessengerImpl(), callback); |
3628 | + RunVerificationBase thread = new RunVerification(verifytapn, new VerifyTAPNIconSelector(), new MessengerImpl(), callback, guiModels); |
3629 | RunningVerificationDialog dialog = new RunningVerificationDialog(CreateGui.getApp()); |
3630 | dialog.setupListeners(thread); |
3631 | - thread.execute(verifytapnOptions, tapnNetwork, new dk.aau.cs.model.tapn.TAPNQuery(query.getProperty(), bound)); |
3632 | + thread.execute(verifytapnOptions, tapnNetwork, new dk.aau.cs.model.tapn.TAPNQuery(query.getProperty(), bound), query); |
3633 | dialog.setVisible(true); |
3634 | } else { |
3635 | JOptionPane.showMessageDialog(CreateGui.getApp(), |
3636 | |
3637 | === modified file 'src/pipe/gui/graphicElements/Arc.java' |
3638 | --- src/pipe/gui/graphicElements/Arc.java 2012-08-14 20:39:56 +0000 |
3639 | +++ src/pipe/gui/graphicElements/Arc.java 2014-05-28 18:52:41 +0000 |
3640 | @@ -202,6 +202,10 @@ |
3641 | public ArcPath getArcPath() { |
3642 | return myPath; |
3643 | } |
3644 | + |
3645 | + public void setArcPath(ArcPath newPath) { |
3646 | + myPath = newPath; |
3647 | + } |
3648 | |
3649 | @Override |
3650 | public boolean contains(int x, int y) { |
3651 | |
3652 | === modified file 'src/pipe/gui/widgets/InclusionPlaces.java' |
3653 | --- src/pipe/gui/widgets/InclusionPlaces.java 2011-06-28 16:30:37 +0000 |
3654 | +++ src/pipe/gui/widgets/InclusionPlaces.java 2014-05-28 18:52:41 +0000 |
3655 | @@ -31,4 +31,19 @@ |
3656 | public void removePlace(TimedPlace place) { |
3657 | inclusionPlaces.remove(place); |
3658 | } |
3659 | + |
3660 | + /** |
3661 | + * Perform a deep copy of the object and return it |
3662 | + * |
3663 | + * @return |
3664 | + */ |
3665 | + public InclusionPlaces copy() { |
3666 | + InclusionPlaces copy = new InclusionPlaces(); |
3667 | + copy.inclusionOption = (this.inclusionOption == InclusionPlacesOption.AllPlaces) ? InclusionPlacesOption.AllPlaces : InclusionPlacesOption.UserSpecified; |
3668 | + for (TimedPlace place : this.inclusionPlaces) { |
3669 | + copy.inclusionPlaces.add(place.copy()); |
3670 | + } |
3671 | + |
3672 | + return copy; |
3673 | + } |
3674 | } |
3675 | |
3676 | === modified file 'src/pipe/gui/widgets/QueryDialog.java' |
3677 | --- src/pipe/gui/widgets/QueryDialog.java 2014-03-17 22:10:21 +0000 |
3678 | +++ src/pipe/gui/widgets/QueryDialog.java 2014-05-28 18:52:41 +0000 |
3679 | @@ -19,11 +19,14 @@ |
3680 | import java.awt.event.MouseAdapter; |
3681 | import java.awt.event.MouseEvent; |
3682 | import java.awt.event.MouseListener; |
3683 | +import java.io.ByteArrayInputStream; |
3684 | +import java.io.ByteArrayOutputStream; |
3685 | import java.io.File; |
3686 | import java.util.ArrayList; |
3687 | import java.util.Arrays; |
3688 | import java.util.Collections; |
3689 | import java.util.Comparator; |
3690 | +import java.util.HashMap; |
3691 | import java.util.Vector; |
3692 | |
3693 | import javax.swing.BorderFactory; |
3694 | @@ -62,12 +65,18 @@ |
3695 | import javax.swing.undo.UndoableEdit; |
3696 | import javax.swing.undo.UndoableEditSupport; |
3697 | |
3698 | +import pipe.dataLayer.DataLayer; |
3699 | +import pipe.dataLayer.PNMLWriter; |
3700 | import pipe.dataLayer.TAPNQuery; |
3701 | +import pipe.dataLayer.Template; |
3702 | import pipe.dataLayer.TAPNQuery.SearchOption; |
3703 | import pipe.dataLayer.TAPNQuery.TraceOption; |
3704 | import pipe.gui.CreateGui; |
3705 | +import pipe.gui.FileFinder; |
3706 | +import pipe.gui.FileFinderImpl; |
3707 | import pipe.gui.MessengerImpl; |
3708 | import pipe.gui.Verifier; |
3709 | +import pipe.gui.Zoomer; |
3710 | import dk.aau.cs.TCTL.StringPosition; |
3711 | import dk.aau.cs.TCTL.TCTLAFNode; |
3712 | import dk.aau.cs.TCTL.TCTLAGNode; |
3713 | @@ -91,6 +100,12 @@ |
3714 | import dk.aau.cs.TCTL.visitors.HasDeadlockVisitor; |
3715 | import dk.aau.cs.TCTL.visitors.RenameAllPlacesVisitor; |
3716 | import dk.aau.cs.TCTL.visitors.VerifyPlaceNamesVisitor; |
3717 | +import dk.aau.cs.approximation.OverApproximation; |
3718 | +import dk.aau.cs.approximation.UnderApproximation; |
3719 | +import dk.aau.cs.gui.TabContent; |
3720 | +import dk.aau.cs.io.TimedArcPetriNetNetworkWriter; |
3721 | +import dk.aau.cs.model.tapn.Constant; |
3722 | +import dk.aau.cs.model.tapn.ConstantStore; |
3723 | import dk.aau.cs.model.tapn.SharedPlace; |
3724 | import dk.aau.cs.model.tapn.TimedArcPetriNet; |
3725 | import dk.aau.cs.model.tapn.TimedArcPetriNetNetwork; |
3726 | @@ -99,8 +114,10 @@ |
3727 | import dk.aau.cs.util.Tuple; |
3728 | import dk.aau.cs.util.UnsupportedModelException; |
3729 | import dk.aau.cs.util.UnsupportedQueryException; |
3730 | +import dk.aau.cs.verification.ITAPNComposer; |
3731 | import dk.aau.cs.verification.NameMapping; |
3732 | import dk.aau.cs.verification.TAPNComposer; |
3733 | +import dk.aau.cs.verification.TAPNComposerWithGUI; |
3734 | import dk.aau.cs.verification.UPPAAL.UppaalExporter; |
3735 | import dk.aau.cs.verification.VerifyTAPN.ModelReduction; |
3736 | import dk.aau.cs.verification.VerifyTAPN.VerifyPNExporter; |
3737 | @@ -115,7 +132,8 @@ |
3738 | private static final String EXPORT_UPPAAL_BTN_TEXT = "Export UPPAAL XML"; |
3739 | private static final String EXPORT_VERIFYTAPN_BTN_TEXT = "Export TAPAAL XML"; |
3740 | private static final String EXPORT_VERIFYPN_BTN_TEXT = "Export PN XML"; |
3741 | - |
3742 | + private static final String EXPORT_COMPOSED_BTN_TEXT = "Open composed net"; |
3743 | + |
3744 | private static final String UPPAAL_SOME_TRACE_STRING = "Some trace "; |
3745 | private static final String VERIFYTAPN_SOME_TRACE_STRING = "Some trace "; |
3746 | private static final String SHARED = "Shared"; |
3747 | @@ -204,18 +222,28 @@ |
3748 | private JCheckBox useGCD; |
3749 | private JCheckBox useOverApproximation; |
3750 | private JCheckBox useReduction; |
3751 | - |
3752 | + |
3753 | + // Approximation options panel |
3754 | + private JPanel overApproximationOptionsPanel; |
3755 | + private ButtonGroup approximationRadioButtonGroup; |
3756 | + private JRadioButton noApproximationEnable; |
3757 | + private JRadioButton overApproximationEnable; |
3758 | + private JRadioButton underApproximationEnable; |
3759 | + private CustomJSpinner overApproximationDenominator; |
3760 | + |
3761 | // Buttons in the bottom of the dialogue |
3762 | private JPanel buttonPanel; |
3763 | private JButton cancelButton; |
3764 | private JButton saveButton; |
3765 | private JButton saveAndVerifyButton; |
3766 | private JButton saveUppaalXMLButton; |
3767 | + private JButton openComposedNetButton; |
3768 | |
3769 | // Private Members |
3770 | private StringPosition currentSelection = null; |
3771 | |
3772 | private final TimedArcPetriNetNetwork tapnNetwork; |
3773 | + private final HashMap<TimedArcPetriNet, DataLayer> guiModels; |
3774 | private QueryConstructionUndoManager undoManager; |
3775 | private UndoableEditSupport undoSupport; |
3776 | private boolean isNetDegree2; |
3777 | @@ -313,12 +341,20 @@ |
3778 | private final static String TOOL_TIP_SAVE_AND_VERIFY_BUTTON = "Save and verify the query."; |
3779 | private final static String TOOL_TIP_CANCEL_BUTTON = "Cancel the changes made in this dialog."; |
3780 | private final static String TOOL_TIP_SAVE_UPPAAL_BUTTON = "Export an xml file that can be opened in UPPAAL GUI."; |
3781 | + private final static String TOOL_TIP_SAVE_COMPOSED_BUTTON = "Export an xml file of composed net and approximated net if enabled"; |
3782 | private final static String TOOL_TIP_SAVE_TAPAAL_BUTTON = "Export an xml file that can be used as input for the TAPAAL engine."; |
3783 | private final static String TOOL_TIP_SAVE_PN_BUTTON = "Export an xml file that can be used as input for the untimed Petri net engine."; |
3784 | - |
3785 | + |
3786 | + //Tool tips for approximation panel |
3787 | + private final static String TOOL_TIP_APPROXIMATION_METHOD_NONE = "No approximation method is used."; |
3788 | + private final static String TOOL_TIP_APPROXIMATION_METHOD_OVER = "Approximate by dividing all intervals with the approximation constant and enlarging the intervals."; |
3789 | + private final static String TOOL_TIP_APPROXIMATION_METHOD_UNDER = "Approximate by dividing all intervals with the approximation constant and shrinking the intervals."; |
3790 | + private final static String TOOL_TIP_APPROXIMATION_CONSTANT = "Choose approximation constant"; |
3791 | + |
3792 | public QueryDialog(EscapableDialog me, QueryDialogueOption option, |
3793 | - TAPNQuery queryToCreateFrom, TimedArcPetriNetNetwork tapnNetwork) { |
3794 | + TAPNQuery queryToCreateFrom, TimedArcPetriNetNetwork tapnNetwork, HashMap<TimedArcPetriNet, DataLayer> guiModels) { |
3795 | this.tapnNetwork = tapnNetwork; |
3796 | + this.guiModels = guiModels; |
3797 | inclusionPlaces = queryToCreateFrom == null ? new InclusionPlaces() : queryToCreateFrom.inclusionPlaces(); |
3798 | newProperty = queryToCreateFrom == null ? new TCTLPathPlaceHolder() : queryToCreateFrom.getProperty(); |
3799 | rootPane = me.getRootPane(); |
3800 | @@ -365,8 +401,9 @@ |
3801 | boolean gcd = useGCD.isSelected(); |
3802 | boolean overApproximation = useOverApproximation.isSelected(); |
3803 | boolean reduction = useReduction.isSelected(); |
3804 | + |
3805 | + TAPNQuery query = new TAPNQuery(name, capacity, newProperty.copy(), traceOption, searchOption, reductionOptionToSet, symmetry, gcd, timeDarts, pTrie, overApproximation, reduction, /* hashTableSizeToSet */ null, /* extrapolationOptionToSet */null, inclusionPlaces, overApproximationEnable.isSelected(), underApproximationEnable.isSelected(), (Integer) overApproximationDenominator.getValue()); |
3806 | |
3807 | - TAPNQuery query = new TAPNQuery(name, capacity, newProperty.copy(), traceOption, searchOption, reductionOptionToSet, symmetry, gcd, timeDarts, pTrie, overApproximation, reduction, /* hashTableSizeToSet */ null, /* extrapolationOptionToSet */null, inclusionPlaces); |
3808 | if(reductionOptionToSet.equals(ReductionOption.VerifyTAPN)){ |
3809 | query.setDiscreteInclusion(discreteInclusion.isSelected()); |
3810 | } |
3811 | @@ -507,7 +544,13 @@ |
3812 | return new HasDeadlockVisitor().hasDeadLock(newProperty); |
3813 | } |
3814 | |
3815 | - public static TAPNQuery showQueryDialogue(QueryDialogueOption option, TAPNQuery queryToRepresent, TimedArcPetriNetNetwork tapnNetwork) { |
3816 | + public static TAPNQuery showQueryDialogue(QueryDialogueOption option, TAPNQuery queryToRepresent, TimedArcPetriNetNetwork tapnNetwork, HashMap<TimedArcPetriNet, DataLayer> guiModels) { |
3817 | + if(CreateGui.getCurrentTab().network().hasWeights() && !CreateGui.getCurrentTab().network().isNonStrict()){ |
3818 | + JOptionPane.showMessageDialog(CreateGui.getApp(), |
3819 | + "No reduction option supports both strict intervals and weigthed arcs", |
3820 | + "No reduction option", JOptionPane.ERROR_MESSAGE); |
3821 | + return null; |
3822 | + } |
3823 | guiDialog = new EscapableDialog(CreateGui.getApp(), "Edit Query", true); |
3824 | |
3825 | Container contentPane = guiDialog.getContentPane(); |
3826 | @@ -517,7 +560,7 @@ |
3827 | contentPane.setLayout(new GridBagLayout()); |
3828 | |
3829 | // 2 Add query editor |
3830 | - QueryDialog queryDialogue = new QueryDialog(guiDialog, option, queryToRepresent, tapnNetwork); |
3831 | + QueryDialog queryDialogue = new QueryDialog(guiDialog, option, queryToRepresent, tapnNetwork, guiModels); |
3832 | contentPane.add(queryDialogue); |
3833 | |
3834 | guiDialog.setResizable(false); |
3835 | @@ -624,10 +667,12 @@ |
3836 | existsDiamond.setSelected(true); |
3837 | } else if (currentSelection.getObject() instanceof TCTLEGNode) { |
3838 | existsBox.setSelected(true); |
3839 | + noApproximationEnable.setSelected(true); |
3840 | } else if (currentSelection.getObject() instanceof TCTLAGNode) { |
3841 | forAllBox.setSelected(true); |
3842 | } else if (currentSelection.getObject() instanceof TCTLAFNode) { |
3843 | forAllDiamond.setSelected(true); |
3844 | + noApproximationEnable.setSelected(true); |
3845 | } |
3846 | } |
3847 | |
3848 | @@ -669,10 +714,12 @@ |
3849 | saveButton.setEnabled(isQueryOk); |
3850 | saveAndVerifyButton.setEnabled(isQueryOk); |
3851 | saveUppaalXMLButton.setEnabled(isQueryOk); |
3852 | + openComposedNetButton.setEnabled(isQueryOk); |
3853 | } else { |
3854 | saveButton.setEnabled(false); |
3855 | saveAndVerifyButton.setEnabled(false); |
3856 | saveUppaalXMLButton.setEnabled(false); |
3857 | + openComposedNetButton.setEnabled(false); |
3858 | } |
3859 | } |
3860 | |
3861 | @@ -948,6 +995,7 @@ |
3862 | initQueryPanel(); |
3863 | initUppaalOptionsPanel(); |
3864 | initReductionOptionsPanel(); |
3865 | + initOverApproximationPanel(); |
3866 | initButtonPanel(option); |
3867 | |
3868 | if(queryToCreateFrom != null) |
3869 | @@ -976,6 +1024,20 @@ |
3870 | setupSearchOptionsFromQuery(queryToCreateFrom); |
3871 | setupReductionOptionsFromQuery(queryToCreateFrom); |
3872 | setupTraceOptionsFromQuery(queryToCreateFrom); |
3873 | + setupApproximationOptionsFromQuery(queryToCreateFrom); |
3874 | + } |
3875 | + |
3876 | + private void setupApproximationOptionsFromQuery(TAPNQuery queryToCreateFrom) { |
3877 | + if (queryToCreateFrom.isOverApproximationEnabled()) |
3878 | + overApproximationEnable.setSelected(true); |
3879 | + else if (queryToCreateFrom.isUnderApproximationEnabled()) |
3880 | + underApproximationEnable.setSelected(true); |
3881 | + else |
3882 | + noApproximationEnable.setSelected(true); |
3883 | + |
3884 | + if (queryToCreateFrom.approximationDenominator() > 0) { |
3885 | + overApproximationDenominator.setValue(queryToCreateFrom.approximationDenominator()); |
3886 | + } |
3887 | } |
3888 | |
3889 | private void setupReductionOptionsFromQuery(TAPNQuery queryToCreateFrom) { |
3890 | @@ -1045,8 +1107,10 @@ |
3891 | existsDiamond.setSelected(true); |
3892 | } else if (queryToCreateFrom.getProperty() instanceof TCTLEGNode) { |
3893 | existsBox.setSelected(true); |
3894 | + noApproximationEnable.setSelected(true); |
3895 | } else if (queryToCreateFrom.getProperty() instanceof TCTLAFNode) { |
3896 | forAllDiamond.setSelected(true); |
3897 | + noApproximationEnable.setSelected(true); |
3898 | } else if (queryToCreateFrom.getProperty() instanceof TCTLAGNode) { |
3899 | forAllBox.setSelected(true); |
3900 | } |
3901 | @@ -1185,7 +1249,9 @@ |
3902 | searchOptionsPanel.setVisible(advancedView); |
3903 | reductionOptionsPanel.setVisible(advancedView); |
3904 | saveUppaalXMLButton.setVisible(advancedView); |
3905 | - |
3906 | + openComposedNetButton.setVisible(advancedView); |
3907 | + overApproximationOptionsPanel.setVisible(advancedView); |
3908 | + |
3909 | if(advancedView){ |
3910 | advancedButton.setText("Simple view"); |
3911 | advancedButton.setToolTipText(TOOL_TIP_SIMPLE_VIEW_BUTTON); |
3912 | @@ -1206,10 +1272,10 @@ |
3913 | boundednessCheckPanel.setLayout(new BoxLayout(boundednessCheckPanel, BoxLayout.X_AXIS)); |
3914 | boundednessCheckPanel.add(new JLabel(" Number of extra tokens: ")); |
3915 | |
3916 | - numberOfExtraTokensInNet = new CustomJSpinner(3, 0, Integer.MAX_VALUE); |
3917 | - numberOfExtraTokensInNet.setMaximumSize(new Dimension(55, 30)); |
3918 | - numberOfExtraTokensInNet.setMinimumSize(new Dimension(55, 30)); |
3919 | - numberOfExtraTokensInNet.setPreferredSize(new Dimension(55, 30)); |
3920 | + numberOfExtraTokensInNet = new CustomJSpinner(4, 0, Integer.MAX_VALUE); |
3921 | + numberOfExtraTokensInNet.setMaximumSize(new Dimension(65, 30)); |
3922 | + numberOfExtraTokensInNet.setMinimumSize(new Dimension(65, 30)); |
3923 | + numberOfExtraTokensInNet.setPreferredSize(new Dimension(65, 30)); |
3924 | numberOfExtraTokensInNet.setToolTipText(TOOL_TIP_NUMBEROFEXTRATOKENSINNET); |
3925 | boundednessCheckPanel.add(numberOfExtraTokensInNet); |
3926 | |
3927 | @@ -1338,6 +1404,7 @@ |
3928 | quantificationPanel = new JPanel(new GridBagLayout()); |
3929 | quantificationPanel.setBorder(BorderFactory.createTitledBorder("Quantification")); |
3930 | quantificationRadioButtonGroup = new ButtonGroup(); |
3931 | + approximationRadioButtonGroup = new ButtonGroup(); |
3932 | |
3933 | existsDiamond = new JRadioButton("(EF) There exists some reachable marking that satisifies:"); |
3934 | existsBox = new JRadioButton("(EG) There exists a trace on which every marking satisfies:"); |
3935 | @@ -2073,6 +2140,62 @@ |
3936 | uppaalOptionsPanel.add(traceOptionsPanel, gridBagConstraints); |
3937 | |
3938 | } |
3939 | + |
3940 | + |
3941 | + |
3942 | + |
3943 | + |
3944 | + private void initOverApproximationPanel() { |
3945 | + overApproximationOptionsPanel = new JPanel(new GridBagLayout()); |
3946 | + overApproximationOptionsPanel.setVisible(false); |
3947 | + overApproximationOptionsPanel.setBorder(BorderFactory.createTitledBorder("Approximation Options")); |
3948 | + approximationRadioButtonGroup = new ButtonGroup(); |
3949 | + |
3950 | + noApproximationEnable = new JRadioButton("Exact analysis"); |
3951 | + noApproximationEnable.setVisible(true); |
3952 | + noApproximationEnable.setSelected(true); |
3953 | + noApproximationEnable.setToolTipText(TOOL_TIP_APPROXIMATION_METHOD_NONE); |
3954 | + |
3955 | + overApproximationEnable = new JRadioButton("Over-approximation"); |
3956 | + overApproximationEnable.setVisible(true); |
3957 | + overApproximationEnable.setToolTipText(TOOL_TIP_APPROXIMATION_METHOD_OVER); |
3958 | + |
3959 | + underApproximationEnable = new JRadioButton("Under-approximation"); |
3960 | + underApproximationEnable.setVisible(true); |
3961 | + underApproximationEnable.setToolTipText(TOOL_TIP_APPROXIMATION_METHOD_UNDER); |
3962 | + |
3963 | + approximationRadioButtonGroup.add(noApproximationEnable); |
3964 | + approximationRadioButtonGroup.add(overApproximationEnable); |
3965 | + approximationRadioButtonGroup.add(underApproximationEnable); |
3966 | + |
3967 | + GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
3968 | + gridBagConstraints.gridy = 0; |
3969 | + gridBagConstraints.weightx = 1; |
3970 | + gridBagConstraints.anchor = GridBagConstraints.WEST; |
3971 | + |
3972 | + JLabel approximationDenominatorLabel = new JLabel("Approximation constant: "); |
3973 | + |
3974 | + overApproximationDenominator = new CustomJSpinner(2, 2, Integer.MAX_VALUE); |
3975 | + overApproximationDenominator.setMaximumSize(new Dimension(65, 30)); |
3976 | + overApproximationDenominator.setMinimumSize(new Dimension(65, 30)); |
3977 | + overApproximationDenominator.setPreferredSize(new Dimension(65, 30)); |
3978 | + overApproximationDenominator.setToolTipText(TOOL_TIP_APPROXIMATION_CONSTANT); |
3979 | + |
3980 | + overApproximationOptionsPanel.add(noApproximationEnable, gridBagConstraints); |
3981 | + overApproximationOptionsPanel.add(overApproximationEnable, gridBagConstraints); |
3982 | + overApproximationOptionsPanel.add(underApproximationEnable, gridBagConstraints); |
3983 | + overApproximationOptionsPanel.add(approximationDenominatorLabel, gridBagConstraints); |
3984 | + overApproximationOptionsPanel.add(overApproximationDenominator); |
3985 | + |
3986 | + gridBagConstraints = new GridBagConstraints(); |
3987 | + gridBagConstraints.gridx = 0; |
3988 | + gridBagConstraints.gridy = 5; |
3989 | + gridBagConstraints.anchor = GridBagConstraints.WEST; |
3990 | + gridBagConstraints.insets = new Insets(5,10,5,10); |
3991 | + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
3992 | + |
3993 | + add(overApproximationOptionsPanel, gridBagConstraints); |
3994 | + } |
3995 | |
3996 | private void initReductionOptionsPanel() { |
3997 | reductionOptionsPanel = new JPanel(new GridBagLayout()); |
3998 | @@ -2201,7 +2324,7 @@ |
3999 | gbc.insets = new Insets(0,5,0,5); |
4000 | reductionOptionsPanel.add(usePTrie, gbc); |
4001 | |
4002 | - useOverApproximation = new JCheckBox("Use over-approximation check"); |
4003 | + useOverApproximation = new JCheckBox("Use untimed state-equations check"); |
4004 | useOverApproximation.setSelected(true); |
4005 | useOverApproximation.setToolTipText(TOOL_TIP_OVERAPPROX); |
4006 | |
4007 | @@ -2293,6 +2416,11 @@ |
4008 | useOverApproximation.setVisible(true); |
4009 | useOverApproximation.setSelected(false); |
4010 | useOverApproximation.setEnabled(false); |
4011 | + |
4012 | + /*noApproximationEnable.setEnabled(false); |
4013 | + overApproximationEnable.setEnabled(false); |
4014 | + underApproximationEnable.setEnabled(false); |
4015 | + overApproximationDenominator.setEnabled(false);*/ |
4016 | } |
4017 | else{ |
4018 | useOverApproximation.setVisible(true); |
4019 | @@ -2300,6 +2428,11 @@ |
4020 | useOverApproximation.setSelected(true); |
4021 | } |
4022 | useOverApproximation.setEnabled(true); |
4023 | + |
4024 | + noApproximationEnable.setEnabled(true); |
4025 | + overApproximationEnable.setEnabled(true); |
4026 | + underApproximationEnable.setEnabled(true); |
4027 | + overApproximationDenominator.setEnabled(true); |
4028 | } |
4029 | } |
4030 | |
4031 | @@ -2340,22 +2473,28 @@ |
4032 | refreshOverApproximationOption(); |
4033 | } |
4034 | |
4035 | + |
4036 | private void initButtonPanel(QueryDialogueOption option) { |
4037 | buttonPanel = new JPanel(new BorderLayout()); |
4038 | if (option == QueryDialogueOption.Save) { |
4039 | saveButton = new JButton("Save"); |
4040 | saveAndVerifyButton = new JButton("Save and Verify"); |
4041 | cancelButton = new JButton("Cancel"); |
4042 | + |
4043 | + openComposedNetButton = new JButton(EXPORT_COMPOSED_BTN_TEXT); |
4044 | + openComposedNetButton.setVisible(false); |
4045 | + |
4046 | saveUppaalXMLButton = new JButton(EXPORT_UPPAAL_BTN_TEXT); |
4047 | //Only show in advanced mode |
4048 | saveUppaalXMLButton.setVisible(false); |
4049 | - |
4050 | + |
4051 | //Add tool tips |
4052 | saveButton.setToolTipText(TOOL_TIP_SAVE_BUTTON); |
4053 | saveAndVerifyButton.setToolTipText(TOOL_TIP_SAVE_AND_VERIFY_BUTTON); |
4054 | cancelButton.setToolTipText(TOOL_TIP_CANCEL_BUTTON); |
4055 | saveUppaalXMLButton.setToolTipText(TOOL_TIP_SAVE_UPPAAL_BUTTON); |
4056 | - |
4057 | + openComposedNetButton.setToolTipText(TOOL_TIP_SAVE_COMPOSED_BUTTON); |
4058 | + |
4059 | saveButton.addActionListener(new ActionListener() { |
4060 | public void actionPerformed(ActionEvent evt) { |
4061 | // TODO make save |
4062 | @@ -2378,7 +2517,7 @@ |
4063 | TAPNQuery query = getQuery(); |
4064 | |
4065 | if(query.getReductionOption() == ReductionOption.VerifyTAPN || query.getReductionOption() == ReductionOption.VerifyTAPNdiscreteVerification || query.getReductionOption() == ReductionOption.VerifyPN) |
4066 | - Verifier.runVerifyTAPNVerification(tapnNetwork, query); |
4067 | + Verifier.runVerifyTAPNVerification(tapnNetwork, query, null, guiModels); |
4068 | else |
4069 | Verifier.runUppaalVerification(tapnNetwork, query); |
4070 | }} |
4071 | @@ -2412,8 +2551,19 @@ |
4072 | } |
4073 | |
4074 | if (xmlFile != null && queryFile != null) { |
4075 | - TAPNComposer composer = new TAPNComposer(new MessengerImpl()); |
4076 | + ITAPNComposer composer = new TAPNComposer(new MessengerImpl()); |
4077 | Tuple<TimedArcPetriNet, NameMapping> transformedModel = composer.transformModel(QueryDialog.this.tapnNetwork); |
4078 | + |
4079 | + if (overApproximationEnable.isSelected()) |
4080 | + { |
4081 | + OverApproximation overaprx = new OverApproximation(); |
4082 | + overaprx.modifyTAPN(transformedModel.value1(), getQuery().approximationDenominator()); |
4083 | + } |
4084 | + else if (underApproximationEnable.isSelected()) |
4085 | + { |
4086 | + UnderApproximation underaprx = new UnderApproximation(); |
4087 | + underaprx.modifyTAPN(transformedModel.value1(), getQuery().approximationDenominator()); |
4088 | + } |
4089 | |
4090 | TAPNQuery tapnQuery = getQuery(); |
4091 | dk.aau.cs.model.tapn.TAPNQuery clonedQuery = new dk.aau.cs.model.tapn.TAPNQuery(tapnQuery.getProperty().copy(), tapnQuery.getCapacity()); |
4092 | @@ -2449,6 +2599,49 @@ |
4093 | } |
4094 | } |
4095 | }); |
4096 | + |
4097 | + openComposedNetButton.addActionListener(new ActionListener() { |
4098 | + public void actionPerformed(ActionEvent e) { |
4099 | + TAPNComposerWithGUI composer = new TAPNComposerWithGUI(new MessengerImpl(), guiModels); |
4100 | + Tuple<TimedArcPetriNet, NameMapping> transformedModel = composer.transformModel(tapnNetwork); |
4101 | + |
4102 | + ArrayList<Template> templates = new ArrayList<Template>(1); |
4103 | + querySaved = true; //Setting this to true will make sure that new values will be used. |
4104 | + if (overApproximationEnable.isSelected()) |
4105 | + { |
4106 | + OverApproximation overaprx = new OverApproximation(); |
4107 | + overaprx.modifyTAPN(transformedModel.value1(), getQuery().approximationDenominator()); |
4108 | + } |
4109 | + else if (underApproximationEnable.isSelected()) |
4110 | + { |
4111 | + UnderApproximation underaprx = new UnderApproximation(); |
4112 | + underaprx.modifyTAPN(transformedModel.value1(), getQuery().approximationDenominator(), ((TAPNComposerWithGUI) composer).getGuiModel()); |
4113 | + } |
4114 | + templates.add(new Template(transformedModel.value1(), ((TAPNComposerWithGUI) composer).getGuiModel(), new Zoomer())); |
4115 | + |
4116 | + // Create a constant store |
4117 | + ConstantStore newConstantStore = new ConstantStore(); |
4118 | + |
4119 | + |
4120 | + TimedArcPetriNetNetwork network = new TimedArcPetriNetNetwork(newConstantStore); |
4121 | + |
4122 | + network.add(transformedModel.value1()); |
4123 | + |
4124 | + PNMLWriter tapnWriter = new TimedArcPetriNetNetworkWriter(network, templates, new ArrayList<pipe.dataLayer.TAPNQuery>(0), new ArrayList<Constant>(0)); |
4125 | + |
4126 | + try { |
4127 | + ByteArrayOutputStream outputStream = tapnWriter.savePNML(); |
4128 | + String composedName = "composed-" + CreateGui.getApp().getCurrentTabName(); |
4129 | + composedName = composedName.replace(".xml", ""); |
4130 | + CreateGui.getApp().createNewTabFromFile(new ByteArrayInputStream(outputStream.toByteArray()), composedName); |
4131 | + exit(); |
4132 | + } catch (Exception e1) { |
4133 | + System.console().printf(e1.getMessage()); |
4134 | + } |
4135 | + } |
4136 | + }); |
4137 | + |
4138 | + |
4139 | } else if (option == QueryDialogueOption.Export) { |
4140 | saveButton = new JButton("export"); |
4141 | cancelButton = new JButton("Cancel"); |
4142 | @@ -2470,8 +2663,10 @@ |
4143 | if (option == QueryDialogueOption.Save) { |
4144 | JPanel leftButtomPanel = new JPanel(new FlowLayout()); |
4145 | JPanel rightButtomPanel = new JPanel(new FlowLayout()); |
4146 | + leftButtomPanel.add(openComposedNetButton, FlowLayout.LEFT); |
4147 | leftButtomPanel.add(saveUppaalXMLButton, FlowLayout.LEFT); |
4148 | - |
4149 | + |
4150 | + |
4151 | rightButtomPanel.add(cancelButton); |
4152 | |
4153 | rightButtomPanel.add(saveButton); |
4154 | @@ -2489,7 +2684,7 @@ |
4155 | |
4156 | GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
4157 | gridBagConstraints.gridx = 0; |
4158 | - gridBagConstraints.gridy = 5; |
4159 | + gridBagConstraints.gridy = 6; |
4160 | gridBagConstraints.anchor = GridBagConstraints.WEST; |
4161 | gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
4162 | gridBagConstraints.insets = new Insets(0, 10, 5, 10); |
4163 | |
4164 | === modified file 'src/pipe/gui/widgets/QueryPane.java' |
4165 | --- src/pipe/gui/widgets/QueryPane.java 2013-06-25 20:51:19 +0000 |
4166 | +++ src/pipe/gui/widgets/QueryPane.java 2014-05-28 18:52:41 +0000 |
4167 | @@ -311,7 +311,7 @@ |
4168 | addQueryButton.setToolTipText(toolTipNewQuery); |
4169 | addQueryButton.addActionListener(new ActionListener() { |
4170 | public void actionPerformed(ActionEvent e) { |
4171 | - TAPNQuery q = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, null, tabContent.network()); |
4172 | + TAPNQuery q = QueryDialog.showQueryDialogue(QueryDialogueOption.Save, null, tabContent.network(), tabContent.getGuiModels()); |
4173 | if (q != null) { |
4174 | undoManager.addNewEdit(new AddQueryCommand(q, tabContent)); |
4175 | addQuery(q); |
4176 | @@ -336,7 +336,7 @@ |
4177 | TAPNQuery q = (TAPNQuery) queryList.getSelectedValue(); |
4178 | if(q.isActive()) { |
4179 | TAPNQuery newQuery = QueryDialog.showQueryDialogue( |
4180 | - QueryDialogueOption.Save, q, tabContent.network()); |
4181 | + QueryDialogueOption.Save, q, tabContent.network(), tabContent.getGuiModels()); |
4182 | |
4183 | if (newQuery != null) |
4184 | updateQuery(q, newQuery); |
4185 | @@ -411,7 +411,7 @@ |
4186 | TAPNQuery query = (TAPNQuery) queryList.getSelectedValue(); |
4187 | |
4188 | if(query.getReductionOption() == ReductionOption.VerifyTAPN || query.getReductionOption() == ReductionOption.VerifyTAPNdiscreteVerification || query.getReductionOption() == ReductionOption.VerifyPN) |
4189 | - Verifier.runVerifyTAPNVerification(tabContent.network(), query); |
4190 | + Verifier.runVerifyTAPNVerification(tabContent.network(), query, null, this.tabContent.getGuiModels()); |
4191 | else |
4192 | Verifier.runUppaalVerification(tabContent.network(), query); |
4193 | } |
4194 | |
4195 | === modified file 'src/resources/Images/Ask a question.png' (properties changed: +x to -x) |
4196 | === modified file 'src/resources/Images/Report bug.png' (properties changed: +x to -x) |
4197 | === modified file 'src/resources/Images/icon.png' (properties changed: +x to -x) |
4198 | === modified file 'src/resources/Images/info.png' (properties changed: +x to -x) |
4199 | === modified file 'src/resources/Images/maybe.png' (properties changed: +x to -x) |
4200 | === modified file 'src/resources/Images/maybe1.png' (properties changed: +x to -x) |
4201 | === modified file 'src/resources/Images/notsatisfied.png' (properties changed: +x to -x) |
4202 | === modified file 'src/resources/Images/satisfied.png' (properties changed: +x to -x) |
Nothing major comes to mind, a few comments though:
- Please remove dumpToConsole function (no debug code in trunk)
- please remove commented code (I spotted a commented call to dumpToConsole and something around line 3935)
- some funny comment thing is going on around line 1273, this should probably go
- some funny thing going on with null in line 980, but I assume it's ok (looks A little hacksy)
- maybe one could consider attaching to memory monitor with commulative flag for process, rather than the current design where you have to remember to turn it off again (I hope you remember to do this in all places! Have you handled aborts etc? I did not go through the code to verify this :) )
The code generally looks okay, but I believe at least the first two comments should be addressed before merge.