error 796 in python api

Questions on using the GAMS APIs (Python, .NET, etc.)
Post Reply
Posts: 8
Joined: 1 year ago

error 796 in python api

Post by silence » 4 months ago

Hello everybody,

I want to instantiate a MIP model with modifiers in the objective function. Follow the example to GamsModifier a parameter im my model ,but encountered an error 796. The code and error list are uploaded. When directly called the code, it ran normally. I don't know where is the problem
(2.03 KiB) Downloaded 37 times
(7.6 KiB) Downloaded 39 times
Furthermore, if you can proviede detailed examples of how to modify a few multidimensional parameters with a GamsModifier? I have a look at the, but still not understand.


User avatar
Posts: 615
Joined: 4 years ago

Re: error 796 in python api

Post by bussieck » 4 months ago

You need to understand how model instances and updaters work. Read the GUSS manual ( that is based on the same techniques. You update Par_g. Par_g never shows up up the model generated by GAMS, it is only used in some loop statements to calculate other parameters (Qtable) which is then used in the model algebra. That's not how it works. Moreover, why in the world do you want to use model instances? GAMS takes no time to execute and generate the model and the mip you solve takes a long time. There is absolutely do advantage (for you) using model instances compared to just running the entire GAMS job with varying Par_g multiple times. You can pass different values for Par_g via a double dash parameter (see opt.defines["incname"] = "tdata" in and you can create a GAMSDatabase with indexed parameters and read them via $gdxIn/$load in your model (again GAMSModelInstance is useful when the ratio of solving and generating is very small and you need to do thousands of such solves.

Hope this helps,

Post Reply