com.gams.api.GAMSJob Class Reference

Public Member Functions

GAMSDatabase OutDB ()
 Retrieve GAMSDatabase created by Run method. More...
 
String getJobName ()
 Retrieve the name of GAMSJob. More...
 
String getFileName ()
 Retrieve the file name associated to GAMSJob. More...
 
void run ()
 Run GAMSJob. More...
 
void run (GAMSOptions options)
 Run GAMSJob. More...
 
void run (GAMSCheckpoint checkpoint)
 Run GAMSJob. More...
 
void run (PrintStream output)
 Run GAMSJob. More...
 
void run (boolean createOutDB)
 Run GAMSJob. More...
 
void run (GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint)
 Run GAMSJob. More...
 
void run (GAMSOptions options, PrintStream output)
 Run GAMSJob. More...
 
void run (GAMSOptions options, boolean createOutDB)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint, PrintStream output)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint, boolean createOutDB)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, PrintStream output, boolean createOutDB)
 Run GAMSJob. More...
 
void run (GAMSOptions options, PrintStream output, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint, PrintStream output, boolean createOutDB)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint, boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, PrintStream output, boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint, PrintStream output, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSOptions options, GAMSCheckpoint checkpoint, PrintStream output, boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSCheckpoint checkpoint, PrintStream output)
 Run GAMSJob. More...
 
void run (GAMSCheckpoint checkpoint, boolean createOutDB)
 Run GAMSJob. More...
 
