使用 RandomVector 的子集时,OpenTURNS 可靠性模型中的结果非常不准确

Highly inaccurate result in OpenTURNS reliability model when using subset of RandomVector

我有一个内置于 OpenTURNS 中的可靠性模型,它具有多个极限状态函数,可以接受 2 到 8 个随机变量 (RV)。我最初的尝试是定义一个包含所有八个变量的单个 RandomVector,并将此 RandomVector 用于所有事件计算。对于双变量极限状态函数,使用 Monte Carlo 结果是合理的,但使用 FORM 或 SORM 时则完全不准确。但是,当我将 FORM 或 SORM 与仅包含双变量极限状态函数的两个 RV 的 RandomVector 一起应用时,效果很好。

正确概率为 0.000427,而 FORM 和 SORM 的八变量模型 return 值都在 1e-29 的数量级。对于双变量模型,FORM returns 是正确的值 0.00427。

使用二变量或八变量RandomVectors时设计点向量的分量相似:

请看下面的代表。我在 Windows 10.

上使用 OpenTURNS 1.14
# Define marginal distributions for wall thickness and depth
wt_dist = ot.Normal(0.156, 0.003666)
od_dist = ot.Normal(8.625, 0.0146625)
d_dist = ot.Normal(0.063, 0.0276486)
lg_dist = ot.Normal(2.36, 0.143478)
ys_dist = ot.Normal(57000, 2700)
ts_dist = ot.Normal(80565, 3868)
cv_dist = ot.TruncatedDistribution(ot.Normal(37, 5), 4)
mdlerr_dist = ot.Dirac(1)
press_dist = ot.Dirac(1140.3)

# Setup FORM optimizer
optimizer = ot.Cobyla()
eps = 1e-10
optimizer.setMaximumIterationNumber(5000)
optimizer.setMaximumAbsoluteError(eps)
optimizer.setMaximumRelativeError(eps)
optimizer.setMaximumResidualError(eps)
optimizer.setMaximumConstraintError(eps)

# === Full model ===
marginals = [
    wt_dist,
    od_dist,
    d_dist,
    lg_dist,
    ys_dist,
    ts_dist,
    cv_dist,
    mdlerr_dist,
    press_dist
    ]
n_vars = len(marginals)

# Define correlations between variables (using the normal copula)
cor_mat = ot.CorrelationMatrix(n_vars)
cor_mat[4, 5] = cor_mat[5, 4] = 0.98675
copula = ot.NormalCopula(cor_mat)
composed_dist = ot.ComposedDistribution(marginals, copula)
composed_dist.setName("Distributions")
composed_dist.setDescription(['WT', 'OD', 'D', 'L', 'YS', 'TS', 'CV', 'e', 'P'])
rv_vect = ot.RandomVector(composed_dist)  # vector of random variables

model = ot.SymbolicFunction(['WT', 'OD', 'D', 'L', 'YS', 'TS', 'CV', 'e', 'P'], ['WT-D'])
g = ot.CompositeRandomVector(model, rv_vect)
event = ot.ThresholdEvent(g, ot.Less(), 0.0)

# FORM test 1
algo = ot.FORM(optimizer, event, rv_vect.getMean())
algo.run()
result = algo.getResult()
prob_form1 = result.getEventProbability()
design_pt1 = result.getStandardSpaceDesignPoint()

# MC test 1
experiment = ot.MonteCarloExperiment()
algo = ot.ProbabilitySimulationAlgorithm(event, experiment)
algo.setMaximumCoefficientOfVariation(0.05)
algo.setMaximumOuterSampling(int(1e6))
algo.run()
result = algo.getResult()
prob_MC1 = result.getProbabilityEstimate()


# === Reduced model ===
marginals = [
    wt_dist,
    d_dist
    ]
n_vars = len(marginals)

# Define correlations between variables (using the normal copula)
cor_mat = ot.CorrelationMatrix(n_vars)
copula = ot.NormalCopula(cor_mat)
composed_dist = ot.ComposedDistribution(marginals, copula)
composed_dist.setName("Distributions")
composed_dist.setDescription(['WT', 'D'])
rv_vect = ot.RandomVector(composed_dist)  # vector of random variables

model = ot.SymbolicFunction(['WT', 'D'], ['WT-D'])
g = ot.CompositeRandomVector(model, rv_vect)
event = ot.ThresholdEvent(g, ot.Less(), 0.0)

# FORM test 2
algo = ot.FORM(optimizer, event, rv_vect.getMean())
algo.run()
result = algo.getResult()
prob_form2 = result.getEventProbability()
design_pt2 = result.getStandardSpaceDesignPoint()

# MC test 2
experiment = ot.MonteCarloExperiment()
algo = ot.ProbabilitySimulationAlgorithm(event, experiment)
algo.setMaximumCoefficientOfVariation(0.05)
algo.setMaximumOuterSampling(int(1e6))
algo.run()
result = algo.getResult()
prob_MC2 = result.getProbabilityEstimate()

print(prob_form1)
print(design_pt1)
print(prob_MC1)
print(prob_form2)
print(design_pt2)
print(prob_MC2)

您使用 Cobyla 优化算法,该算法非常稳健,但对模型的调用要求很高。在模型评估方面,Cobyla 的每次迭代都有一个与输入随机向量的维度成比例的成本,因为算法会构建和更新它的线性近似。当您将它与 8 个输入一起使用时,算法会停止,因为您达到了允许的最大评估次数(默认为 100),并且您会收到以下警告:

WRN - Warning! The Cobyla algorithm failed to converge. The error message is Maximum number of function evaluations reached

1.4631933217717485e-29

[-0.445716,0.0305458,3.30454,-0.119868,0.0317001,-0.0382662,-0.0233416,7.59606,7.5671]

0.0004238055834266587

0.0004273278619031894

[-0.438289,3.30553]

0.0004415498399381834

如果增加评估次数的限制,使用:

optimizer.setMaximumEvaluationNumber(100000)

然后你得到:

WRN - Warning! The Cobyla algorithm could not enforce the convergence criteria

0.0004273278619032821

[-0.438289,-3.05982e-08,3.30553,-2.76053e-08,-4.41471e-08,-4.71149e-08,-4.95428e-08,-5.77001e-09,1.00438e-07]

0.0004238055834266587

0.00042732786190326374

[-0.438289,3.30553]

0.0004415498399381834

此处出现警告是因为使用 Cobyla 的解决方案很难达到 1e-10 的精度。

感谢您使用 OpenTURNS!