You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SciPy优化未返回预期最优解:双T截面惯性矩问题排查

双T截面惯性矩优化:SciPy minimize结果与解析解不符

我正在为硕士论文优化双T截面的惯性矩函数,通过SciPy的minimize函数最大化double_T_Ixx,但优化输出与已知解析解不符。

目标函数定义

def double_T_Ixx(lengths, thicknesses):
    A_top_l = lengths[0] * thicknesses[0]
    A_top_r = lengths[1] * thicknesses[1]
    A_mid   = lengths[2] * thicknesses[2]
    A_bot_l = lengths[3] * thicknesses[3]
    A_bot_r = lengths[4] * thicknesses[4]

    y_top = lengths[2]
    y_mid = lengths[2] / 2
    y_bot = 0

    Ixx_top_l = (lengths[0] * thicknesses[0]**3) / 12
    Ixx_top_r = (lengths[1] * thicknesses[1]**3) / 12
    Ixx_mid   = (thicknesses[2] * lengths[2]**3) / 12
    Ixx_bot_l = (lengths[3] * thicknesses[3]**3) / 12
    Ixx_bot_r = (lengths[4] * thicknesses[4]**3) / 12

    A_total = A_top_l + A_top_r + A_mid + A_bot_l + A_bot_r
    y_composite = (A_top_l*y_top + A_top_r*y_top + A_mid*y_mid + A_bot_l*y_bot + A_bot_r*y_bot) / A_total

    Ixx = (Ixx_top_l + 
           Ixx_top_r + 
           Ixx_mid + 
           Ixx_bot_l + 
           Ixx_bot_r +
           A_top_l*(y_top - y_composite)**2 +
           A_top_r*(y_top - y_composite)**2 +
           A_mid  *(y_mid - y_composite)**2 +
           A_bot_l*(y_bot - y_composite)**2 +
           A_bot_r*(y_bot - y_composite)**2)
    return Ixx

优化目标与约束定义

MIN_LENGTHS   = 1
MAX_LENGTH    = 10
MIN_THICKNESS = 0.5
MAX_THICKNESS = 2.5
MAX_AREA      = 10

def objective(x):
    num_segments = len(x) // 2
    lengths = x[:num_segments]
    thicknesses = x[num_segments:]
    
    return -double_T_Ixx(lengths, thicknesses)
    
def constraint_area(x):
    lengths = x[:len(x)//2]
    thicknesses = x[len(x)//2:]
    A_top_l = lengths[0] * thicknesses[0]
    A_top_r = lengths[1] * thicknesses[1]
    A_mid   = lengths[2] * thicknesses[2]
    A_bot_l = lengths[3] * thicknesses[3]
    A_bot_r = lengths[4] * thicknesses[4]
    return MAX_AREA - (A_top_l + A_top_r + A_mid + A_bot_l + A_bot_r)

预期最优解

根据领域知识,该问题存在多组最优解(目标值一致但参数不同),其中一组代表性解为:

c = [l1 = 1, 
     l2 = 1, 
     l3 = 10, 
     l4 = 1, 
     l5 = 1,
 
     t1 = 1.25, 
     t2 = 1.25, 
     t3 = 0.5, 
     t4 = 1.25, 
     t5 = 1.25]   

核心规律:l3取最大值、t3取最小值,l1/l2/l4/l5取最小值,t1/t2/t4/t5取最大值,且满足面积约束。

SciPy优化尝试

使用SLSQP算法进行优化:

constraints = [{'type':'eq', 'fun':lambda x: constraint_area(x)}]
initial_guess = [(b[0] + b[1] / 2) for b in bounds]

result = minimize(
    fun=objective,
    x0=initial_guess,
    method='SLSQP',
    bounds=bounds,
    constraints=constraints,
    tol=1e-12,
    options={'disp': True}
)

当前问题

优化得到的目标值接近解析解,但参数值不符合预期:
[2.265, 2.265, 10.000, 2.321, 2.270, 0.532, 0.567, 0.500, 0.562, 0.531]
预期中l1/l2/l4/l5应等于1,t1/t2/t4/t5应取最大值。

疑问

  • 如何修改优化配置以得到预期最优解?
  • 该问题是否不适配SciPy优化器?
  • 还是我在建模或设置中存在遗漏?

内容的提问来源于stack exchange,提问作者Finn Eggers

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 21:47:35