Embed Julia code

Post Reply
PCAPROS
User
User
Posts: 2
Joined: 5 years ago

Embed Julia code

Post 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
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Embed Julia code

Post 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
PCAPROS
User
User
Posts: 2
Joined: 5 years ago

Re: Embed Julia code

Post by PCAPROS »

Many thanks for the answer
Post Reply