设置选项

(函数来自 pyomo.core.base.set)

pyomo.core.base.set.set_options(**kwds)[source]

已弃用。

这是一个用于设置初始化函数的装饰器。这个装饰器允许将任意值的字典传递给集合构造函数。

示例

@set_options(dimen=3)
def B_index(model):
    return [(i,i+1,i*i) for i in model.A]

@set_options(domain=Integers)
def B_index(model):
    return range(10)

自版本5.7起已弃用:set_options装饰器已被弃用;通过使用“initialize=”关键字参数将函数传递给Set构造函数,显式地从函数创建Sets。