如何在 Pyomo 中获取约束的变量 [英] How to get variables of a constraint in Pyomo

查看:47
本文介绍了如何在 Pyomo 中获取约束的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Pyomo 中,如何获取出现在约束中的变量列表?

In Pyomo, how can I get a list of the variables appearing in a constraint?

我梳理了 Github 中的代码,但找不到任何合适的方法或属性.

I combed through the code in Github, but could not a find any suitable method or attribute for that purpose.

推荐答案

我自己找到了答案:model.con1.body._args 为您提供所需的列表.

I found the answer myself: model.con1.body._args gets you the desired list.

这篇关于如何在 Pyomo 中获取约束的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