Let us consider the following set:
m.sub_sit = pyomo.Set(
initialize=[site],
doc='site of sub problem')
in this case m.sub_sit
is created by create_model()
function with the argument 'Mid'
:
inst = create_model(site='Mid')
what I get by calling inst.sub_sit.pprint()
:
In:
inst.sub_sit.pprint()
Out:
sub_sit : site of sub problem
Dim=0, Dimen=1, Size=1, Domain=None, Ordered=False, Bounds=None
['Mid']
What I really want to output is 'Mid'
, so that I can index other objects with 'Mid'
, and then I can use it in my code.
e.g.:
In1: PiZero
In2: PiZero[inst.sub_sit[1]]
In3: PiZero['Mid']
Out1:
sub_sit
Mid -1.0
Name: sub_costs, dtype: float64
Out2: -1.0
Out3: -1.0
Question: is there anyway to call this 'Mid'
string from m.sub_sit
pyomo set object, better than what I suggest?
btw m.sub_sit.value
gives an output, almost what I needed: {'Mid'}