如何基于数据框中的列为变量添加界限?

问题描述 投票:0回答:1

model.PVtoB = Var(model.T,bounds =(0,????))

尝试设置上述变量的界限。边界应由数据框中的“ Pv Generation”列指定。如何引用“ PV生成”列中的值?

python variables optimization bounds pyomo
1个回答
0
投票

最简单的方法是按照规则:

def PVtoB_bounds(m, t):
    # Use t index to extract desired lb and ub from the dataframe
    lb = DATAFRAME VALUE
    ub = DATAFRAME VALUE
    return (lb,ub)
model.PVtoB = Var(model.T, bounds=PVtoB_bounds)
© www.soinside.com 2019 - 2024. All rights reserved.