Matlab.GAMS.GAMSWorkspace Class Reference

Base class in the GAMS package. More...

Public Member Functions

GAMSCheckpoint addCheckpoint (varargin)
 Create a GAMSCheckpoint. More...
 
GAMSDatabase addDatabase (varargin)
 Create a GAMSDatabase. More...
 
GAMSDatabase addDatabaseFromGDX (varargin)
 Database creation from an existing GDX file. More...
 
GAMSJob addJobFromApiLib (string modelName)
 Retrieves model from GAMS API Library. More...
 
GAMSJob addJobFromDataLib (string modelName)
 Retrieves model from GAMS Data Utilities Library. More...
 
GAMSJob addJobFromEmpLib (string modelName)
 Retrieves model from Extended Math Programming Library. More...
 
GAMSJob addJobFromFile (varargin)
 Create GAMSJob from model file. More...
 
GAMSJob addJobFromFinLib (string modelName)
 Retrieves model from GAMS Practical Financial Optimization Library. More...
 
GAMSJob addJobFromGamsLib (string modelName)
 Retrieves model from GAMS Model Library. More...
 
GAMSJob addJobFromNoaLib (string modelName)
 Retrieves model from GAMS Non-linear Optimization Applications Library. More...
 
GAMSJob addJobFromPsoptLib (string modelName)
 Retrieves model from Power System Optimization Modelling Library. More...
 
GAMSJob addJobFromString (varargin)
 Create GAMSJob from string model source. More...
 
GAMSJob addJobFromTestLib (string modelName)
 Retrieves model from GAMS Test Library. More...
 
GAMSOptions addOptions (varargin)
 Create GAMSOptions. More...
 
 GAMSWorkspace (varargin)
 Construct a new GAMSWorkspace instance. More...
 

Public Attributes

integer APIGoldReleaseNumber
 (read only) API GOLD Release Number
 
integer APIMajorReleaseNumber
 (read only) API Major Release Number
 
integer APIMinorReleaseNumber
 (read only) API Minor Release Number
 
string APIVersion
 (read only) API Version
 
DebugLevel debugLevel
 GAMS debug level.
 
double eps
 value to be stored in and read from GAMSDatabase for Epsilon
 
string GAMSVersion
 (read only) GAMS Version used
 
integer goldReleaseNumber
 (read only) GAMS GOLD Release Number
 
logical isUsingTmpWorkingDirectory
 (read only) Flag if a temporary directory has been used as a working directory
 
integer majorReleaseNumber
 (read only) GAMS Major Release Number
 
integer minorReleaseNumber
 (read only) GAMS Minor Release Number
 
string systemDirectory
 (read only) GAMS system directory
 
string workingDirectory
 (read only) GAMS working directory
 

Detailed Description

Base class in the GAMS package.

Most instances of API program under the package (such as GAMSDatabase, GAMSJob, and GAMSCheckpoint) have to be created by an "add" method provided by GAMSWorkspace.

When creating a GAMSWorkspace instance, it is possible to use a default configuration or a user-defined configuration to specify workspace attributes (system directory, working directory, and debug level) of the instance.

  • The system directory is the directory where GAMS system has been installed. It provides most resources from GAMS required by an API program.
  • The working directory is the anchor directory where all file based operation inside a running GAMS model should be relative to this location (e.g. $GDXIN and $include). Though there are also options to add input search paths (e.g. IDir) and output path (e.g. PutDir) to specify other file system locations provided by GAMSOptions. It is recommended to clean up the working directory after running an example, if the output files are no longer needed.
  • The debug level is the level of debug information that can be set to various value when more or less information is needed during run time.

For a default configuration, a GAMSWorkspace instance is created by the default constructor without a parameter. In such case, the workspace attributes will be determined using the default setting.

  • The system directory will be determined automatically from the environment (first, from "PATH" environment variable on every platform. If a GAMS system directory is not found from "PATH", the system directory will be determined from the platform specific environment: from windows registry "Software\Classes\gams.location" on Windows-based platform, from "DYLD_LIBRARY_PATH" on Mac OS platform, or from "LD_LIBRARY_PATH" on other Unix-based platforms). If a valid GAMS system directory could not be found from both environment variables, an error will be raised during run time.
  • The working directory will be determined from GAMSGlobals.workingDirectory which by default is the user working directory (the java property "java.io.tmpdir").
  • The debug level is set to DebugLevel.OFF by default, that is no debug information available.

To create a GAMSWorkspace instance with a user-defined configuration, it is possible to specify one of workspace attributes (system directory, working directory, and debug level) by either using GAMSWorkspace(String, String, DebugLevel) constructor or creating first a GAMSWorkspaceInfo instance that contains attribute values and then passing it as input parameter for one of the GAMSWorkspace constructors. Either way, both specified system directory and working directory will be verified whether or not they are valid directories. In case of an invalid directory, an error will be raised during run time. In general, the directory is not a valid directory if it is does not exist. The directory contains either an empty string or only white spaces will be treated as non existent directory whereas an empty string as directory will be treated with the default setting. The system directory is not a valid GAMS directory if it does not contain valid GAMS files and libraries. The valid system directory will be used and not be verified against an environment variable.

Note: If you use multiple instances of the GAMSWorkspace in parallel, you should avoid using the same working directory. Otherwise you may end up with conflicting file names.

See also
GAMSCheckpoint, GAMSDatabase, GAMSGlobals, GAMSJob, GAMSOptions, GAMSWorkspaceInfo, DebugLevel

Constructor & Destructor Documentation

◆ GAMSWorkspace()

Matlab.GAMS.GAMSWorkspace.GAMSWorkspace ( varargin  )

