pystra.mc.CrudeMonteCarlo#
- class CrudeMonteCarlo(analysis_options=None, limit_state=None, stochastic_model=None, point=None)[source]#
Bases:
MonteCarlo
Crude Monte Carlo simulation (CMC)
The Crude Monte Carlo simulation (CMC) is the most simple form and corresponds to a direct application of Equation (24). A large number \(n\) of samples are simulated for the set of random variables \({\bf X}\). All samples that lead to a failure are counted \(n_f\) and after all simulations the probability of failure \(p_f\) may be estimated by [Faber2009]
\[\tilde{p}_f = \frac{n_f}{n}\]Theoretically, an infinite number of simulations will provide an exact probability of failure. However, time and the power of computers are limited; therefore, a suitable amount of simulations \(n\) are required to achieve an acceptable level of accuracy.
- Attributes:
analysis_option (AnalysisOption): Option for the structural analysis
limit_state (LimitState): Information about the limit state
stochastic_model (StochasticModel): Information about the model
point (vec): Design point for the simulation
Methods
Compute beta value
Return an optimal amount of bins for a histogram
Compute Coefficient of Variation
Compute probability of failure
Evaluate limit-state function
Compute percent done
Compute random numbers
Collect result of sampling
Update summation
Compute transformation from u to x space
Returns the beta value
Returns the amount on bins
Returns data for the failure
Returns the probability of failure
Derived classes call this at top of their run()
Initialization of the simulation variables
run
Set design point
Show results and plots
- computeBeta()#
Compute beta value
- computeBins(samples)#
Return an optimal amount of bins for a histogram
- Returns:
bins (int): Returns amount on bins
- computeCoefficientOfVariation()#
Compute Coefficient of Variation
- computeFailureProbability()#
Compute probability of failure
- computeLimitState()#
Evaluate limit-state function
- computePercentDone()#
Compute percent done
- computeRandomNumbers()#
Compute random numbers
- computeResults()#
Collect result of sampling
- computeSumUpdate()#
Update summation
- computeTransformation()#
Compute transformation from u to x space
Note
TODO: this method takes a lot of time, find some better solution.
- getBeta()#
Returns the beta value
- Returns:
beta (float): Returns the beta value
- getBins()#
Returns the amount on bins
- Returns:
bins (int): Returns the amount on bins (histogram)
- getDistributionData()#
Returns data for the failure
- Returns:
all_G (float): Returns data from the distribution
- getFailure()#
Returns the probability of failure
- Returns:
Pf (float): Returns the probability of failure
- init_run()#
Derived classes call this at top of their run()
- setPoint(point=None)#
Set design point