Hi GAMS experts,
This is not an issue post. It’s just my curiosity to compare the performance between GAMSpy and solver Python APIs like Gurobipy/Python-Xpress for large-scale problems. I believe the biggest difference should be in the model creation time overhead because there should be no difference after the model gets passed on to the solver. I usually find GAMS itself (not GAMSpy) satisfying because it is even faster than using Gurobipy regarding the model creation time for problems with millions of vars/constrs, though slightly slower than CPLEX-C API. But it is well-known that Python is much slower in processing.
Is there any existing post or article that did the comparison quantitatively?
Best,
Gabriel
Gabriel,
My colleague Justine did such a study to compare multiple modeling languages/APIs almost 2 years ago. Here is the link to the blog post: Performance in Optimization Models: A Comparative Analysis of GAMS, Pyomo, GurobiPy, and JuMP. There have been a number of reactions to this, your find links to them at the bottom of the page. It all depends on the model. If your model has a lot of multi-indexed symbols with sparse data, GAMS shines. If you have a straight forward dense model (as you find them often in text book examples), it does not matter how you generate the model. GAMS and GAMSPy is solver independent, so you can switch between Cplex, Xpress, and Gurobi with a single change but have the almost the speed of a solver native C interface. Many years back, I wrote a paper with some colleagues to demonstrate that even for continuous model generation of similar model (in scenario analysis or algorithms like Benders) GAMS can be used very successfully and maintain competitiveness with the C-APIs of the solvers: High Performance Prototyping of Decomposition Methods in GAMS, joint work with Timo Lohmann, Steffen Rebennack, and Lutz Westermann. INFORMS Journal on Computing, Jun 1, 2020. This work led to the GAMSModelInstance class in the Control API or “frozen” models in GAMSPy.
-Michael
1 Like
Hi Michael,
Thanks for the reply! Yes I read that post right after Justine posted it in 2023, but I was thinking that was the comparison between vanilla GAMS (before GAMSpy got released) and other modeling languages. And I found that useful because my problem is exactly multi-indexed, high-dimensional, and with a huge sparse coefficient matrix. So GAMS was always my go-to choice. What I am currently curious is the comparison between GAMSpy and others. Or, is there any comparison between GAMSpy and GAMS regarding the model creation time? Are they actually the same? I don’t know exactly how GAMSpy works internally, like communicating with GAMS through Python, and then communicating with the solver through GAMS? I presume that would introduce more communication overhead.
The performance of GAMS vs GAMSPy is nearly the same. There is a little bit of over head communicating data back and forth between GAMS and Python but essentially you get the high performance execution of GAMS in GAMSPy. My colleague Mateo publish a blog article on the performance of GAMSPy: GAMSPy: High-Performance Optimization in Python that has some charts comparing GAMS and GAMSPy for a specific model we used in the other blog post. Again, it depends on the particular model and in Python you have so much “more rope to hang yourself” than in GAMS. So writing bad/slow models in Python/GAMSPy is way easier than in GAMS, but you have much more flexibility in GAMSPy. So if GAMSPy is way slower than GAMS most likely you did not use it “correctly”.