cog-imperial / OMLT

Represent trained machine learning models as Pyomo optimization formulations
Other
262 stars 57 forks source link

IndexedVar no longer works #4

Closed jalving closed 2 years ago

jalving commented 2 years ago

IndexedVar no longer seems to work when passing to an OptMLBlock.

See the code in: https://github.com/cog-imperial/OptML/blob/dc20370a8d7de3513d1d202e78cbec336bea7a9b/src/optml/utils.py#L11-L19

Does Pyomo no longer support OrderedSet? We can no longer access vars.indexed_set. There is vars.index_set, but it does not have .is_ordered. Does Pyomo assume that IndexVars are always ordered now? If yes, we can just return the values using list(vars.values())

michaelbynum commented 2 years ago

Sets are ordered by default in Pyomo now. You can get an unordered set if you really want one, but I think you have to use SetOf to do it.

jalving commented 2 years ago

This issue is deprecated by PR #24. We no longer support passing variables to the block (for now).