多目标优化:焊接梁设计问题

Multiobjective optimization: welded beam design problem

我很难设置变量的界限。使用下面的代码我得到这个错误

VariableError: The initial value 0.1 should be between the upper (2) and lower (inf) bounds.

我知道焊梁问题不需要初始值,所以我很困惑。

var_names = ["x1", "x2", "x3", "x4"]

upper_bounds = [2, 10, 10, 2]
lower_bounds = [0.1, 0.1, 0.1, 0.1]

variables = variable_builder(var_names, lower_bounds, upper_bounds)

缺少函数调用initial_values。正因为如此,下界取首字母,upper_bounds取下界,上界设为无穷大。最简单的修复:将下限作为初始值传递(但更明智的猜测会更好):

variables = variable_builder(var_names, lower_bounds, lower_bounds, upper_bounds)

这个函数的signature是:

def variable_builder(
    names: List[str],
    initial_values: Union[List[float], np.ndarray],
    lower_bounds: Union[List[float], np.ndarray] = None,
    upper_bounds: Union[List[float], np.ndarray] = None,
)