Options#

class gamspy.Options(*, cns: str | None = None, dnlp: str | None = None, emp: str | None = None, lp: str | None = None, mcp: str | None = None, minlp: str | None = None, mip: str | None = None, miqcp: str | None = None, mpec: str | None = None, nlp: str | None = None, qcp: str | None = None, rminlp: str | None = None, rmip: str | None = None, rmiqcp: str | None = None, rmpec: str | None = None, allow_suffix_in_equation: bool | None = None, allow_suffix_in_limited_variables: bool | None = None, basis_detection_threshold: float | None = None, compile_error_limit: int | None = None, domain_violation_limit: int | None = None, generate_name_dict: bool | None = None, job_time_limit: float | None = None, job_heap_limit: float | None = None, hold_fixed_variables: bool | None = None, integer_variable_upper_bound: int | None = None, iteration_limit: int | None = None, keep_temporary_files: int | None = None, listing_file: str | None = None, loadpoint: str | None = None, log_file: str | None = None, variable_listing_limit: int | None = None, equation_listing_limit: int | None = None, node_limit: int | None = None, absolute_optimality_gap: float | None = None, relative_optimality_gap: float | None = None, monitor_process_tree_memory: bool | None = None, memory_tick_interval: float | None = None, profile: int | None = None, profile_file: str | None = None, profile_tolerance: float | None = None, reference_file: str | None = None, time_limit: float | None = None, savepoint: Literal[0, 1, 2, 3, 4] | None = None, seed: int | None = None, report_solution: Literal[0, 1, 2] | None = 0, show_os_memory: Literal[0, 1, 2] | None = None, solver_link_type: Literal[0, 1, 2, 3, 4, 5, 6, 7] | None = None, merge_strategy: Literal['replace', 'merge', 'clear'] | None = None, step_summary: bool | None = None, suppress_compiler_listing: bool | None = None, report_solver_status: bool | None = None, threads: int | None = None, write_listing_file: bool | None = None, zero_rounding_threshold: float | None = None, report_underflow: bool | None = None)[source]#

Options class to set GAMS options for the model.

Attributes:
cns: str | None

Default cns solver

dnlp: str | None

Default dnlp solver

emp: str | None

Default emp solver

lp: str | None

Default lp solver

mcp: str | None

Default mcp solver

minlp: str | None

Default minlp solver

mip: str | None

Default mip solver

miqcp: str | None

Default miqcp solver

mpec: str | None

Default mpec solver

nlp: str | None

Default nlp solver

qcp: str | None

Default qcp solver

rminlp: str | None

Default rminlp solver

rmip: str | None

Default rmip solver

rmiqcp: str | None

Default rmiqcp solver

rmpec: str | None

Default rmpec solver

allow_suffix_in_equation: bool | None

Flag to allow variables with suffixes in model algebra

allow_suffix_in_limited_variables: bool | None

Flag to allow domain limited variables with suffixes in model

basis_detection_threshold: float | None

Basis detection threshold

compile_error_limit: int = 1

Compile time error limit

domain_violation_limit: int | None

Domain violation limit

generate_name_dict: bool | None

If this option is set, it will instruct GAMS to make the GAMS names of variables and equations that have been generated by the solve statement available to the solver. In many solver links, these names are registered with the solver and hence messages from the solver that involve variables and equations (e.g. an infeasible row or duplicate columns) can be easily interpreted by the user. However, the dictionary comes at a price. Generating the names and calculating and storing the map takes time and space. In addition, GAMS names take up space in the solver. Thus, if the user needs very fast generation and does not need names, setting dictFile to zero is a good option.

job_time_limit: float | None

Elapsed time limit (seconds)

job_heap_limit: float | None

Maximum Heap size allowed (MB)

hold_fixed_variables: bool | None

Treat fixed variables as constants

integer_variable_upper_bound: int | None

Set mode for default upper bounds on integer variables

iteration_limit: int | None

Iteration limit of solver

keep_temporary_files: bool = False

Controls keeping or deletion of process directory and scratch files

listing_file: str | None

Listing file name

loadpoint: str | None

Path to the loadpoint GDX file that contains starting point records.

log_file: str | None

Log file name

variable_listing_limit: int | None

Maximum number of columns listed in one variable block

equation_listing_limit: int | None

Maximum number of rows listed in one equation block

node_limit: int | None

