Skip to content

Resolve Race Conditions#5

Merged
alexplaka merged 12 commits intomasterfrom
resolve-race-conditions
Dec 15, 2025
Merged

Resolve Race Conditions#5
alexplaka merged 12 commits intomasterfrom
resolve-race-conditions

Conversation

@alexplaka
Copy link
Owner

@alexplaka alexplaka commented Dec 7, 2025

One of the simulation parameters was not thread safe. This PR fixes this issue.

Key Changes:

  • Refactored regulated and Michaelis-Menten process methods to calculate transition probabilities in local variables instead of modifying the shared self.trans_p dictionary
  • Added optional transition_p parameter to _order_0, _order_1, and _order_2 methods to accept pre-calculated transition probabilities
  • Added Mermaid diagram documenting the simulation architecture

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves race conditions in the AbStochKin simulation when running in parallel mode by refactoring how transition probabilities are handled in regulated processes.

Key Changes:

  • Refactored regulated process methods to calculate transition probabilities in local variables instead of modifying the shared self.trans_p dictionary
  • Added optional transition_p parameter to _order_0, _order_1, and _order_2 methods to accept pre-calculated transition probabilities
  • Added Mermaid diagram documenting the simulation architecture

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
docs/simulation_architecture.mmd New Mermaid flowchart documenting the simulation architecture and component relationships
abstochkin/agentstatedata.py Reformatted np.concatenate call in __post_init__ for improved readability (no functional changes)
abstochkin/_simulation_methods.py Resolved race condition by passing transition probabilities as parameters instead of modifying shared dictionary; updated 12 process-handling methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alexplaka alexplaka merged commit 05e32df into master Dec 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments