comando.interfaces.gams module

Routines for translation to GAMS syntax.

class comando.interfaces.gams.GamsParser(sym_map)[source]

Bases: StrParser

A class for parsing comando expressions to GAMS Syntax.

comando.interfaces.gams.gams_pow_callback(parser, expr, idx)[source]

Handle special pow calls in GAMS.

comando.interfaces.gams.get_results(results_file_name)[source]

Code for parsing gams results files.

comando.interfaces.gams.literal(i)[source]

Get a gams representation for the literal index i in parentheses.

comando.interfaces.gams.populate_sym_map(iname, dvars=(), ovars=(), pars=(), sym_map=None)[source]

Create a GAMS symbol map or populate an existing one with new symbols.

Parameters:
  • dvars (iterable) – design variables

  • ovars (iterable) – operational variables

  • pars (iterable) – parameters

Returns:

sym_map – Symbol map with GAMS representation for each passed symbol.

Return type:

dict

comando.interfaces.gams.solve(P, input_file_name=None, silent=False, **options)[source]

Solve the problem specified in the input_file using GAMS.

Apart from the usual GAMS options, the model type (e.g. LP/MINLP) may be specified explixitly using the model_type option, the default is MINLP.

comando.interfaces.gams.write_equations_section(P, iname, parse)[source]

Generate a string representation of a EQUATIONS section.

comando.interfaces.gams.write_gms_file(P, file_name, model_type='MINLP')[source]

Write a GAMS file based on the COMANDO Problem.

comando.interfaces.gams.write_objective(P, parse)[source]

Create the string for the objective function of P.

comando.interfaces.gams.write_parameters_section(P, iname)[source]

Generate a string representation of a PARAMETERS section.

comando.interfaces.gams.write_sets_section(P)[source]

Generate a string representation of a SETS section.

comando.interfaces.gams.write_variables_section(P, iname)[source]

Write the different ‘VARIABLES’ sections and variable bounds.