Loading...
Searching...
No Matches
matlab.gams.control.Workspace Class Reference

Base class in the GAMS package. More...

Public Member Functions

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

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
 
gams.control.globals.DebugLevel debugLevel
 GAMS debug level.
 
double eps
 value to be stored in and read from Database 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 Database, Job, and Checkpoint) have to be created by an "add" method provided by Workspace.

When creating a Workspace 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 Options. 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 Workspace 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 Globals.workingDirectory which by default is the user working directory (the java property "java.io.tmpdir").
  • The debug level is set to globals.DebugLevel.OFF by default, that is no debug information available.

To create a Workspace 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 Workspace(String, String, globals.DebugLevel) constructor or creating first a WorkspaceInfo instance that contains attribute values and then passing it as input parameter for one of the Workspace 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 Workspace in parallel, you should avoid using the same working directory. Otherwise you may end up with conflicting file names.

See also
Checkpoint, Database, Globals, Job, Options, WorkspaceInfo, globals.DebugLevel

Constructor & Destructor Documentation

◆ Workspace()

matlab.gams.control.Workspace.Workspace ( varargin  )

Construct a new Workspace 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 Globals.workingDirectoryPrefix) under the temporary directory (specified by Globals.workingDirectory) will be created and taken as the working directory of the workspace. After the directory is successfully created, the property Workspace.workingDirectory will contain the string describing the working directory and the property Workspace.isUsingTmpWorkingDirectory will return true. Under situations where the directory could not be created, the directory specified by Globals.workingDirectory will be taken as the working directory of the workspace. Under such situation, the property Workspace.workingDirectory will contain the working directory string and the property Workspace.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 globals.DebugLevel.OFF. The debug level can be specified to other value by an instance of globals.DebugLevel. Note that when a Workspace instance is created, it also allows an environment variable "GAMSOOAPIDEBUG" containing a string that represents the desired globals.DebugLevel to override the debug level of the created instance.

Valid VARARGIN signatures:

Arguments:

  • info: a WorkspaceInfo 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 Workspace

See also
Globals, WorkspaceInfo, globals.DebugLevel

Member Function Documentation

◆ addCheckpoint()

gams.control.Checkpoint matlab.gams.control.Workspace.addCheckpoint ( varargin  )

Create a Checkpoint.

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

Valid VARARGIN signatures:

  • [ ]
  • string checkpointName

Arguments:

  • checkpointName: Identifier of Checkpoint or filename for existing checkpoint

Return: instance of Checkpoint

See also
Checkpoint

◆ addDatabase()

gams.control.Database matlab.gams.control.Workspace.addDatabase ( varargin  )

Create a Database.

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

Valid VARARGIN signatures:

  • [ ]
  • string databaseName
  • Database sourceDatabase
  • Database sourceDatabase, string databaseName

Arguments:

  • databaseName: Identifier of Database
  • sourceDatabase: Source Database to initialize Database from

Return: instance of Database

See also
Database

◆ addDatabaseFromGDX()

gams.control.Database matlab.gams.control.Workspace.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 Database

Return: instance of Database

See also
Database

◆ addJobFromApiLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromApiLib ( string  modelName)

Retrieves model from GAMS API Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addJobFromDataLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromDataLib ( string  modelName)

Retrieves model from GAMS Data Utilities Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addJobFromEmpLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromEmpLib ( string  modelName)

Retrieves model from Extended Math Programming Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addJobFromFile()

gams.control.Job matlab.gams.control.Workspace.addJobFromFile ( varargin  )

Create Job from model file.

Valid VARARGIN signatures:

  • string fileName
  • string fileName, string jobName
  • string fileName, Checkpoint checkpoint, string jobName

Arguments:

  • fileName: Source file name
  • jobName: Job name
  • checkpoint: Checkpoint to initialize Job from

Return: instance of Job

See also
Job, Checkpoint

◆ addJobFromFinLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromFinLib ( string  modelName)

Retrieves model from GAMS Practical Financial Optimization Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addJobFromGamsLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromGamsLib ( string  modelName)

Retrieves model from GAMS Model Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addJobFromNoaLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromNoaLib ( string  modelName)

Retrieves model from GAMS Non-linear Optimization Applications Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addJobFromPsoptLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromPsoptLib ( string  modelName)

Retrieves model from Power System Optimization Modelling Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addJobFromString()

gams.control.Job matlab.gams.control.Workspace.addJobFromString ( varargin  )

Create Job from string model source.

Valid VARARGIN signatures:

  • string source
  • string source, Checkpoint checkpoint
  • string source, Checkpoint checkpoint, string jobName

Arguments:

  • source: GAMS model as string
  • checkpoint: Checkpoint to initialize Job from
  • jobName: Job name

Return: instance of Job

See also
Job, Checkpoint

◆ addJobFromTestLib()

gams.control.Job matlab.gams.control.Workspace.addJobFromTestLib ( string  modelName)

Retrieves model from GAMS Test Library.

Arguments:

  • modelName: input model name (without path)

Return: instance of Job

See also
Job

◆ addOptions()

gams.control.Options matlab.gams.control.Workspace.addOptions ( varargin  )

Create Options.

Valid VARARGIN signatures:

  • [ ]
  • Options option
  • string optionFile

Arguments:

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

Return: instance of Options

See also
Options