RocketPy icon indicating copy to clipboard operation
RocketPy copied to clipboard

BUG: Paralle Monte Carlo simulation giving incorrect iterations

Open emtee14 opened this issue 6 months ago • 3 comments

When running the parallel Monte Carlo simulations, there is a printout that shows the current iterations, iteration runtime, and estimated time left. When running in parallel, though, the value goes up and down due to this line https://github.com/RocketPy-Team/RocketPy/blob/4df0b383c2886c7804b6848bbe5b9cbe612b2cd5/rocketpy/simulation/monte_carlo.py#L431

This means that the message is printed with the same index as the last completed iteration, so when an earlier iteration takes longer, it updates it with a lower value.

I propose to fix this by having a counter that will keep track and just increment each time. This counter can be incremented when the output is written to a file, and can be thread-safe since it will only be accessed when the mutex is acquired. Also changing the printout of current iteration to iterations completed or something of that nature.

Screenshots

https://github.com/user-attachments/assets/984e895b-01e0-453e-a127-061a7ab269f0

emtee14 avatar Apr 18 '25 21:04 emtee14