Skip to content

Fix simulate function returning 0 for non-failing components#160

Open
Chessing234 wants to merge 1 commit intomitmath:Fall24from
Chessing234:fix/simulate-component-failure
Open

Fix simulate function returning 0 for non-failing components#160
Chessing234 wants to merge 1 commit intomitmath:Fall24from
Chessing234:fix/simulate-component-failure

Conversation

@Chessing234
Copy link
Copy Markdown

Summary

  • Fixes the simulate function in simulating_component_failure.jl where components that do not fail within the maximum number of time steps were incorrectly assigned a failure time of 0 instead of the maximum time step value.
  • Changed the sentinel value from 0 to max_steps so non-failing components correctly report max_steps as their failure time.
  • Added max_steps as a configurable parameter with a default of 100, maintaining backward compatibility.

Fixes #154

Test plan

  • Run the notebook with small p values (e.g., p = 0.01) and verify that no component shows a failure time of 0.
  • Run with p = 1.0 to confirm all components still fail at t = 1.
  • Verify the heatmap visualization displays correctly with the updated values.

🤖 Generated with Claude Code

Components that do not fail within the maximum number of time steps
were incorrectly assigned a failure time of 0. Changed the sentinel
value from 0 to max_steps so that non-failing components correctly
report the maximum time step value. Also added max_steps as a
configurable parameter (default 100).

Fixes mitmath#154

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

An error in the function simulate in simulating_component_failure.jl

1 participant