Node limit in branch and bound tree

absolute_optimality_gap: float | None

Absolute Optimality criterion solver default

relative_optimality_gap: float | None

Relative Optimality criterion solver default

memory_tick_interval: float | None

Wait interval between memory monitor checks: ticks = milliseconds

monitor_process_tree_memory: bool | None

Monitor the memory used by the GAMS process tree

profile: int | None

Execution profiling

profile_file: str

Write profile information to this file

profile_tolerance: float | None

Minimum time a statement must use to appear in profile generated output

reference_file: str | None

Symbol reference file

time_limit: float | None

Wall-clock time limit for solver

savepoint: Optional[Literal[0, 1, 2, 3, 4]] = None

Save solver point in GDX file

  • Option 0: No point GDX file is to be saved

  • Option 1: A point GDX file from the last solve is to be saved

  • Option 2: A point GDX file from every solve is to be saved

  • Option 3: A point GDX file from the last solve is to be saved in the scratch directory

  • Option 4: A point GDX file from every solve is to be saved in the scratch directory

seed: int | None

Random number seed

report_solution: Literal[0, 1, 2] = 2

Solution report print option

  • Option 0: Remove solution listings following solves

  • Option 1: Include solution listings following solves

  • Option 2: Suppress all solution information

show_os_memory: Literal[0, 1, 2] = 0

Show the memory usage reported by the Operating System instead of the internal counting

  • Option 0: Show memory reported by internal accounting

  • Option 1: Show resident set size reported by operating system

  • Option 2: Show virtual set size reported by operating system

solver_link_type: Optional[Literal[0, 1, 2, 3, 4, 5, 6, 7]] = None

Solver link option

  • Option 0: Model instance and entire GAMS state saved to scratch directory, GAMS exits (and vacates memory), and the solver script is called. After the solver terminates, GAMS restarts from the saved state and continues to executing

  • Option 1: Model instance saved to scratch directory, the solver is called from a shell while GAMS remains open

  • Option 2: Model instance saved to scratch directory, the solver is called with a spawn (if possible) or a shell (if spawn is not possible) while GAMS remains open - If this is not supported by the selected solver, it gets reset to 1 automatically

  • Option 3: Model instance saved to scratch directory, the solver starts the solution and GAMS continues

  • Option 4: Model instance saved to scratch directory, the solver starts the solution and GAMS waits for the solver to come back but uses same submission process as 3 (test mode)

  • Option 5: The model instance is passed to the solver in-memory - If this is not supported by the selected solver, it gets reset to 2 automatically

  • Option 6: The model instance is passed to the solver in-memory, the solver starts the solution and GAMS continues

  • Option 7: The model instance is passed to the solver in-memory, the solver starts the solution and GAMS waits for the solver to come back but uses same submission process as 6 (test mode)

merge_strategy: Optional[Literal[“replace”, “merge”, “clear”]] = None
  • Replace: The solution information for all equations and variables is merged into the existing solution information

  • Merge: The solution information for all equations appearing in the model is completely replaced by the new model results; variables are only replaced if they appear in the final model

  • Clear: The solution information for all equations appearing in the model is completely replaced; in addition, variables appearing in the symbolic equations but removed by conditionals will be removed

step_summary: bool | None

Summary of computing resources used by job steps

suppress_compiler_listing: bool = False

Compiler listing option

report_solver_status: bool | None

Solver Status file reporting option

threads: int | None

Number of processors to be used by a solver

write_listing_file: bool = True

Switch to write a Listing file

zero_rounding_threshold: float | None

The results of certain operations will be set to zero if abs(result) LE ZeroRes

report_underflow: bool | None

Report underflow as a warning when abs(results) LE ZeroRes and result set to zero

Methods

from_file(path)

Generates an Options object with the key-value pairs in a file.

export

generate_name_dict: bool | None#
loadpoint: str | None#
monitor_process_tree_memory: bool | None#
memory_tick_interval: float | None#
profile_file: str | None#
reference_file: str | None#
static from_file(path: str) Options[source]#

Generates an Options object with the key-value pairs in a file. The file in given path must consist of one key-value pair in each line.

Parameters:
pathstr

Path to the option file.

Returns:
Options
Raises:
ValidationError

In case the given path is not a file.

export(pf_file: str, output: TextIOWrapper | None = None) None[source]#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.