GAMS
GAMSShell Solver
GAMSShell.available ([exception_flag]) |
True if the solver is available. |
GAMSShell.executable () |
Returns the executable used by this solver. |
GAMSShell.solve (*args, **kwds) |
Solve a model via the GAMS executable. |
GAMSShell.version () |
Returns a 4-tuple describing the solver executable version. |
GAMSShell.warm_start_capable () |
True is the solver can accept a warm-start solution. |
-
class
pyomo.solvers.plugins.solvers.GAMS.
GAMSShell
(**kwds)[source] A generic shell interface to GAMS solvers.
-
solve
(*args, **kwds)[source] Solve a model via the GAMS executable.
Keyword Arguments: - tee=False (bool) – Output GAMS log to stdout.
- logfile=None (str) – Filename to output GAMS log to a file.
- load_solutions=True (bool) – Load solution into model. If False, the results object will contain the solution data.
- keepfiles=False (bool) – Keep temporary files.
- tmpdir=None (str) – Specify directory path for storing temporary files. A directory will be created if one of this name doesn’t exist. By default uses the system default temporary path.
- report_timing=False (bool) – Print timing reports for presolve, solver, postsolve, etc.
- io_options (dict) – Options that get passed to the writer. See writer in pyomo.repn.plugins.gams_writer for details. Updated with any other keywords passed to solve method. Note: put_results is not available for modification on GAMSShell solver.
-
GAMSDirect Solver
GAMSDirect.available ([exception_flag]) |
True if the solver is available. |
GAMSDirect.solve (*args, **kwds) |
Solve a model via the GAMS Python API. |
GAMSDirect.version () |
Returns a 4-tuple describing the solver executable version. |
GAMSDirect.warm_start_capable () |
True is the solver can accept a warm-start solution. |
-
class
pyomo.solvers.plugins.solvers.GAMS.
GAMSDirect
(**kwds)[source] A generic python interface to GAMS solvers.
Visit Python API page on gams.com for installation help.
-
solve
(*args, **kwds)[source] Solve a model via the GAMS Python API.
Keyword Arguments: - tee=False (bool) – Output GAMS log to stdout.
- logfile=None (str) – Filename to output GAMS log to a file.
- load_solutions=True (bool) – Load solution into model. If False, the results object will contain the solution data.
- keepfiles=False (bool) – Keep temporary files. Equivalent of DebugLevel.KeepFiles. Summary of temp files can be found in _gams_py_gjo0.pf
- tmpdir=None (str) – Specify directory path for storing temporary files. A directory will be created if one of this name doesn’t exist. By default uses the system default temporary path.
- report_timing=False (bool) – Print timing reports for presolve, solver, postsolve, etc.
- io_options (dict) – Options that get passed to the writer. See writer in pyomo.repn.plugins.gams_writer for details. Updated with any other keywords passed to solve method.
-
GAMS Writer
This class is most commonly accessed and called upon via model.write(“filename.gms”, …), but is also utilized by the GAMS solver interfaces.
-
class
pyomo.repn.plugins.gams_writer.
ProblemWriter_gams
[source] -
__call__
(model, output_filename, solver_capability, io_options)[source] Write a model in the GAMS modeling language format.
Keyword Arguments: - output_filename (str) – Name of file to write GAMS model to. Optionally pass a file-like stream and the model will be written to that instead.
- io_options (dict) –
- warmstart=True
- Warmstart by initializing model’s variables to their values.
- symbolic_solver_labels=False
- Use full Pyomo component names rather than shortened symbols (slower, but useful for debugging).
- labeler=None
- Custom labeler. Incompatible with symbolic_solver_labels.
- solver=None
- If None, GAMS will use default solver for model type.
- mtype=None
- Model type. If None, will chose from lp, nlp, mip, and minlp.
- add_options=None
- List of additional lines to write directly into model file before the solve statement. For model attributes, <model name> is GAMS_MODEL.
- skip_trivial_constraints=False
- Skip writing constraints whose body section is fixed.
- output_fixed_variables=False
- If True, output fixed variables as variables; otherwise, output numeric value.
- file_determinism=1
- How much effort do we want to put into ensuring theGAMS file is written deterministically for a Pyomo model:0 : None1 : sort keys of indexed components (default)2 : sort keys AND sort names (over declaration order)
- put_results=None
- Filename for optionally writing solution values and marginals. If put_results_format is ‘gdx’, then GAMS will write solution values and marginals to GAMS_MODEL_p.gdx and solver statuses to {put_results}_s.gdx. If put_results_format is ‘dat’, then solution values and marginals are written to (put_results).dat, and solver statuses to (put_results + ‘stat’).dat.
- put_results_format=’gdx’
- Format used for put_results, one of ‘gdx’, ‘dat’.
-