ValueError: Constructing SetOperator A with incompatible data with v6.x

12 views
Skip to first unread message

Emmanuel Twum

unread,
Jul 2, 2021, 12:36:32 AM7/2/21
to Pyomo Forum
Dear Pyomo Team, 

I have an error (it seems to be index set related) popping up from my model instance = model.create_instance(data) when it runs.

I have gone through the error and the class of the base code where it seem to be coming from, but can't seem to figure it out so far. I have solved this model in the Pyomo version 5.x without this issue, so I am not sure this error this time with version 6.x. 

I have attached sample of my model, the excel data file, and details about the error for your reference.

Thank you in advance for the help!
ex_data_file.xlsx
Set_Construction_Error.txt
extract_model.py

Sebasta Joséi

unread,
Jul 2, 2021, 12:01:01 PM7/2/21
to pyomo...@googlegroups.com
Hi.
You can't do that with excel files. If you want to initialize data in the create_instance function, it should be in .dat format. Here an example:

If you want to read data from an external excel file, in your script you need a function that reads this file and saves data in variables. After that, you initialize the model with this information. Here another example:

Regards

--
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/9aab2d58-b3b0-4c5e-95fb-67b14c5e32dfn%40googlegroups.com.

Emmanuel Twum

unread,
Jul 2, 2021, 1:08:35 PM7/2/21
to pyomo...@googlegroups.com
Hi Sebesta, thank you for the response. I am currently reviewing these two resource links to see which one would be best for my use case.



--
Best Regards!

Mr. Emmanuel Twum
Managing Director/CEO
Company email: wemus...@gmail.com
Mobile USA: +12675703062 | UK:+441618187529 | Ghana: +233203354322 

Reply all
Reply to author
Forward
0 new messages