void run (GAMSCheckpoint checkpoint, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSCheckpoint checkpoint, PrintStream output, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSCheckpoint checkpoint, boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (GAMSCheckpoint checkpoint, PrintStream output, boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (PrintStream output, boolean createOutDB)
 Run GAMSJob. More...
 
void run (PrintStream output, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (PrintStream output, boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
void run (boolean createOutDB, GAMSDatabase ... databases)
 Run GAMSJob. More...
 
boolean interrupt ()
 Send interrupt message to GAMS during GAMSJob instance executes its run method. More...
 

Detailed Description

An instance of GAMSJob 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 throw an exception. If the log output of GAMS is of interest, this can be captured by providing a Java PrintStream instance.

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(String)
GAMSWorkspace.addJobFromTestLib(String)
GAMSWorkspace.addJobFromDataLib(String)
GAMSWorkspace.addJobFromFinLib(String)
GAMSWorkspace.addJobFromEmpLib(String)
GAMSWorkspace.addJobFromFile(String)
GAMSWorkspace.addJobFromFile(String, String)
GAMSWorkspace.addJobFromFile(String, GAMSCheckpoint, String)
GAMSWorkspace.addJobFromString(String)
GAMSWorkspace.addJobFromString(String, GAMSCheckpoint)
GAMSWorkspace.addJobFromString(String, GAMSCheckpoint, String)

Member Function Documentation

◆ getFileName()

String com.gams.api.GAMSJob.getFileName ( )

Retrieve the file name associated to GAMSJob.

Returns
String described the file name of GAMSJob

◆ getJobName()

String com.gams.api.GAMSJob.getJobName ( )

Retrieve the name of GAMSJob.

Returns
String described the name of GAMSJob

◆ interrupt()

boolean com.gams.api.GAMSJob.interrupt ( )

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

This method is useful for interrupting the long running GAMSJob.

Returns
true if GAMS has acknowledged an interrupt message, false otherwise.

◆ OutDB()

GAMSDatabase com.gams.api.GAMSJob.OutDB ( )

Retrieve GAMSDatabase created by Run method.

Returns
Reference to GAMSDatabasae instance

◆ run() [1/31]

void com.gams.api.GAMSJob.run ( )

Run GAMSJob.

Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [2/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options)

Run GAMSJob.

Parameters
optionsGAMS options to control job
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [3/31]

void com.gams.api.GAMSJob.run ( GAMSCheckpoint  checkpoint)

Run GAMSJob.

Parameters
checkpointGAMSCheckpoint to be created by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [4/31]

void com.gams.api.GAMSJob.run ( PrintStream  output)

Run GAMSJob.

Parameters
outputStream to capture GAMS log
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [5/31]

void com.gams.api.GAMSJob.run ( boolean  createOutDB)

Run GAMSJob.

Parameters
createOutDBFlag determined if OutDB should be created
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [6/31]

void com.gams.api.GAMSJob.run ( GAMSDatabase ...  databases)

Run GAMSJob.

Parameters
databasesArbitrary argument of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [7/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [8/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
PrintStream  output 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
outputStream to capture GAMS log
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [9/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
boolean  createOutDB 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
createOutDBFlag determined if OutDB should be created
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [10/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [11/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint,
PrintStream  output 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
outputStream to capture GAMS log
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [12/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint,
boolean  createOutDB 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
createOutDBFlag determined if OutDB should be created
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [13/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [14/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
PrintStream  output,
boolean  createOutDB 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
outputStream to capture GAMS log
createOutDBFlag determined if OutDB should be created
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [15/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
PrintStream  output,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
outputGAMSCheckpoint to be created by GAMSJob
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [16/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [17/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint,
PrintStream  output,
boolean  createOutDB 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
outputStream to capture GAMS log
createOutDBFlag determined if OutDB should be created
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [18/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint,
boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [19/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
PrintStream  output,
boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
outputStream to capture GAMS log
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [20/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint,
PrintStream  output,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
outputStream to capture GAMS log
databasesArbitrary arguments of GAMS databases read by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [21/31]

void com.gams.api.GAMSJob.run ( GAMSOptions  options,
GAMSCheckpoint  checkpoint,
PrintStream  output,
boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
optionsGAMS options to control job
checkpointGAMSCheckpoint to be created by GAMSJob
outputStream to capture GAMS log
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases read by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [22/31]

void com.gams.api.GAMSJob.run ( GAMSCheckpoint  checkpoint,
PrintStream  output 
)

Run GAMSJob.

Parameters
checkpointGAMSCheckpoint to be created by GAMSJob
outputStream to capture GAMS log
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [23/31]

void com.gams.api.GAMSJob.run ( GAMSCheckpoint  checkpoint,
boolean  createOutDB 
)

Run GAMSJob.

Parameters
checkpointGAMSCheckpoint to be created by GAMSJob
createOutDBFlag determined if OutDB should be created
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [24/31]

void com.gams.api.GAMSJob.run ( GAMSCheckpoint  checkpoint,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
checkpointGAMSCheckpoint to be created by GAMSJob
databasesArbitrary arguments of GAMS databases read by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [25/31]

void com.gams.api.GAMSJob.run ( GAMSCheckpoint  checkpoint,
PrintStream  output,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
checkpointGAMSCheckpoint to be created by GAMSJob
outputStream to capture GAMS log
databasesArbitrary arguments of GAMS databases read by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [26/31]

void com.gams.api.GAMSJob.run ( GAMSCheckpoint  checkpoint,
boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
checkpointGAMSCheckpoint to be created by GAMSJob
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases read by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [27/31]

void com.gams.api.GAMSJob.run ( GAMSCheckpoint  checkpoint,
PrintStream  output,
boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
checkpointGAMSCheckpoint to be created by GAMSJob
outputStream to capture GAMS log
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [28/31]

void com.gams.api.GAMSJob.run ( PrintStream  output,
boolean  createOutDB 
)

Run GAMSJob.

Parameters
outputStream to capture GAMS log
createOutDBFlag determined if OutDB should be created
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [29/31]

void com.gams.api.GAMSJob.run ( PrintStream  output,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
outputStream to capture GAMS log
databasesArbitrary arguments of GAMS databases read by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [30/31]

void com.gams.api.GAMSJob.run ( PrintStream  output,
boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
outputStream to capture GAMS log
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases read by GAMSJob
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage

◆ run() [31/31]

void com.gams.api.GAMSJob.run ( boolean  createOutDB,
GAMSDatabase ...  databases 
)

Run GAMSJob.

Parameters
createOutDBFlag determined if OutDB should be created
databasesArbitrary arguments of GAMS databases
Exceptions
GAMSExceptionIf GAMSJob instance could not be successfully executed
GAMSExecutionExceptionIf GAMSJob has been executed and terminated with an error (exit code != 0)
See also
GAMSGlobals.ExitCodeMessage