Data exchange between R and GAMS

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

Data exchange between R and GAMS

Post by LaurentFranckx » 2 months ago

Dear all

I have a situation where my GAMS model calls an R script in the execution of a loop. In each iteration of the loop, the exchange of data goes in both ways: GAMS produces data that are read by the R script, and vice versa.

I had tried a solution where the exchange of data operates through a GDX file. This works fine, except that the gdxrrw library in R requires a more recent version of GAMS than the one for which I have license.

I am thus trying to find an alternative solution. I had considered using csv files for the exchange of data, but I understand you can not read text files during execution:
https://www.gams.com/latest/docs/UG_Dat ... ASCII.html

A similar issue arises if I would use Excel files for the data exchange (using this solution requires the declaration of a set during the loop, which is not allowed)
https://www.gams.com/latest/docs/T_XLS2GMS.html

Are there any alternative solutions to create an interface between R and GAMS?

Post Reply