We are still excited about the official release of GAMSPy, our interpretation of a convenient and performant modeling framework in Python. This blog post is dedicated to providing in-depth insights and answers to the most common questions you may have about GAMSPy.
What is GAMSPy?
GAMSPy represents the fusion of the high-performance GAMS compiler and execution system with the ease of use of a versatile programming language like Python. GAMSPy streamlines all the necessary components for a smooth and efficient optimization experience by allowing mathematical models to be written directly in Python with the convenience of our Pythonic interpretation of the proven GAMS syntax. For a more in-depth understanding, please refer to our detailed blog post .
What prompted the release of GAMSPy and who is the intended audience?
Throughout our years of experience, we have worked with many professionals who have expertise in optimization. We have found that these individuals can be broadly categorized into two distinct groups: coding enthusiasts and coding skeptics. The coding skeptics tend to focus on the mathematical model, often preferring to do minimal programming. Tasks such as data manipulation and visualization are often done in alternative software such as Excel. Coding enthusiasts, on the other hand, typically have a background in computer science and prefer to take full control of the programming, wanting to oversee every stage of their optimization pipeline. They tend to work with versatile programming languages and use tools like Numpy and Pandas for pre- and post-processing of data.
While the GAMS modeling language with its domain specific nature perfectly satisfies the coding skeptics by freeing them from extensive programming tasks and enabling the composition of models using a syntax closely resembling algebraic notation, the coding enthusiasts express a yearning for greater adaptability. They voice concern about the inconvenience of switching between different environments for tasks involving data manipulation and optimization.
With GAMSPy we now embrace the community of coding enthusiasts. No need to switch between environments anymore. GAMSPy allows you to streamline the entire optimization pipeline in Python: from initial data input, through data cleansing and preprocessing, to model, symbol, and constraint declaration, model solving, and post-processing.
How is GAMSPy different from GAMS?
GAMSPy uses the GAMS execution system to do the heavy lifting. Hence, they share the same idea of how to use sets and declare indexed constraints. They both allow data independent modeling and include a variety of different solvers. The main difference boils down to personal preference. Coding enthusiasts will fall in love with GAMSPy, while coding skeptics rather stick with the standalone and plain GAMS modeling language.
Will GAMSPy replace GAMS?
It’s important to clarify that GAMSPy is not intended to replace or supersede the standalone GAMS modeling language; rather, it serves as a complementary tool within the optimization tool stack. Both GAMS modeling language and GAMSPy use the robust GAMS compilation and execution system and offer similar functionality. The choice between them comes down to individual preference. This ensures that users can choose the tool that best suits their coding style and preferences, fostering a harmonious integration of both within the optimization landscape.
How is GAMSPy different from other Python based modeling frameworks?
The main difference between GAMSPy and other modeling frameworks based on the Python language is that GAMSPy offloads the heavy lifting to the efficient and robust GAMS compilation and execution system. While Pyomo and similar modeling frameworks depend on Python’s relatively slower execution of for loops and list comprehensions to represent indexed constraints, GAMSPy leverages the well established idea of representing model objects in a declarative and pythonic way. This strategic choice results in superior out-of-the-box performance.
While conventional modeling frameworks based on the Python language generate model instances where the mathematical formulation is already resolved into its individual components and populated with instance data, these instances often grow big and challenging to manage. In adherence to the GAMS philosophy, GAMSPy takes a different approach, creating indexed constraints and data-independent models. This design choice not only aligns with GAMS principles but also facilitates easier maintenance and handling of models, offering a notable advantage over alternative frameworks.
In which scenario do I benefit from using GAMSPy instead of GAMS?
If you happen to be a coding enthusiast who has been using a gluecode methodology — for example, creating, a Python script for data pre-processing and post-processing, supplemented by system calls for GAMS model solving — you will definitely benefit from switching to GAMSPy.
However, GAMSPy seamlessly meets a much broader spectrum of needs. It is a perfect fit if you want to run arbitrary models, if your are looking for fast prototyping, or if you want to combine optimization and heuristics without switching environments.
But I thought flexibility is a double edged sword when it comes to performance?
As we have discussed in a previous blog post that performance is a critical factor when dealing with data and optimization tasks. GAMSPy ensures you don’t have to compromise on performance. The heavy lifting – model compilation and execution – is seamlessly managed by the powerful GAMS system, ensuring a minimal overhead compared to using the standalone GAMS modeling language. Stay tuned as we will provide some performance insights in a future blog post.
What do I need to do to try GAMSPy myself?
GAMSPy can be easily installed via pip from the command line. Just follow the instructions from Social Media Post and/or our documentation . It is shipped with a mini GAMS installation and a demo license. Thus, no separate GAMS installation is required and you are only a single command away from diving into the GAMSPy experience.
What can I expect from GAMSPy in the future?
While we release GAMSPy in the beta phase, you can expect regular updates and bug fixes even though we have a significantly high test coverage. All the basic features are already included in this release but we are planning to provide a refined GAMS MIRO and a GAMS Engine integration. Apart from that, we love to hear from you. Feel free to contact email@example.com for questions, feedback, and feature requests.