Java Api - change set entries in ModelInstance via Modifier or else

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

Java Api - change set entries in ModelInstance via Modifier or else

Post by ABMlerGams »

Hi,

still working on the Java API. A question: I want to use the Modelinstance with Gamsmodifiers. All straightforward with Parameters. However, I would like to add/remove set entries via the modifier which seems not to be possible. Is there a way to do this via SyncDB operations or is this just out of the scope for the Instance? I manage to add a set and records to the SyncDB but the added records are not considered in the solution...

sample code:
gamsModelInst.SyncDB().addSet("curPlots", 1);
gamsModelInst.instantiate("Fruchtfolge using MIP maximizing v_obje", new GAMSModifier(gamsGrossmarginParameter),new GAMSModifier(plotDataPara));
gamsModelInst.SyncDB().getSet("curPlots").addRecord("plot3");
gamsModelInst.solve();


regards
ABMlerGams
User
User
Posts: 5
Joined: 1 year ago

Re: Java Api - change set entries in ModelInstance via Modifier or else

Post by ABMlerGams »

Anybody an Idea about modifiying sets in a ModelInstance? Is it possible?
User avatar
bussieck
Moderator
Moderator
Posts: 1042
Joined: 7 years ago

Re: Java Api - change set entries in ModelInstance via Modifier or else

Post by bussieck »

No, this is not possible. GAMSModelinstance only works with a fixed model rim. Sets change the model rim. The solution to this is to initiate the GAMSModelinstance with the full set of a possible subsets and use 0 (actually EPS) in the equation aalgebra (via some modifiable parameter) when you don't what the variable in the actual scenario.

-Michael
Post Reply