-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot solve a restored model #781
Comments
@Fernando3161, it is an unnoticed bug, because most people dump the energy system after(!) they solved it and not before. It seems that the structure of the object is somehow damaged by pickling and unpickling. Is it urgent for you or do have a workaround? I think it is a little more complicated to fix it. I could reproduce the bug using the basic_example. I just dumped and restored the Traceback (most recent call last):
File ".../oemof/oemof-examples/oemof_examples/oemof.solph/v0.4.x/basic_example/basic_example.py", line 188, in <module>
model = solph.Model(energysystem)
File ".../my_python/lib/python3.7/site-packages/oemof/solph/models.py", line 271, in __init__
super().__init__(energysystem, **kwargs)
File ".../my_python/lib/python3.7/site-packages/oemof/solph/models.py", line 91, in __init__
self._constraint_groups += [i for i in self.es.groups
File ".../my_python/lib/python3.7/site-packages/oemof/network/energy_system.py", line 163, in groups
maxlen=0,
File ".../my_python/lib/python3.7/site-packages/oemof/network/energy_system.py", line 161, in <genexpr>
for n in self.nodes[self._first_ungrouped_node_index_:]
File ".../my_python/lib/python3.7/site-packages/oemof/network/groupings.py", line 301, in __call__
((s, n, f) for (s, f) in n.inputs.items()),
File ".../my_python/lib/python3.7/site-packages/oemof/network/groupings.py", line 301, in <genexpr>
((s, n, f) for (s, f) in n.inputs.items()),
File ".../my_python/lib/python3.7/_collections_abc.py", line 744, in __iter__
yield (key, self._mapping[key])
File ".../my_python/lib/python3.7/site-packages/oemof/network/network.py", line 46, in __getitem__
return key.outputs.__getitem__(self.target)
File ".../my_python/lib/python3.7/collections/__init__.py", line 1025, in __getitem__
raise KeyError(key)
KeyError: "<oemof.solph.network.Bus: 'natural_gas'>" |
I found this since I wanted to build bigger interconnected Energy Systems based on small energy systems, but I found a way around (I had to skip my original Dump-Restore idea). I wanted to submit the issue since it seemed to go unnoticed. |
That's pretty interesting. It's beside the point of this issue, but I'm interested in how you would do this. Because there are ways of doing this, but they might not be immediately obvious. So if you want to, you can shoot me an email on how you did this to "gnn -dot- code -at- gmail -dot- com".
That's very much appreciated. 👍 :) |
This or at least a similar problem with dump/restore has shown up already for some users, me as well. We tried to track the error down further and learned something, but not enough to fix it unfortunately. See this related issue: oemof/oemof-network#10 and #742. |
Hey, can u do me a favor and post your work around here? |
When I solve the model directly after creating the energy system (skipping the dumping and restoring steps), I can get results without problem.
Is this a general or known issue or is there a problem with pickle?
oemof-solph 0.4.2
The text was updated successfully, but these errors were encountered: