def test_ReliabilityBenchmarkProblem111(self): problem = otb.ReliabilityProblem111() print(problem) # Check probability pf = problem.getProbability() pf_exacte = 7.65e-7 np.testing.assert_allclose(pf, pf_exacte, rtol=1.0e-15) # Check function event = problem.getEvent() function = event.getFunction() X = [0.0, 0.0] Y = function(X) assert type(Y) is ot.Point np.testing.assert_allclose(Y[0], 12.5)
def test_UseCase(self): problem = otb.ReliabilityProblem111() event = problem.getEvent() # Create a Monte Carlo algorithm experiment = ot.MonteCarloExperiment() algo = ot.ProbabilitySimulationAlgorithm(event, experiment) algo.setMaximumCoefficientOfVariation(0.05) algo.setMaximumOuterSampling(int(1e5)) algo.run() # Retrieve results result = algo.getResult() computed_pf = result.getProbabilityEstimate() exact_pf = problem.getProbability() print("exact_pf=", exact_pf) print("computed_pf=", computed_pf) samplesize = result.getOuterSampling() * result.getBlockSize() print("Sample size : ", samplesize) atol = 1.0 / np.sqrt(samplesize) np.testing.assert_allclose(computed_pf, exact_pf, atol=atol)
def ReliabilityBenchmarkProblemList(): """ Returns the list of reliability benchmark problems. Returns ------- problems : list A list of ReliabilityProblem. """ p8 = otb.ReliabilityProblem8() p14 = otb.ReliabilityProblem14() p22 = otb.ReliabilityProblem22() p24 = otb.ReliabilityProblem24() p25 = otb.ReliabilityProblem25() p28 = otb.ReliabilityProblem28() p31 = otb.ReliabilityProblem31() p33 = otb.ReliabilityProblem33() p35 = otb.ReliabilityProblem35() p38 = otb.ReliabilityProblem38() p53 = otb.ReliabilityProblem53() p55 = otb.ReliabilityProblem55() p54 = otb.ReliabilityProblem54() p57 = otb.ReliabilityProblem57() p75 = otb.ReliabilityProblem75() p89 = otb.ReliabilityProblem89() p107 = otb.ReliabilityProblem107() p110 = otb.ReliabilityProblem110() p111 = otb.ReliabilityProblem111() p63 = otb.ReliabilityProblem63() p91 = otb.ReliabilityProblem91() p60 = otb.ReliabilityProblem60() p77 = otb.ReliabilityProblem77() pFBS = otb.FourBranchSerialSystemReliability() pRS = otb.RminusSReliability() pBeam = otb.AxialStressedBeamReliability() problemslist = [ p8, p14, p22, p24, p25, p28, p31, p33, p35, p38, p53, p55, p54, p57, p75, p89, p107, p110, p111, p63, p91, p60, p77, pFBS, pRS, pBeam, ] return problemslist