Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: Implement Adaptive Simulation based on Convergence Criteria #892

Assignees
Malmahrouqi3
Labels
EnhancementNew feature or request, including adjustments in current codesMonte CarloMonte Carlo and related contents
@Gui-FernandesBR

Description

@Gui-FernandesBR

Is your feature request related to a problem? Please describe.
Currently, the user must guess thenumber_of_simulations (e.g., 1000 or 5000) before running the analysis.

  • If the number is too low, the results are statistically insignificant.
  • If the number is too high, computational time is wasted.

Users need a way to define atarget precision (e.g., "I want the estimate of the Apogee to be accurate within$\pm 10$ meters") and have the simulation run exactly as many times as necessary to achieve that.

Describe the solution you'd like
Implement an automated convergence loop. Instead of specifying a fixed number of simulations, the user specifies atarget variable (e.g., Apogee), aconfidence level, and atolerance width.

TheMonteCarlo class should:

  1. Run a small batch of simulations.
  2. Calculate the Confidence Interval (CI) width for the target variable (using the bootstrapping method).
  3. Check ifCI_width <= tolerance.
  4. If yes, stop. If no, run another batch and repeat.

Implementation Details

  • Dependency: This relies on the completion of the "Bootstrapping/CI" issue.
  • New Method: Introduce a method likesimulate_until_convergence or extend the existingsimulate method with new arguments.
  • Batching: To avoid the overhead of recalculating statistics afterevery single flight, simulations should run in chunks (e.g., checking convergence every 50 or 100 flights).

Proposed Usage

analysis=MonteCarlo(...)# "Run simulations until the 95% Confidence Interval# for Apogee is narrower than 20 meters."analysis.simulate_convergence(target_variable="apogee",target_confidence=0.95,tolerance=20.0,# The desired width of the CImin_simulations=100,max_simulations=10000,# Safety stop to prevent infinite loopsbatch_size=50)

Acceptance Criteria

  • Implement the convergence loop logic.
  • Ensure a safety cap (max_simulations) prevents infinite loops if convergence is never met.
  • Allow the user to define the "check frequency" or batch size.
  • Log the progress (e.g., "Iteration 500: CI width is 45m... Continuing").
  • Add unit tests demonstrating that the simulation stops once the tolerance is reached.

Additional Context

  • Performance Note: Calculating the bootstrap CI is computationally expensive. It is crucial that this check is not performed after every single flight, but rather in batches.

Metadata

Metadata

Assignees

Labels

EnhancementNew feature or request, including adjustments in current codesMonte CarloMonte Carlo and related contents

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp