【问题标题】:How to put a constraint on the dual variable of the another constraint in Pyomo?如何在 Pyomo 中对另一个约束的对偶变量施加约束?
【发布时间】:2022-08-15 08:19:14
【问题描述】:

我正在研究一个经济模型,我需要对其中一个约束的对偶设置一个上限,但我有错误。如果有人可以提供帮助,我将不胜感激。 在代码的开头,我放了这行:

model.dual = pyo.Suffix(direction=pyo.Suffix.IMPORT_EXPORT) 这是我在对偶上定义的约束:

model.adequacy_constraint = \\ pyo.Constraint(model.h, rule=adequacy_constraint_rule) def lost_load_rule(model, h):\\ return model.dual[model.adequacy_constraint[h]]< 1e9 model.voll_constraint = \\ pyo.Constraint(model.h, rule=lost_load_rule)

这是错误:

return model.dual[model.adequacy_constraint[h]]< 1e9 File \"C:\\Users\\Maryam\\PycharmProjects\\pythonProject1\\venv\\lib\\site-packages\\pyomo\\common\\collections\\component_map.py\", line 96, in __getitem__ raise KeyError(\"Component with id \'%s\': %s\" KeyError: \"Component with id \'2384738399616\': adequacy_constraint[0]\"

    标签: constraints pyomo suffix


    【解决方案1】:

    您不能对传统优化模型中的对偶进行限制。如果您确实需要,并且无法对模型进行二元化,您可能需要研究 Complementarity 和 MPEC 模型。

    【讨论】:

      猜你喜欢
      • 2021-09-12
      • 1970-01-01
      • 1970-01-01
      • 2018-07-09
      • 2022-11-27
      • 1970-01-01
      • 2021-01-13
      • 2015-11-26
      • 1970-01-01
      相关资源
      最近更新 更多