Hi all,
I have been working with the parallelization of my models, and as such, I decided to use .write() function for my model’s container. My model has a few dynamics sets, which I use to define a domain to solve in each iteration. I have been getting an error when trying to change the dynamic set after loading them from a container.
Specifically, I am getting the error:
**** $352
**** 352 Set has not been initialized
The GDX file and domain of both super-set and sub-set look good when directly checked after loading. Only the manipulation produced the error.
Here is a reproducible example:
from gamspy import (Container, Set)
def main():
m = Container()
j = Set(
m,
name="j",
records=["new-york", "chicago", "topeka"],
description="markets",
)
j_sub = Set(
m, name="j_sub", records=["new-york", "chicago"], domain=j, description="markets"
)
gdx_file = "test.gdx"
m.write(gdx_file)
m = Container()
m.read(gdx_file)
print("set ", m["j"].toList())
print("sub set ", m["j_sub"].toList())
m["j_sub"][m["j"]] = False # here the error occurs
if __name__ == "__main__":
main()
I would greatly appreciate your help with that. Many thanks for your time.
Best,
Adam
GAMSPy version
This information can be retrieved with:
gamspy -v1.4.0