Loading...
Searching...
No Matches
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.
 
void run (varargin)
 run GAMSJob
 
void runEngine (GAMS.GAMSEngineRunParameters parameters)
 Run Engine Job with GAMSEngineRunParameters.
 

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:

  • [ ]
  • GAMSCheckpoint cp
  • GAMSDatabase db1, ..., GAMSDatabase dbN
  • {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt
  • logical createOutDB
  • string output
  • GAMSCheckpoint cp, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSCheckpoint cp, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSCheckpoint cp, logical createOutDB
  • GAMSCheckpoint cp, string output
  • GAMSOptions opt, GAMSCheckpoint cp
  • GAMSOptions opt, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, logical createOutDB
  • GAMSOptions opt, string output
  • logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • string output, GAMSDatabase db1, ..., GAMSDatabase dbN
  • string output, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • string output, logical createOutDB
  • GAMSCheckpoint cp, logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSCheckpoint cp, logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSCheckpoint cp, string output, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSCheckpoint cp, string output, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, GAMSCheckpoint cp, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, GAMSCheckpoint cp, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, GAMSCheckpoint cp, logical createOutDB
  • GAMSOptions opt, GAMSCheckpoint cp, string output
  • GAMSOptions opt, logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, string output, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, string output, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, string output, logical createOutDB
  • string output, logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • string output, logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSCheckpoint cp, string output, logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSCheckpoint cp, string output, logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, GAMSCheckpoint cp, logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, GAMSCheckpoint cp, logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, GAMSCheckpoint cp, string output, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, GAMSCheckpoint cp, string output, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, GAMSCheckpoint cp, string output, logical createOutDB
  • GAMSOptions opt, string output, logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, string output, logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}
  • GAMSOptions opt, GAMSCheckpoint cp, string output, logical createOutDB, GAMSDatabase db1, ..., GAMSDatabase dbN
  • GAMSOptions opt, GAMSCheckpoint cp, string output, logical createOutDB, {GAMSDatabase db1, ..., GAMSDatabase dbN}

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

◆ runEngine()

void Matlab.GAMS.GAMSJob.runEngine ( GAMS.GAMSEngineRunParameters  parameters)

Run Engine Job with GAMSEngineRunParameters.

Valid VARARGIN signatures:

  • GAMSEngineRunParameters parameters

Arguments:

  • parameters: GAMSEngineRunPrameters to control the engine job