我希望这些列以目标函数及其决策变量命名(图)

我想给出我的示例数据列名称。我希望这些列以目标函数及其决策变量命名,如下所示:f_1、f_2、h,b,l,t

样本数据:

sampler = qmc.LatinHypercube(d=4)
u_bounds = np.array([5.0, 5.0, 10.0, 10.0])

图片[1]-我希望这些列以目标函数及其决策变量命名(图)-唐朝资源网

l_bounds = np.array([0.125, 0.125, 0.1, 0.1]) data = sampler.lhs_method(100)*(u_bounds-(l_bounds)) + (l_bounds)

列名从何而来的优化问题:

def objectives (h,b,l,t):

    f1 = 1.10471*(h**2)*l + 0.04811*t*b*(14.0 + l)
    f2 = 2.1952 / (t**3)*b
    return f1,f2

为目标函数塑造数据:

y=np.zeros((100,2))   
for i in range(np.shape(data)[0]):
    y[i,0], y[i,1] = objectives(data[i,0], data[i,1], data[i,2], data[i,3])

我尝试了什么:

df = pd.DataFrame(data=data)
df.columns = ["h", "b", "l", "t"]
df.head()

frames = [df, y,]
result = pd.concat(frames)

错误是这样的:TypeError: cannot concatenate object of type ”;只有 Series 和 DataFrame obj 有效

那么对于这个问题,你会推荐什么修改?现在看来,这两个数据帧的当前形式不兼容。

© 版权声明
THE END
喜欢就支持一下吧
点赞126赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容