Closed michaelbynum closed 3 years ago
consider
import pyomo.environ as pe m = pe.ConcreteModel() m.x = pe.Var(['1', '2'])
The following does not work:
m2 = m.clone() m2.find_component(m.x['1'].getname(fully_qualified=True)) is m2.x['1'] # False
However, the following does
m2 = m.clone() m2.find_component(m.x['1']) is m2.x['1'] # True
The reason the former does not work is that m.x['1'].getname(fully_qualified=True) returns "m.x[1]" instead of "m.x['1']".
m.x['1'].getname(fully_qualified=True)
"m.x[1]"
"m.x['1']"
Thank you, I didn't know this.
consider
The following does not work:
However, the following does
The reason the former does not work is that
m.x['1'].getname(fully_qualified=True)
returns"m.x[1]"
instead of"m.x['1']"
.