This code is a port of the MATLAB LineSampling class from the OpenCossan generalised uncertainty quantification software.
For more information about the software see the OpenCossan page.
The code requires at least Python 3.6. This version of the code is significantly simplified. If you want to use the code with a third party solver (e.g. high-fidelity model) then you may wish to download OpenCossan, which is freely available after registration. The MATLAB version of the code contains many optimisations to improve the performance of the code.
If you find this code useful for your research and decide to use it in a paper please cite the following paper:
de Angelis, Marco, Edoardo Patelli, and Michael Beer. "Advanced line sampling for efficient robust reliability analysis." Structural safety 52 (2015): 170-182. DOI: 10.1016/j.strusafe.2014.10.002
@article{deangelis2015,
title={Advanced line sampling for efficient robust reliability analysis},
author={de Angelis, Marco and Patelli, Edoardo and Beer, Michael},
journal={Structural safety},
volume={52},
pages={170--182},
year={2015},
publisher={Elsevier}
}
RP8 - Linear performance function with six lognormal variables.
RP14 - Non-linear performance function with five random variables.
RP22 - Quadratic function with mixed term, convex.
RP24 - Non-linear performance with two normal random variables.
from sampling import linesampling as ls
from sampling import dists as dists
from reliability.tnochallenge import problem
RP14 = problem('RP14') # Import problem data
C14 = RP14.inputs() # Copula function for the input distributions
print(RP14)
Name: RP14 Link: https://rprepo.readthedocs.io/en/latest/reliability_problems.html#sec-rp-14
alpha = ls.initialiseAlpha(RP14,C14,gradient=True)
print(alpha)
[-0.36487337, 0.03357331, 0.84283305, 0.07948445, 0.38607633]
LS = ls.LineSampling(lines=50,alpha=alpha,linegrid=[0,1,2,3,4,5,6,7])
pF, b, dp, LSdata, LSdata2, cvar, PFLine = LS.failureProbability(C14,RP14,additional=2)
print('failure probability: [%.2e, %.2e]'%(pF[0],pF[1]))
print('reliability index: [%g, %g]'%(b[0],b[1]))
print('coeff. of variation: %g'%cvar)
print('total number of runs: %i'%RP14.evaluations())
failure probability: [3.41e-04, 1.11e-03]
reliability index: [3.05884, 3.39638]
coeff. of variation: 0.110849
total number of runs: 166
LS.plot([LSdata],space='X')