Construct a new GAMSWorkspace instance.

In case the system directory attribute is empty or not specified (by default setting), the system directory will be determined automatically from the environment (first, from "PATH" environment variable on every platform. If a GAMS system directory is not found from "PATH", the system directory will be determined from the platform specific environment: either from windows registry "Software\Classes\gams.location" on Windows-based platform, or from "DYLD_LIBRARY_PATH" on Mac OS platform, or from "LD_LIBRARY_PATH" on other Unix-based platforms). If a valid GAMS system directory could not be found from both environment variables, an error will be raised during run time.

In case the specified system directory is not empty, the directory will be verified. In case the specified directory does not exist or it is not a valid GAMS directory, an error will be raised during run time.

In case the specified working directory is empty or not specified (by default setting), the default working directory with prefix "gams_" (specified by GAMSGlobals.workingDirectoryPrefix) under the temporary directory (specified by GAMSGlobals.workingDirectory) will be created and taken as the working directory of the workspace. After the directory is successfully created, the property GAMSWorkspace.workingDirectory will contain the string describing the working directory and the property GAMSWorkspace.isUsingTmpWorkingDirectory will return true. Under situations where the directory could not be created, the directory specified by GAMSGlobals.workingDirectory will be taken as the working directory of the workspace. Under such situation, the property GAMSWorkspace.workingDirectory will contain the working directory string and the property GAMSWorkspace.isUsingTmpWorkingDirectory will return false.

In case the specified working directory is not empty, the directory will be verified. In case the specified directory does exist but is not a directory, an error will be raised during run time. Otherwise the directory will be created.

The debug level attribute is by default DebugLevel.OFF. The debug level can be specified to other value by an instance of DebugLevel. Note that when a GAMSWorkspace instance is created, it also allows an environment variable "GAMSOOAPIDEBUG" containing a string that represents the desired DebugLevel to override the debug level of the created instance.

Valid VARARGIN signatures:

Arguments:

  • info: a GAMSWorkspaceInfo instance (with working directory, GAMS system directory, and debug level)
  • workingDir: the name of working directory, anchor for all file-based operations
  • systemDir: the name of system directory, where GAMS is installed
  • level: debug level

Return: instance of GAMSWorkspace

See also
GAMSGlobals, GAMSWorkspaceInfo, DebugLevel

Member Function Documentation

◆ addCheckpoint()

GAMSCheckpoint Matlab.GAMS.GAMSWorkspace.addCheckpoint ( varargin  )

Create a GAMSCheckpoint.

The name of a GAMSCheckpoint object is generated automatically when not provided by the user.

Valid VARARGIN signatures:

  • [ ]
  • string checkpointName

Arguments:

  • checkpointName: Identifier of GAMSCheckpoint or filename for existing checkpoint

Return: instance of GAMSCheckpoint

See also
GAMSCheckpoint

◆ addDatabase()

GAMSDatabase Matlab.GAMS.GAMSWorkspace.addDatabase ( varargin  )

Create a GAMSDatabase.

If a GAMSDatabse is given via sourceDatabase, the database is initialized with the same objects as the source database. Otherwise, it is created empty.

Valid VARARGIN signatures:

Arguments:

Return: instance of GAMSDatabase

See also
GAMSDatabase

◆ addDatabaseFromGDX()

GAMSDatabase Matlab.GAMS.GAMSWorkspace.addDatabaseFromGDX ( varargin  )

Database creation from an existing GDX file.

Valid VARARGIN signatures:

  • string gdxFileName
  • string gdxFileName, string databaseName

Arguments:

  • gdxFileName: File to initialize Database from
  • databaseName: Identifier of GAMSDatabase

Return: instance of GAMSDatabase

See also
GAMSDatabase

◆ addJobFromApiLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromApiLib ( string  modelName)

Retrieves model from GAMS API Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addJobFromDataLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromDataLib ( string  modelName)

Retrieves model from GAMS Data Utilities Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addJobFromEmpLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromEmpLib ( string  modelName)

Retrieves model from Extended Math Programming Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addJobFromFile()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromFile ( varargin  )

Create GAMSJob from model file.

Valid VARARGIN signatures:

  • string fileName
  • string fileName, string jobName
  • string fileName, GAMSCheckpoint checkpoint, string jobName

Arguments:

Return: instance of GAMSJob

See also
GAMSJob, GAMSCheckpoint

◆ addJobFromFinLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromFinLib ( string  modelName)

Retrieves model from GAMS Practical Financial Optimization Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addJobFromGamsLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromGamsLib ( string  modelName)

Retrieves model from GAMS Model Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addJobFromNoaLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromNoaLib ( string  modelName)

Retrieves model from GAMS Non-linear Optimization Applications Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addJobFromPsoptLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromPsoptLib ( string  modelName)

Retrieves model from Power System Optimization Modelling Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addJobFromString()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromString ( varargin  )

Create GAMSJob from string model source.

Valid VARARGIN signatures:

Arguments:

Return: instance of GAMSJob

See also
GAMSJob, GAMSCheckpoint

◆ addJobFromTestLib()

GAMSJob Matlab.GAMS.GAMSWorkspace.addJobFromTestLib ( string  modelName)

Retrieves model from GAMS Test Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of GAMSJob

See also
GAMSJob

◆ addOptions()

GAMSOptions Matlab.GAMS.GAMSWorkspace.addOptions ( varargin  )

Create GAMSOptions.

Valid VARARGIN signatures:

Arguments:

  • option: GAMSOptions object as source
  • optionFile: Option file name to load as source

Return: instance of GAMSOptions

See also
GAMSOptions