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:
- [ ]
- WorkspaceInfo info
- string workingDir, string systemDir, globals.DebugLevel level
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 | ) |
◆ addDatabaseFromGDX()
gams.control.Database matlab.gams.control.Workspace.addDatabaseFromGDX | ( | varargin | ) |
◆ addJobFromApiLib()
gams.control.Job matlab.gams.control.Workspace.addJobFromApiLib | ( | string | modelName | ) |
◆ addJobFromDataLib()
gams.control.Job matlab.gams.control.Workspace.addJobFromDataLib | ( | string | modelName | ) |
◆ addJobFromEmpLib()
gams.control.Job matlab.gams.control.Workspace.addJobFromEmpLib | ( | string | modelName | ) |
◆ 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 | ) |
◆ addJobFromGamsLib()
gams.control.Job matlab.gams.control.Workspace.addJobFromGamsLib | ( | string | modelName | ) |
◆ addJobFromNoaLib()
gams.control.Job matlab.gams.control.Workspace.addJobFromNoaLib | ( | string | modelName | ) |
◆ addJobFromPsoptLib()
gams.control.Job matlab.gams.control.Workspace.addJobFromPsoptLib | ( | string | modelName | ) |
◆ 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 | ) |