My target is basically load old Gams models to GamsPy and solve it. I started with one of the examples from official GamsPy documentation (Blend Problem).
First I tried to save it as gdx with GamsPy. I did it because I was not have a traditional GAMS model right now that I can work, also for a basic start. I am just adding last small part of the code.
b1 = Model(
container=m,
name="b1",
equations=[pc],
problem="LP",
sense=Sense.MIN,
objective= Sum(alloy, price[alloy] * v[alloy])
)
b1.toGams(path="gams/b1")
report = Parameter(container=m, name="report", domain=[alloy, "*"])
b1.solve()
report[alloy, "blend-1"] = v.l[alloy]
m.write("b1_test.gdx")
After getting gdx outputs, I tried to load this problem in a different repo to see if I success to work with external non python models. When I try to run this code I got an error about equations.
from gamspy import Container, Model
b1 = Container(load_from="gams/b1/b1_data.gdx")
# b1.loadRecordsFromGdx("b1_test.gdx")
model = Model(b1, "b1_model", equations=b1.getEquations(), problem="LP", sense="MIN", objective=??)
model.solve()
Error Message:
gamspy.exceptions.ValidationError: `pc` has been declared as an equation but no equation definition was found.
I also tried it on a different example again from the official documentation. I tried the watch the changes and data in model. I can see the data and definition as Equation like the other model but somehow it does not works for me. Probably I am missing something.
Thanks