我有一个LP,它有一组向量作为输入参数,包含2到12个元素:
[1,2,0,0,3]
[1,0,0,0,0,1,2]
[5,0,0,1,0,7]
对于每个节点:
model.Nodes = pyo.Set(initialize = range(0, len(nodes))
所以基本上:
0:[1,2,0,0,3]
1:[1,0,0,0,0,1,2]
2:[5,0,0,1,0,7]
此外,还希望将参数构造定义为:
{0,1,2,3,4}
{0,1,2,3,4,5,6}
{0,1,2,3,4,5}
将数字0包含到每个向量中的组件数。再次链接到节点:
0:{0,1,2,3,4}
1:{0,1,2,3