Skip to content

Commit

Permalink
fix bug when adjusting arc weight of inhibitors
Browse files Browse the repository at this point in the history
  • Loading branch information
stackdump committed Dec 26, 2023
1 parent e7f2d7e commit 8225933
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,16 +883,14 @@ export function newModel({schema, declaration, type}: ModelOptions): Model {
if (!place || !transition) {
throw new Error("invalid arc");
}
if (arc.inhibit) { // was inhibitor
transition.guards.delete(place.label);
if (arc.target?.place) {
transition.delta[place.offset] = arc.weight;
} else if (arc.source?.place) {
transition.delta[place.offset] = 0 - arc.weight;
if (arc.inhibit) {
const g = transition.guards.get(place.label);
if (g) {
g.delta[place.offset] = 0 - arc.weight;
} else {
throw new Error("invalid arc");
}
} else { // was not inhibitor
} else {
if (arc.target?.place) {
transition.delta[place.offset] = arc.weight;
} else if (arc.source?.place) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pflow-dev/metamodel",
"version": "0.7.0",
"version": "0.7.1",
"main": "/index.js",
"types": "/index.d.ts",
"description": "create workflows and petriNets with a DSL",
Expand Down

0 comments on commit 8225933

Please sign in to comment.