3

我有一个在 OpenTURNS 中构建的可靠性模型,它有几个极限状态函数,可以取 2 到 8 个随机变量 (RV)。我最初的尝试是定义一个包含所有八个变量的 RandomVector,并将此 RandomVector 用于所有事件计算。对于二变量极限状态函数,使用 Monte Carlo 的结果是合理的,但使用 FORM 或 SORM 时完全不准确。但是,当我将 FORM 或 SORM 与仅包含两个 RV 用于二变量极限状态函数的 RandomVector 一起应用时,它运行良好。

正确的概率是 0.000427,而具有 8 变量模型的 FORM 和 SORM 都返回大约 1e-29 的值。对于双变量模型,FORM 返回正确的值 0.00427。

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

  • 八变量模型的设计点(见第一个和第三个元素): [-0.445716,0.0305458,3.30454,-0.119868,0.0317001,-0.0382662,-0.0233416,7.59606,7.5671]

  • 双变量模型的设计要点:[-0.438289,3.30553]

请参阅下面的reprex。我在 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)
4

1 回答 1

4

您使用 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!

于 2020-04-13T07:03:01.250 回答