Multiple connections between components lead to incorrect behaviour
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Workcraft |
Fix Committed
|
High
|
Unassigned |
Bug Description
Problem 1: Incorrect petri-net simulation
- Create a new STG model.
- Create a single place and a single transition
- Create two arcs from the place to the transition.
- Put a single token into the place.
- Select "Simulation" tool.
The transition becomes enabled while there is a place with less tokens than there are arcs from the place to the transition.
The internal cause:
The simulation uses incidence information from NodeContextTracker, which is not aware of possibility of multiple connections.
Problem 2: Corruption of incidence information
Steps to reproduce:
- Follow the steps described in "Problem 1".
- Remove the token.
- Remove one of the arcs.
- Select "Simulation" tool
The transition becomes enabled while having a place without tokens in its preset.
The internal cause:
The NodeContextTracker class, who tracks which node is a pre-set of which, stores incidence information in sets: HashMap<Node, LinkedHashSet<
Object is removed from the set when the corresponding connection is removed. In the case when there are multiple such connections, the object is removed too early.
Possible solutions:
- Forbid connections between the same components. This is the easiest solution, but will make weighted arcs impossible unless we implement them as a separate feature (see https:/
- Change NodeContextTracker to track "connection weight" instead of the fact of nodes being connected.
Changed in workcraft: | |
importance: | Undecided → High |
status: | New → Fix Committed |
status: | Fix Committed → Triaged |
status: | Triaged → Fix Committed |
tags: | added: connection |
NodeContextTracker is meant to be a class to track node contexts (incidence information) in a generic graph model. Creating more that one arc between nodes is not an invalid operation in general case.
Therefore, the correct behaviour is to remove nodes from pre-/post-sets when all connections involving the two nodes are removed.
Models that need more involved context tracking should not use the default context tracker.
Forbidding multiple arcs between the same node should only be implemented in Petri nets/STGs.