Simulate Examples: Chan2 and AU2
This page documents two simulate runs using different Monte Carlo modes.
Note: Table values are rounded to 4 significant figures for readability. Very small/large values use scientific notation. Refer to the linked Excel/JSON artifacts for full precision.
- Example 1 — Chan2: plain Monte Carlo, no importance sampling.
- Example 2 — AU2: Monte Carlo with importance sampling (
-iflag).
Both runs use the default profile.
Profile Customization
These examples use the default profile, but simulation behavior is configurable. See ../profile-reference.md.
- Monte Carlo controls:
reliability_options.mc_n,mc_max_cv,mc_seed,mc_remove_oob. - Importance sampling controls:
run_configuration.mc_with_is(or-i),reliability_options.is_method,is_kde_bandwidth,is_fit_samples,is_mixture_components,is_mcmc_*. - Report toggles:
reporting_options.save_plots_to_pdf,save_plots_to_pickle,save_excel_summary.
Example 1: Chan2 — Plain Monte Carlo
Run Context
Problem module:
problems/problems2/Chan2Problem.py
Recorded result set:
results/2026-03-16/10-52-46/Chan2-51baa.xlsxresults/2026-03-16/10-52-46/Chan2-51baa.jsonresults/2026-03-16/10-52-46/profile-51baa.yaml
For your own runs, use the same naming pattern under a different timestamped folder:
results/<YYYY-MM-DD>/<HH-MM-SS>/<ProblemName>-<suffix>.xlsxresults/<YYYY-MM-DD>/<HH-MM-SS>/<ProblemName>-<suffix>.jsonresults/<YYYY-MM-DD>/<HH-MM-SS>/profile-<suffix>.yaml
Note: <YYYY-MM-DD>/<HH-MM-SS> and <suffix> are generated per run and will differ on your machine.
Profile and run mode from saved profile:
- Profile used:
default run_type: simulateinclude_mc: truemc_with_is: false
Results path/ID convention used in this example:
- Results are saved under
results/<YYYY-MM-DD>/<HH-MM-SS>/(date and time subfolders). - Each run gets a new random request ID; the exact ID changes every time the analysis is run.
- Output files include the last 5 digits of that request ID in their names.
Equivalent command shape:
python -m reliafy simulate <profile>
The simulate command without -i runs plain (crude) Monte Carlo only.
Problem File Used
Source: Chan, C. L. and Low, B. K., "Practical second-order reliability analysis applied to foundation engineering," International Journal for Numerical and Analytical Methods in Geomechanics, 2012, vol. 36, no. 11, p. 1387–1409, Problem 2, p. 1397. DOI: 10.1002/nag.1057
Chan2Problem.py defines:
- Stochastic variables:
cp,fp,g,Ph,Pv— all Normal - Correlation: full 5 × 5 matrix defined using the
corkey (see note below) - Deterministic variables:
B = 5.0,L = 25.0,D = 1.8,h = 2.5 LSFreturnsGradient: False,LSFreturnsHessian: False,LSFreturnsLandR: True- Limit state returns load ($P_v / B'$) and resistance (bearing-capacity formula)
Using cor vs cor_list
Chan2Problem.py specifies the correlation matrix as a full n × n list of lists under the cor key.
This is an alternative to cor_list, which accepts a flat list of [var1, var2, value] pairs.
If neither cor nor cor_list is supplied, Reliafy assumes zero correlation for all variables.
Either key may be used; the full matrix form is convenient when many off-diagonal correlations are non-zero.
"StochasticVariables": {
"name": ["cp", "fp", "g", "Ph", "Pv"],
"type": ["normal", "normal", "normal", "normal", "normal"],
"cor": [
[1.0, -0.5, 0.0, 0.0, 0.0],
[-0.5, 1.0, 0.5, 0.0, 0.0],
[0.0, 0.5, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.5],
[0.0, 0.0, 0.0, 0.5, 1.0],
],
"mean": [15.0, 25.0, 20.0, 400.0, 800.0],
"std": [4.5, 5.0, 2.0, 40.0, 80.0],
},
Because LSFreturnsLandR: True, the CLI generates a Load and Resistance Histogram in addition to the per-variable and LSF histograms.
Extracted Results Worksheet Tables
The tables below are transcribed from the Results worksheet in Chan2-51baa.xlsx.
Header Information
| Field | Value |
|---|---|
| Problem | Chan2 |
| Request ID | 9614c856e5bb41f4b96bd9b1d4051baa |
| Run time | 00 min 25.62 sec |
Deterministic Variables
| var_name | value |
|---|---|
| B | 5 |
| L | 25 |
| D | 1.8 |
| h | 2.5 |
Stochastic Variables Definition
| var_name | var_type | mean | std | param1 | param2 |
|---|---|---|---|---|---|
| cp | Normal | 15 | 4.5 | 15 | 4.5 |
| fp | Normal | 25 | 5 | 25 | 5 |
| g | Normal | 20 | 2 | 20 | 2 |
| Ph | Normal | 400 | 40 | 400 | 40 |
| Pv | Normal | 800 | 80 | 800 | 80 |
Monte Carlo Results
| beta | pf | cv | max_cv | size | %_removed | cycles | auto_size | mc_with_is |
|---|---|---|---|---|---|---|---|---|
| 1.5409 | 0.06167 | 0.002252 | 0.05 | 3,000,000 | 0.000733 | 3 | True | False |
Monte Carlo Variable Statistics and Correlations
The sampled statistics confirm the input distributions and correlation structure.
| var_name | mean | std | %_oob | cor(cp) | cor(fp) | cor(g) | cor(Ph) | cor(Pv) |
|---|---|---|---|---|---|---|---|---|
| cp | 14.9993 | 4.4999 | 0 | 1.0000 | −0.4999 | 0.0003 | 0.0003 | 0.0008 |
| fp | 24.9972 | 4.9994 | 0 | −0.4999 | 1.0000 | 0.5003 | −0.0008 | 0.0000 |
| g | 19.9997 | 2.0012 | 0 | 0.0003 | 0.5003 | 1.0000 | 0.0001 | 0.0008 |
| Ph | 400.035 | 39.985 | 0 | 0.0003 | −0.0008 | 0.0001 | 1.0000 | 0.5006 |
| Pv | 799.993 | 79.962 | 0 | 0.0008 | 0.0000 | 0.0008 | 0.5006 | 1.0000 |
Notes Reported by Reliafy
- Validation: Stochastic variables definition and limit state function validation required 1 function call.
- Monte Carlo: Completed 3 cycles with
1.00e+06samples per cycle. - Monte Carlo: Detected 22 NaN values in the limit state function out of
3.00e+06samples. Review the list of code warnings and update the limit state function to address their source.
Interpretation Snapshot
beta = 1.541,pf = 6.17%— a relatively low reliability index for a bearing-capacity problem with correlated soil parameters.- The coefficient of variation (
cv = 0.00225) is well belowmax_cv = 0.05, indicating high MC precision with 3 million samples. - The sampled correlation matrix closely matches the targets:
cor(cp, fp) ≈ −0.500,cor(fp, g) ≈ 0.500,cor(Ph, Pv) ≈ 0.501. - A small number of NaN results (22 out of 3,000,000) were detected. These typically arise from geometric degeneration in the bearing-capacity formula (e.g.,
B' ≤ 0due to large eccentricity). They do not invalidate the result at this sample size.
Generated Figures
The PDF result file for this run is saved as results/2026-03-16/10-52-46/Chan2-51baa.pdf.
That PDF is composed of vector-based pages, rendered below at 2× resolution from each page.
Figure 1: MC Histogram — cp

Figure 2: MC Histogram — fp

Figure 3: MC Histogram — g

Figure 4: MC Histogram — Ph

Figure 5: MC Histogram — Pv

Figure 6: Histogram of Limit State Function Values

Figure 7: Load and Resistance Histogram
Generated because LSFreturnsLandR: True in the problem file.

Example 2: AU2 — Monte Carlo with Importance Sampling
Run Context
Problem module:
problems/AU2Problem.py
Recorded result set:
results/2026-03-16/11-06-54/AU2-42d54.xlsxresults/2026-03-16/11-06-54/AU2-42d54.jsonresults/2026-03-16/11-06-54/profile-42d54.yaml
For your own runs, use the same naming pattern under a different timestamped folder:
results/<YYYY-MM-DD>/<HH-MM-SS>/<ProblemName>-<suffix>.xlsxresults/<YYYY-MM-DD>/<HH-MM-SS>/<ProblemName>-<suffix>.jsonresults/<YYYY-MM-DD>/<HH-MM-SS>/profile-<suffix>.yaml
Note: <YYYY-MM-DD>/<HH-MM-SS> and <suffix> are generated per run and will differ on your machine.
Profile and run mode from saved profile:
- Profile used:
default run_type: simulateinclude_mc: truemc_with_is: true
Equivalent command shape:
python -m reliafy simulate <profile> -i
The -i flag enables importance sampling (IS), which drastically reduces the number of samples needed to estimate very small failure probabilities by concentrating samples near the failure region.
Problem File Used
Source: Au, S. K. and Beck, J. L., "A new adaptive importance sampling scheme for reliability calculations," Structural Safety, vol. 21, no. 2, 1999, pp. 135–158. Available at: https://people.duke.edu/~hpgavin/risk/Au-1999.pdf
AU2Problem.py defines:
- Stochastic variables:
T1,T2— both standard Normal (μ = 0, σ = 1) - Deterministic variables:
c = 5 LSFreturnsGradient: False,LSFreturnsHessian: False,LSFreturnsLandR: False- Compound limit state: $g = \min(g_1, g_2)$
$$ g_1 = c - 1 - T_2 + e^{-T_1^2/10} + \left(\frac{T_1}{5}\right)^4 $$
$$ g_2 = \frac{c^2}{2} - T_1 T_2 $$
ISplotkey defined — required for IS diagnostics plots
ISplot key
The ISplot key works like LSFplot and RFADplot: it specifies the axis variables and plot extents used to render the IS proposal distribution diagnostics. When running with -i, the CLI uses ISplot to produce the IS Proposal Diagnostics figures (both u-space and x-space views). If ISplot is absent, the diagnostics plots will not be generated.
"ISplot": {
"x_var": "T1",
"x_lim": [-5.0, 5.0],
"y_var": "T2",
"y_lim": [-5.0, 5.0],
},
Extracted Results Worksheet Tables
The tables below are transcribed from the Results worksheet in AU2-42d54.xlsx.
Header Information
| Field | Value |
|---|---|
| Problem | AU2 |
| Request ID | cfcb942355da4179b9b48eb4dfa42d54 |
| Run time | 00 min 08.93 sec |
Deterministic Variables
| var_name | value |
|---|---|
| c | 5 |
Stochastic Variables Definition
| var_name | var_type | mean | std | param1 | param2 |
|---|---|---|---|---|---|
| T1 | Normal | 0 | 1 | 0 | 1 |
| T2 | Normal | 0 | 1 | 0 | 1 |
Monte Carlo Results (with Importance Sampling)
| beta | pf | cv | max_cv | size | %_removed | cycles | auto_size | mc_with_is | method | bandwidth | fit_samples |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 4.7775 | 8.873e−7 | 0.02978 | 0.05 | 6,000 | 8.333% | 3 | True | True | kde | 0.2817 | 2,000 |
Key IS parameters:
- method:
kde— the IS proposal distribution was fitted as a kernel density estimate. - bandwidth:
0.2817— KDE bandwidth used for the proposal. - fit_samples:
2,000— number of samples drawn near the failure region to fit the proposal.
Monte Carlo Variable Statistics and Correlations (IS-weighted)
IS-weighted statistics
Because importance sampling re-weights each sample, the tabulated means and standard deviations reflect the proposal distribution, not the original input distributions. This is expected behavior.
| var_name | mean | std | %_oob | cor(T1) | cor(T2) |
|---|---|---|---|---|---|
| T1 | −0.2182 | 3.5806 | 0 | 1.0000 | 0.5670 |
| T2 | 2.3820 | 4.2807 | 0 | 0.5670 | 1.0000 |
Notes Reported by Reliafy
- Validation: Stochastic variables definition and limit state function validation required 4 function calls.
- Monte Carlo: Creation of importance sampling proposal distribution required 109,980 calls to the limit state function.
- Monte Carlo: Completed 3 cycles with
2.00e+03samples per cycle. - Monte Carlo: 0.03% of
T1and 0.05% ofT2values were not finite (NaN, inf, complex) out of6.00e+03samples and were excluded from the Monte Carlo statistics. - Monte Carlo: Load and resistance histograms are not available because
LSFreturnsLandR: False, so the limit state function returns empty load/resistance placeholders.
Interpretation Snapshot
- The failure probability is very small (
pf ≈ 8.87 × 10⁻⁷,beta ≈ 4.78), making plain Monte Carlo impractical — it would require on the order of 10⁸ samples for reliable estimation. Importance sampling achieves good precision with only 6,000 weighted samples. - The
cv = 0.0298is belowmax_cv = 0.05, confirming adequate IS precision for this run. - The IS proposal construction required ~110,000 LSF evaluations to locate and characterize the failure region before the weighted sampling phase began.
- The IS-weighted variable statistics (
T1mean ≈ −0.22,T2mean ≈ 2.38) clearly reflect bias toward the failure region, which is expected and correct. - No load/resistance histogram is generated because
LSFreturnsLandR: False, soLandRare returned as empty placeholders.
Generated Figures
The PDF result file for this run is saved as results/2026-03-16/11-06-54/AU2-42d54.pdf.
Figure 1: IS Proposal Diagnostics (u-space)
The KDE proposal distribution in standard-normal space. Contour lines show the proposal PDF; the failure region boundary is visible.

Figure 2: IS Proposal Diagnostics (x-space)
The same proposal distribution plotted in original variable space (T1, T2).

Figure 3: IS Histogram — T1

Figure 4: IS Histogram — T2

Figure 5: Limit State Function Histogram (Importance Sampling)

Reproducing These Examples
- Ensure the problem file is present at the path shown in the run context.
- Run the appropriate command with the desired profile.
For Chan2 (plain MC):
python -m reliafy simulate <profile>
For AU2 (with importance sampling):
python -m reliafy simulate <profile> -i
- Open the timestamped folder under
results/<date>/<time>/. - Use
*.xlsx(Resultsworksheet) for tabular summaries and*.jsonfor machine-readable values. - For a Chan2-style run, the Load and Resistance Histogram requires
LSFreturnsLandR: Trueand non-emptyL,Routputs in the problem file. - For an AU2-style IS run, the IS Proposal Diagnostics figures require the
ISplotkey in the problem dict.