Search code examples
pyomo

Whats does index_set() different things in a <class 'pyomo.core.base.param.IndexedParam'>?


I have a model with this parameters:

#DATA
m.d=Param(m.I, m.T) 
m.pc=Param(m.I, m.J) 
m.pr=Param(m.I, m.J) 
m.oc=Param(m.I)
m.hc=Param(m.I) 
m.ca=Param(m.J,m.T)
m.fp=Param()
m.imax=Param()
m.lote=Param(m.I)

In other file I want get indexes of the data elements, when it has only one index like oc I get the index with v.index_set() (in this case return me I) but when it has 2 indexes like d I get ().

I don't undestand what is happening.

Thanks!


Solution

  • I have a solution. Thanks to https://groups.google.com/g/pyomo-forum/c/6dYMZwBP3Wo/m/BPwC9KvcAwAJ.

    When we have more than 1 index we have to add .subsets()