Matlab.GAMS.GAMSJob Class Reference

Manages the execution of a GAMS program given by GAMS model source. More...

Public Member Functions

logical interrupt ()
 Send interrupt message to GAMS during GAMSJob instance executes its run method. More...
 
void run (varargin)
 run GAMSJob More...
 

Public Attributes

string fileName
 (read only) file name associated to GAMSJob
 
string jobName
 (read only) name of GAMSJob
 
GAMSDatabase outDB
 (read only) GAMSDatabase created by run method
 

Detailed Description

Manages the execution of a GAMS program given by GAMS model source.

The GAMS source (or more precisely the root of a model source tree) of the job can be provided as a string or by a filename (relative to the working directory of the GAMSWorkspace) of a text file containing the GAMS model source. The run method organizes the export of the input GAMSDatabases, calls the GAMS compiler and execution system with the supplied options and on successful completion provides through the property outDB (of type GAMSDatabase) the results of the model run.

While the result data is captured in a GAMSDatabase, the run method can also create a GAMSCheckpoint that not only captures data but represents the state of the entire GAMSJob and allows some other GAMSJob to continue from this state. In case of a compilation or execution error, the run method will raise an error. If the log output of GAMS is of interest, this can be captured.

A GAMSJob is connected to external resources and needs to be properly disposed before the Java garbage collector can claim the instance.

See also
GAMSCheckpoint, GAMSWorkspace, GAMSWorkspace.addJobFromGamsLib, GAMSWorkspace.addJobFromTestLib, GAMSWorkspace.addJobFromDataLib, GAMSWorkspace.addJobFromFinLib, GAMSWorkspace.addJobFromEmpLib, GAMSWorkspace.addJobFromFile, GAMSWorkspace.addJobFromString

Member Function Documentation

◆ interrupt()

logical Matlab.GAMS.GAMSJob.interrupt ( )

Send interrupt message to GAMS during GAMSJob instance executes its run method.

This method is useful for interrupting the long running GAMSJob.

Return: true if GAMS has acknowledged an interrupt message, false otherwise

◆ run()

void Matlab.GAMS.GAMSJob.run ( varargin  )

run GAMSJob

Valid VARARGIN signatures:

Arguments:

  • cp: GAMSCheckpoint to be created by GAMSJob
  • db1,...,dbN: Arbitrary number of GAMS databases
  • opt: GAMS opt to control job
  • createOutDB: Flag determined if outDB should be created
  • output: File name to store output in or 'cmdout' to print to command line
See also
ExitCodeMessage