Page 1 of 1

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

Posted: Mon Jan 09, 2023 1:06 pm
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

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

Posted: Tue Jan 10, 2023 2:07 pm
by ABMlerGams
Anybody an Idea about modifiying sets in a ModelInstance? Is it possible?

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

Posted: Thu Jul 27, 2023 12:09 pm
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