DataPortal() Issue.

127 views
Skip to first unread message

Hayford Adjavor

unread,
Mar 21, 2020, 10:38:46 PM3/21/20
to Pyomo Forum
Dear Forum members,
I have been trying to use the following data command to load the set and parameter data into my Pyomo AbstratModel(), but I keep getting the error message below.

#data command:
data.load(filename='testMatrix__15_combo.xlsx', range='Itable', format='set', set='I')
data.load(filename='testMatrix__15_combo.xlsx', range='Jtable', format='set', set='J')
data.load(filename='testMatrix__15_combo.xlsx', range='Atable', format='set_array', set='A')
data.load(filename='testMatrix__15_combo.xlsx', range='dtable', param='d', format='array')
data.load(filename='testMatrix__15_combo.xlsx', range='Ctable', param='C', format='array')
instance = model.create_instance(data)
results = optimize.solve(instance, tee=True, symbolic_solver_labels=False)
instance.display()

# error messages:
OSError: Unknown range name `Itable'
OSError: Unknown range name `Jtable'
OSError: Unknown range name `Atable'
OSError: Unknown range name `dtable'
OSError: Unknown range name `Ctable'

I have done everything I know so far, including using the example from  - https://projects.coin-or.org/Pyomo/browser/pyomo/trunk/examples/pyomo/tutorials/excel.py?rev=10099 - with its corresponding data file (excel.xls) attached, but I still keep the abovementioned error message.

I shall, therefore, be glad for any help from this forum members on what I am doing wrong. Thanks in advance for your assistance.

testMatrix__15_combo.xlsx
excel.xls

David Woodruff

unread,
Mar 22, 2020, 11:20:51 AM3/22/20
to pyomo...@googlegroups.com
Your trouble is that in testMatrix_15... none of the ranges are named.

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/0eaffe00-ad4e-4611-b3bb-dfba551e8035%40googlegroups.com.

Hayford Adjavor

unread,
Mar 22, 2020, 6:58:53 PM3/22/20
to Pyomo Forum
Dear Dr. Woodruff,
Thank you very much for pointing out my error. I truly appreciate the help.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo...@googlegroups.com.

Waldemar Staniuk

unread,
Jun 17, 2023, 5:39:55 PM6/17/23
to Pyomo Forum
Hello all,

I am pretty new to Pyomo and this is my first post on this group. I think I have similar problem that was mentioned above and solved by David. Could someone explain what does he mean by 'ranges' in this case? For example this is the error that occurs to me:

IOError("Unknown range name `" + str(rangeid) + "'")

OSError: Unknown range name `None'



In attachment you can find the excel file. I would like to solve my Model as an AbstractModel, instead of ConcreteModel and this is why I am struggling with using the excel file as a data source.

Appreciate your help!

Waldemar
test.xlsx

David Woodruff

unread,
Jun 17, 2023, 6:52:32 PM6/17/23
to pyomo...@googlegroups.com
For one thing, the excel file test.xlsx does not seem to contain any named ranges. Based on the error messages, I would guess that maybe testMatrix__15_combo.xlsx doesn't either (or at least not the ranges named in your data.load calls).



To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/7122f002-c08a-4381-b89b-4f4ecd69eda1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages