-
Notifications
You must be signed in to change notification settings - Fork 118
FE-524: Add Inhibitor Arc support
#8618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
246d57a
Add new field to petrinaut arcs type: inhibitor | standard
alex-e-leon 65252b9
Rename arcType to arcDirection in petrinaut
alex-e-leon 6d474e0
Add select form field to panel for arc type
alex-e-leon 9ddcac7
Update ZOOM_PADDING to be larger so that entire net can be seen when …
alex-e-leon ec43626
Update inhibitor arc logic
alex-e-leon 037fcf6
Remove inhibitor arcs from output arcs
alex-e-leon 81c37bf
Added test cases for inhibitor arc transitions
alex-e-leon a1c7662
Added a deployment pipeline example for inhibitor arcs
alex-e-leon b843184
Add dashed line for inhibitor arcs
alex-e-leon 6701e95
Add circle endpoint to inhibitor arc
alex-e-leon 426bb46
Added a changeset for inhibitor arcs
alex-e-leon 5ee2a2d
Hide arc type selector for output arcs
alex-e-leon 7a653de
Fix removeToken bad index value issue
alex-e-leon 3a62d18
Don't add arc type when creating output arcs
alex-e-leon d4ba88b
Merge branch 'main' into FE-524-inhibitor-arcs
alex-e-leon 338df99
Filter out inhibitor arcs earlier when computing transitions
alex-e-leon 7692cc7
Remove output arc type in test file
alex-e-leon 0647a99
Do not add inhibitor arc token types to transition in lsp
alex-e-leon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@hashintel/petrinaut": patch | ||
| --- | ||
|
|
||
| Add support for inhibitor arcs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
178 changes: 178 additions & 0 deletions
178
libs/@hashintel/petrinaut/src/examples/deployment-pipeline.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| import { SNAP_GRID_SIZE } from "../constants/ui"; | ||
| import type { SDCPN } from "../core/types/sdcpn"; | ||
|
|
||
| export const deploymentPipelineSDCPN: { | ||
| title: string; | ||
| petriNetDefinition: SDCPN; | ||
| } = { | ||
| title: "Deployment Pipeline", | ||
| petriNetDefinition: { | ||
| places: [ | ||
| { | ||
| id: "place__deployment-ready", | ||
| name: "DeploymentReady", | ||
| colorId: null, | ||
| dynamicsEnabled: false, | ||
| differentialEquationId: null, | ||
| x: -8 * SNAP_GRID_SIZE, | ||
| y: -10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "place__incident-being-investigated", | ||
| name: "IncidentBeingInvestigated", | ||
| colorId: null, | ||
| dynamicsEnabled: false, | ||
| differentialEquationId: null, | ||
| x: -8 * SNAP_GRID_SIZE, | ||
| y: 10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "place__deployment-in-progress", | ||
| name: "DeploymentInProgress", | ||
| colorId: null, | ||
| dynamicsEnabled: false, | ||
| differentialEquationId: null, | ||
| x: 25 * SNAP_GRID_SIZE, | ||
| y: -10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "place__completed-deployments", | ||
| name: "CompletedDeployments", | ||
| colorId: null, | ||
| dynamicsEnabled: false, | ||
| differentialEquationId: null, | ||
| x: 55 * SNAP_GRID_SIZE, | ||
| y: -10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "place__resolved-incidents", | ||
| name: "ResolvedIncidents", | ||
| colorId: null, | ||
| dynamicsEnabled: false, | ||
| differentialEquationId: null, | ||
| x: 25 * SNAP_GRID_SIZE, | ||
| y: 20 * SNAP_GRID_SIZE, | ||
| }, | ||
| ], | ||
| transitions: [ | ||
| { | ||
| id: "transition__create-deployment", | ||
| name: "Create Deployment", | ||
| inputArcs: [], | ||
| outputArcs: [{ placeId: "place__deployment-ready", weight: 1 }], | ||
| lambdaType: "stochastic", | ||
| lambdaCode: | ||
| "export default Lambda((tokens, parameters) => parameters.deployment_creation_rate)", | ||
| transitionKernelCode: | ||
| "export default TransitionKernel(() => {\n return {\n DeploymentReady: [{}],\n };\n});", | ||
| x: -30 * SNAP_GRID_SIZE, | ||
| y: -10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "transition__incident-raised", | ||
| name: "Incident Raised", | ||
| inputArcs: [], | ||
| outputArcs: [ | ||
| { placeId: "place__incident-being-investigated", weight: 1 }, | ||
| ], | ||
| lambdaType: "stochastic", | ||
| lambdaCode: | ||
| "export default Lambda((tokens, parameters) => parameters.incident_rate)", | ||
| transitionKernelCode: | ||
| "export default TransitionKernel(() => {\n return {\n IncidentBeingInvestigated: [{}],\n };\n});", | ||
| x: -30 * SNAP_GRID_SIZE, | ||
| y: 10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "transition__start-deployment", | ||
| name: "Start Deployment", | ||
| inputArcs: [ | ||
| { | ||
| placeId: "place__deployment-ready", | ||
| weight: 1, | ||
| type: "standard", | ||
| }, | ||
| { | ||
| placeId: "place__incident-being-investigated", | ||
| weight: 1, | ||
| type: "inhibitor", | ||
| }, | ||
| { | ||
| placeId: "place__deployment-in-progress", | ||
| weight: 1, | ||
| type: "inhibitor", | ||
| }, | ||
| ], | ||
| outputArcs: [{ placeId: "place__deployment-in-progress", weight: 1 }], | ||
| lambdaType: "predicate", | ||
| lambdaCode: "export default Lambda(() => true)", | ||
| transitionKernelCode: | ||
| "export default TransitionKernel(() => {\n return {\n DeploymentInProgress: [{}],\n };\n});", | ||
| x: 8 * SNAP_GRID_SIZE, | ||
| y: -10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "transition__finish-deployment", | ||
| name: "Finish Deployment", | ||
| inputArcs: [ | ||
| { | ||
| placeId: "place__deployment-in-progress", | ||
| weight: 1, | ||
| type: "standard", | ||
| }, | ||
| ], | ||
| outputArcs: [{ placeId: "place__completed-deployments", weight: 1 }], | ||
| lambdaType: "predicate", | ||
| lambdaCode: "export default Lambda(() => true)", | ||
| transitionKernelCode: | ||
| "export default TransitionKernel(() => {\n return {\n CompletedDeployments: [{}],\n };\n});", | ||
| x: 40 * SNAP_GRID_SIZE, | ||
| y: -10 * SNAP_GRID_SIZE, | ||
| }, | ||
| { | ||
| id: "transition__close-incident", | ||
| name: "Close Incident", | ||
| inputArcs: [ | ||
| { | ||
| placeId: "place__incident-being-investigated", | ||
| weight: 1, | ||
| type: "standard", | ||
| }, | ||
| ], | ||
| outputArcs: [{ placeId: "place__resolved-incidents", weight: 1 }], | ||
| lambdaType: "stochastic", | ||
| lambdaCode: | ||
| "export default Lambda((tokens, parameters) => parameters.incident_resolution_rate)", | ||
| transitionKernelCode: | ||
| "export default TransitionKernel(() => {\n return {\n ResolvedIncidents: [{}],\n };\n});", | ||
| x: 8 * SNAP_GRID_SIZE, | ||
| y: 10 * SNAP_GRID_SIZE, | ||
| }, | ||
| ], | ||
| types: [], | ||
| differentialEquations: [], | ||
| parameters: [ | ||
| { | ||
| id: "param__deployment_creation_rate", | ||
| name: "Deployment Creation Rate", | ||
| variableName: "deployment_creation_rate", | ||
| type: "real", | ||
| defaultValue: "0.5", | ||
| }, | ||
| { | ||
| id: "param__incident_rate", | ||
| name: "Incident Rate", | ||
| variableName: "incident_rate", | ||
| type: "real", | ||
| defaultValue: "0.1", | ||
| }, | ||
| { | ||
| id: "param__incident_resolution_rate", | ||
| name: "Incident Resolution Rate", | ||
| variableName: "incident_resolution_rate", | ||
| type: "real", | ||
| defaultValue: "0.3", | ||
| }, | ||
| ], | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.