How are GAMS and GAMSPy related?

Dependency

GAMSPy relies on the gamspy_base package, which essentially represents a modularized GAMS installation. When creating a GAMSPy Container, you have the option to specify a GAMS installation independently via the system_directory argument. This enables flexibility in choosing the GAMS version that best suits your needs.

Execution

GAMSPy utilizes the GAMS machinery for critical operations, including the execution of indexed assignment statements, equation definitions, and the solve method. While the typical GAMSPy user does not need to delve into the intricacies of this connection, it’s worth noting that these details may evolve for performance reasons.

Debugging and GAMS Listing File

Although regular Python debugging facilities are usually sufficient, there may be scenarios where additional insights from GAMS prove valuable. If needed, GAMS can provide useful information via the GAMS listing file. For more details on debugging with GAMS, refer to the GAMSPy debugging documentation or the GAMS debugging documentation.

Solver Options

The options for solvers used by GAMSPy are described in the Solver Manuals, which is part of the GAMS Documentation. It’s important to note that examples in the solver manual are based on GAMS syntax, not GAMSPy syntax. When configuring solvers in GAMSPy, users can refer to the relevant sections in the GAMS Documentation for detailed information. as both equation definitions generate

∑ j ∈ J x_{i,j}≤40.

However, if you want to change the value of your scalar parameter in between two solve statements like:

from gamspy import Container, Parameter, Equation, Sum
m = Container()
p_python = 40
p_parameter = Parameter(container=m, name="p", records=40)
...
model.solve()
p_python = 50
p_parameter.setRecords(50)
model.solve()

you want to use the GAMSPy Parameter, as changes to a Python variable are not reflected in the generated GAMSPy model. Changes to a GAMSPy symbol, however, will be evaluated by the second solve statement.