.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_reliability_sensitivity/reliability/plot_estimate_probability_randomized_qmc.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_reliability_sensitivity_reliability_plot_estimate_probability_randomized_qmc.py: Use a randomized QMC algorithm ============================== .. GENERATED FROM PYTHON SOURCE LINES 6-7 In this example we are going to estimate a failure probability on the :ref:`cantilever beam `. .. GENERATED FROM PYTHON SOURCE LINES 9-16 .. code-block:: default from __future__ import print_function from openturns.usecases import cantilever_beam as cantilever_beam import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 17-18 We load the data class containing the probabilistic modeling of the beam. .. GENERATED FROM PYTHON SOURCE LINES 18-20 .. code-block:: default cb = cantilever_beam.CantileverBeam() .. GENERATED FROM PYTHON SOURCE LINES 21-22 We load the joint probability distribution of the input parameters : .. GENERATED FROM PYTHON SOURCE LINES 22-24 .. code-block:: default distribution = cb.distribution .. GENERATED FROM PYTHON SOURCE LINES 25-26 We load the model as well, .. GENERATED FROM PYTHON SOURCE LINES 26-28 .. code-block:: default model = cb.model .. GENERATED FROM PYTHON SOURCE LINES 29-30 We create the event whose probability we want to estimate. .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. code-block:: default vect = ot.RandomVector(distribution) G = ot.CompositeRandomVector(model, vect) event = ot.ThresholdEvent(G, ot.Greater(), 0.3) .. GENERATED FROM PYTHON SOURCE LINES 37-38 Define the low discrepancy sequence. .. GENERATED FROM PYTHON SOURCE LINES 40-42 .. code-block:: default sequence = ot.SobolSequence() .. GENERATED FROM PYTHON SOURCE LINES 43-44 Create a simulation algorithm. .. GENERATED FROM PYTHON SOURCE LINES 46-53 .. code-block:: default experiment = ot.LowDiscrepancyExperiment(sequence, 1) experiment.setRandomize(True) algo = ot.ProbabilitySimulationAlgorithm(event, experiment) algo.setMaximumCoefficientOfVariation(0.05) algo.setMaximumOuterSampling(int(1e5)) algo.run() .. GENERATED FROM PYTHON SOURCE LINES 54-55 Retrieve results. .. GENERATED FROM PYTHON SOURCE LINES 57-60 .. code-block:: default result = algo.getResult() probability = result.getProbabilityEstimate() print('Pf=', probability) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Pf= 0.0 .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.512 seconds) .. _sphx_glr_download_auto_reliability_sensitivity_reliability_plot_estimate_probability_randomized_qmc.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_estimate_probability_randomized_qmc.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_estimate_probability_randomized_qmc.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_