Page 1 of 1

Embed Julia code

Posted: Thu Nov 15, 2018 12:31 pm
by PCAPROS
We know how to embed Python code in GAMS, but is there any method or tool to embed Julia code in GAMS and if not to embed Python and run Julia from Python while keeping control from GAMS?

Pantelis Capros
E3MLab, Athens Greece

Re: Embed Julia code

Posted: Thu Nov 15, 2018 12:55 pm
by bussieck
The GAMS/EmbeddedCode facility is not limited to Python. The API used inside GAMS allows for other languages. The source code for the Python embedded code library is actually open source. You find this in <GAMS sys dir>/apifiles/C/api/ (embpyoo.c and emblib.c with supporting header files). We added the source so someone could recompile if they e.g. want a different Python version (see https://www.gams.com/latest/docs/UG_Emb ... onOfPython). But you may want to use this to build your own Julia embedded code library. There is probably some coordination required with us (GAMS) to actually get it into the system, but in principle this will work.

We have not see much demand for Julia (yet). We had some users asking for R embedded code and for improvements of the Python embedded code (e.g. set/get pandas dataframes rather than lists of tuples). If you don't want to wait for a GAMS/Julia embedded code build by us (no promises) and don't want to dive into the programming yourself you can try to embed Julia in GAMS embedded Python (see e.g. https://docs.julialang.org/en/v1/manual ... index.html) as you suggested. I see no reason why this should not work, but the Python embedded Julia might not be prettiest solution.

-Michael

Re: Embed Julia code

Posted: Thu Nov 15, 2018 3:29 pm
by PCAPROS
Many thanks for the answer