| MC_CRUDE | R Documentation |
Crude Monte Carlo simulation (MC_CRUDE) method for the estimation of failure probabilities in structural reliability analysis.
The failure probability is estimated as
\hat{p}_f = \frac{1}{N}
\sum_{i=1}^{N}
\mathbf{1}_{\{g(\mathbf{X}_i) < 0\}}.
Failure is defined as g(x) < 0. Samples with g(x) = 0 are
counted as safe.
Although conceptually simple and unbiased, the method becomes computationally inefficient for very small failure probabilities, as a large number of samples is required to obtain stable estimates.
MC_CRUDE(
lsf,
lDistr,
cov_user = 0.05,
n_batch = 10000,
n_max = 1e+07,
use_threads = NULL,
backend = NULL,
dataRecord = TRUE,
debug.level = 0,
seed = NULL
)
lsf |
Limit-state function. Must follow the LSF interface specification described in the "Limit-State Function (LSF) Interface" section below. |
lDistr |
List of distribution objects as returned by
|
cov_user |
Target coefficient of variation to be achieved. |
n_batch |
Number of samples per batch. |
n_max |
Maximum number of Monte Carlo samples. |
use_threads |
Number of workers for |
backend |
Parallel backend, |
dataRecord |
Logical; if |
debug.level |
Integer controlling verbosity (0 = silent, 2 = detailed output). |
seed |
Optional integer value for reproducible random numbers. |
Stopping criterion
The simulation stops when the coefficient of variation falls below
cov_user or when n_max samples are reached. The last batch is
reduced so that the total does not exceed n_max.
Parallel execution
The samples of each batch are generated in the master process and split into chunks, which are evaluated in parallel. The workers do not generate random numbers.
backend = "future": the chunks are evaluated with
future.apply::future_lapply() under the active future
plan. The function never changes the plan. The number of workers is
determined by the plan, use_threads has no effect and issues a
warning if supplied.
backend = "parallel": on Unix-like systems
parallel::mclapply() with use_threads cores is used. On
Windows a PSOCK cluster with use_threads workers is created for
the call and stopped afterwards. With use_threads = 1
lapply() is used.
Reproducibility
With a fixed seed the random numbers are generated from a
L'Ecuyer-CMRG stream in the master process. The result therefore does not
depend on the number of workers. The function sets
RNGkind("L'Ecuyer-CMRG") and changes .Random.seed in the
global environment.
MC_CRUDE returns a list with the following elements:
method: Character string "MC_CRUDE".
beta: Estimated reliability index \beta = -\Phi^{-1}(p_f).
pf: Estimated probability of failure.
var: Estimated variance of the Monte Carlo estimator.
cov_mc: Estimated coefficient of variation of pf.
cov_user: Target coefficient of variation.
n_mc: Total number of Monte Carlo samples generated.
n_max: Maximum allowed number of samples.
n_batch: Batch size.
n_threads: Number of workers used.
runtime: CPU time returned by proc.time().
data: Data frame with intermediate results
(only if dataRecord = TRUE).
The argument lsf must define a valid limit-state function
using one of the following supported signatures:
function(x)A single numeric vector x containing all basic variables
in the order defined in lDistr. Recommended.
function(Z, Fy, M, ...)Explicitly named scalar arguments corresponding to the variable names defined in the probabilistic model.
The use of function(...) as the sole argument is not supported.
On Windows, backend = "future" with
future::plan(future::multisession, workers = ...) is recommended.
backend = "parallel" creates a new PSOCK cluster for every call.
(C) 2021-2026 K. Nille-Hauf, T. Feiri, M. Ricker, T. Lux – Hochschule Biberach (until 2022), TU Dortmund University - Chair of Structural Concrete (since 2023)
Spaethe, G. (1991). Die Sicherheit tragender Baukonstruktionen. Springer.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.