Public Member Functions | |
void | GamsLib (string model) |
Retrieves model from GAMS Model Library. | |
void | TestLib (string model) |
Retrieves model from GAMS Test Library. | |
void | EmpLib (string model) |
Retrieves model from Extended Math Programming Library. | |
void | DataLib (string model) |
Retrieves model from GAMS Data Utilities Library. | |
void | ApiLib (string model) |
Retrieves model from GAMS API Library. | |
void | FinLib (string model) |
Retrieves model from Practical Financial Optimization Library. | |
void | NoaLib (string model) |
Retrieves model from Nonlinear Optimization Applications Library. | |
void | PsoptLib (string model) |
Retrieves model from Power System Optimization Modelling Library. | |
GAMSWorkspace (string workingDirectory=null, string systemDirectory=null, DebugLevel debug=DebugLevel.KeepFilesOnError) | |
Constructor. | |
GAMSWorkspace (GAMSWorkspaceInfo wsInfo) | |
Constructor. | |
GAMSDatabase | AddDatabaseFromGDX (string gdxFileName, string databaseName=null, string inModelName=null) |
Database creation from an existing GDX file. | |
GAMSDatabase | AddDatabase (string databaseName=null, string inModelName=null) |
Empty Database creation. | |
GAMSDatabase | AddDatabase (GAMSDatabase sourceDatabase, string databaseName=null, string inModelName=null) |
Database creation from existing database. | |
GAMSJob | AddJobFromString (string gamsSource, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from string model source. | |
GAMSJob | AddJobFromFile (string fileName, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model file. | |
GAMSJob | AddJobFromGamsLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from GAMS Model Library. | |
GAMSJob | AddJobFromTestLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from GAMS Test Library. | |
GAMSJob | AddJobFromEmpLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from Extended Math Programming Library. | |
GAMSJob | AddJobFromDataLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from GAMS Data Utilities Library. | |
GAMSJob | AddJobFromFinLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from Practical Financial Optimization Library. | |
GAMSJob | AddJobFromApiLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from API Library. | |
GAMSJob | AddJobFromNoaLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from Nonlinear Optimization Applications Library. | |
GAMSJob | AddJobFromPsoptLib (string model, GAMSCheckpoint checkpoint=null, string jobName=null) |
Create GAMSJob from model from Power System Optimization Modelling Library. | |
GAMSCheckpoint | AddCheckpoint (string checkpointName=null) |
Create GAMSCheckpoint. | |
GAMSOptions | AddOptions (GAMSOptions optFrom=null) |
Create GAMSOptions. | |
GAMSOptions | AddOptions (string optFile) |
Create GAMSOptions. | |
Public Attributes | |
string | ScratchFilePrefix = "_gams_net_" |
A string used to prefix automatically generated files. | |
Properties | |
string | Version [get] |
GAMS Version used. | |
int | MajorRelNumber [get] |
GAMS Major Release Number. | |
int | MinorRelNumber [get] |
GAMS Minor Release Number. | |
int | GoldRelNumber [get] |
GAMS GOLD Release Number. | |
static string | APIVersion [get] |
API Version used. | |
static int | APIMajorRelNumber [get] |
API Major Release Number. | |
static int | APIMinorRelNumber [get] |
API Minor Release Number. | |
static int | APIGoldRelNumber [get] |
API GOLD Release Number. | |
double | MyEPS [get, set] |
Reset value to be stored in and read from GAMSDatabase for Epsilon, default is double.Epsilon. | |
string | WorkingDirectory [get] |
Get the working directory. | |
string | SystemDirectory [get] |
Get the system directory. | |
Detailed Description
The GAMSWorkspace is the base class in the GAMS namespace. Most objects of the GAMS namespace (e.g. GAMSDatabase and GAMSJob) have to be created by an "Add" method of GAMSWorkspace.
Unless a GAMS system directory is specified during construction of GAMSWorkspace, GAMSWorkspace determines the location of the GAMS installation automatically. This is a source of potential problems if more than one GAMS installation exist on the machine (see below).
Furthermore, a working directory (the anchor into the file system) can be provided when constructing the GAMSWorkspace instance. All file based operation inside a GAMS model should be relative to this location (e.g. $GDXIN and $include). There are options to add input search paths (e.g. IDir) and output path (e.g. PutDir) to specify other file system locations. If no working directory is supplied, GAMSWorkspace creates a temporary folder and on instance destruction removes this temporary folder.
In a typical .NET solution a single instance of GAMSWorkspace will suffice, since the class is thread-safe.
Note: If you use multiple instances of the GAMSWorkspace in parallel, you should avoid using the same WorkingDirectory. Otherwise you may end up with conflicting file names.
Working with different GAMS Versions on one Machine
When creating a new instance of GAMSWorkspace, one way of defining the GAMS system directory is setting the systemDirectory parameter of the constructor accordingly. If it is not set, it is tried to be defined automatically. However, this can be tricky if there is more than on version of GAMS installed on a machine and especially if there are different applications running with different GAMS versions.
The automatic identification relies on information left in the Windows registry by the GAMS installer. Hence the system directory of the last GAMS installation will be found in this automatic identification step. One way of resetting the information in the registry is running the executable "findthisgams.exe" from the directory that should be detected automatically. While this can be done from the outside of the application it is not much more convenient than the SystemDirectory argument in the GAMSWorkspace constructor. With MONO, first the PATH and then the (DY)LD_LIBRARY_PATH instead of the registry is checked for a valid GAMS system directory.
If one has a very structured way of organizing the GAMS installations (e.g. following the GAMS default installation location) one can construct from the GAMS assembly information enough information to point to the best matching GAMS system directory:
This avoids the automatic identification of the GAMS system directory but might be the most convenient solution for systems running multiple applications using different versions of the GAMS.NET API together with different versions of GAMS.
Constructor & Destructor Documentation
◆ GAMSWorkspace() [1/2]
|
inline |
Constructor.
- Parameters
-
workingDirectory GAMS working directory, anchor for all file-based operations (determined automatically if omitted, in user's temporary folder) systemDirectory GAMS system directory (determined automatically if omitted) debug Debug Flag
◆ GAMSWorkspace() [2/2]
|
inline |
Constructor.
- Parameters
-
wsInfo GAMSWorkspaceInfo defining GAMS working directory, GAMS system directory and Debug Flag
Member Function Documentation
◆ AddCheckpoint()
|
inline |
Create GAMSCheckpoint.
- Parameters
-
checkpointName Identifier of GAMSCheckpoint or filename for existing checkpoint (determined automatically if omitted or set to empty string)
- Returns
- Reference to GAMSCheckpoint
◆ AddDatabase() [1/2]
|
inline |
Database creation from existing database.
- Parameters
-
sourceDatabase Source GAMSDatabase to initialize Database from databaseName Identifier of GAMSDatabase (determined automatically if omitted) inModelName GAMS string constant that is used to access this database
- Returns
- Reference to GAMSDatabase
◆ AddDatabase() [2/2]
|
inline |
Empty Database creation.
- Parameters
-
databaseName Identifier of GAMSDatabase (determined automatically if omitted) inModelName GAMS string constant that is used to access this database
- Returns
- Reference to GAMSDatabase
◆ AddDatabaseFromGDX()
|
inline |
Database creation from an existing GDX file.
- Parameters
-
databaseName Identifier of GAMSDatabase (determined automatically if omitted) gdxFileName GDX File to initialize Database from inModelName GAMS string constant that is used to access this database
- Returns
- Reference to GAMSDatabase
◆ AddJobFromApiLib()
|
inline |
Create GAMSJob from model from API Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromDataLib()
|
inline |
Create GAMSJob from model from GAMS Data Utilities Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromEmpLib()
|
inline |
Create GAMSJob from model from Extended Math Programming Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromFile()
|
inline |
Create GAMSJob from model file.
- Parameters
-
fileName GAMS source file name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromFinLib()
|
inline |
Create GAMSJob from model from Practical Financial Optimization Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromGamsLib()
|
inline |
Create GAMSJob from model from GAMS Model Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromNoaLib()
|
inline |
Create GAMSJob from model from Nonlinear Optimization Applications Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromPsoptLib()
|
inline |
Create GAMSJob from model from Power System Optimization Modelling Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromString()
|
inline |
Create GAMSJob from string model source.
- Parameters
-
gamsSource GAMS model as string checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddJobFromTestLib()
|
inline |
Create GAMSJob from model from GAMS Test Library.
- Parameters
-
model Model name checkpoint GAMSCheckpoint to initialize GAMSJob from jobName Job name (determined automatically if omitted)
- Returns
- Handle to new instance of GAMSJob
◆ AddOptions() [1/2]
|
inline |
Create GAMSOptions.
- Parameters
-
optFrom GAMSOptions used to initialize the new object
- Returns
- Reference to GAMSOptions
◆ AddOptions() [2/2]
|
inline |
Create GAMSOptions.
- Parameters
-
optFile Parameter file used to initialize the new object
- Returns
- Reference to GAMSOptions
◆ ApiLib()
|
inline |
Retrieves model from GAMS API Library.
- Parameters
-
model Model name
◆ DataLib()
|
inline |
Retrieves model from GAMS Data Utilities Library.
- Parameters
-
model Model name
◆ EmpLib()
|
inline |
Retrieves model from Extended Math Programming Library.
- Parameters
-
model Model name
◆ FinLib()
|
inline |
Retrieves model from Practical Financial Optimization Library.
- Parameters
-
model Model name
◆ GamsLib()
|
inline |
Retrieves model from GAMS Model Library.
- Parameters
-
model Model name
◆ NoaLib()
|
inline |
Retrieves model from Nonlinear Optimization Applications Library.
- Parameters
-
model Model name
◆ PsoptLib()
|
inline |
Retrieves model from Power System Optimization Modelling Library.
- Parameters
-
model Model name
◆ TestLib()
|
inline |
Retrieves model from GAMS Test Library.
- Parameters
-
model Model name
Member Data Documentation
◆ ScratchFilePrefix
string GAMS.GAMSWorkspace.ScratchFilePrefix = "_gams_net_" |
A string used to prefix automatically generated files.
Property Documentation
◆ APIGoldRelNumber
|
staticget |
API GOLD Release Number.
◆ APIMajorRelNumber
|
staticget |
API Major Release Number.
◆ APIMinorRelNumber
|
staticget |
API Minor Release Number.
◆ APIVersion
|
staticget |
API Version used.
◆ GoldRelNumber
|
get |
GAMS GOLD Release Number.
◆ MajorRelNumber
|
get |
GAMS Major Release Number.
◆ MinorRelNumber
|
get |
GAMS Minor Release Number.
◆ MyEPS
|
getset |
Reset value to be stored in and read from GAMSDatabase for Epsilon, default is double.Epsilon.
◆ SystemDirectory
|
get |
Get the system directory.
◆ Version
|
get |
GAMS Version used.
◆ WorkingDirectory
|
get |
Get the working directory.