我很难为变量设置界限。通过下面的代码,我得到了这个错误
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)发布于 2022-04-27 19:47:34
函数调用缺少initial_values。因此,下界作为首字母,upper_bounds作为下界,上界设为无穷大。最简单的修正:将下限作为初始值传递(但更明智的猜测会更好):
variables = variable_builder(var_names, lower_bounds, lower_bounds, upper_bounds)此函数的签名是:
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,
)https://stackoverflow.com/questions/72034346
复制相似问题