MatLab 中基于问题的公式:集合和子集

Problem-Based formulation in MatLab: Sets and Subsets

我是 GAMS 用户,但由于公司政策的原因,我不得不转而使用 MatLab。 我已经在 GAMS 中编写了一个模型,现在正在 Matlab 中编写。我正在使用基于问题的方法。

我的问题是关于集和子集

例如在 GAMS 中

sets
         NodeIndex                               Nodes of the system                     /1*3/
         GenIndex(NodeIndex)                     Generator Index                         /1/
         NoGenIndex(NodeIndex)                   Nodes with no generation

NoGenIndex(NodeIndex) = not GenIndex(NodeIndex)

可以看出,GenIndex(NodeIndex) 和 NoGenIndex(NodeIndex) 是 NodeIndex 的子集 优化变量示例:

PG(NodeIndex) Generated active power
Theta0(GenIndex) 

然后当我绑定问题时,我可以说某些集合应该是零代。

PG.fx(NoGenIndex) = 0;

但是,在阅读 MatLab 中的 problembased 说明时,我找不到类似的东西。是否可以在基于 Matlab 问题的公式中定义子集?

干杯!

是的,您可以使用数字索引向量或字符串索引到 OptimizationVariables 或 OptimizationExpressions。参见示例: https://www.mathworks.com/help/optim/ug/optimvar.html#mw_9da91e17-8359-4deb-9b42-b08b64a3646b