This is the representation of a symbol in GAMS. It exists in a GAMSDatabase and contains GAMSSymbolRecords which one can iterate through. Derived classes are GAMSEquation, GAMSParameter, GAMSSet and GAMSVariable. More...

Inheritance diagram for GAMS.GAMSSymbol:
GAMS.GAMSEquation GAMS.GAMSParameter GAMS.GAMSSet GAMS.GAMSVariable

Public Member Functions

bool DeleteRecord (params string[] keys)
 Delete GAMSSymbol record More...
 
bool Clear ()
 Clear symbol More...
 
bool CheckDomains ()
 Check if all records are within the specified domain of the symbol More...
 
List< GAMSSymbolDomainViolationGetSymbolDVs (int MaxViol=0)
 Return all GAMSSymbolDomainViolations More...
 
GAMSSymbolRecord AddRecord (params string[] keys)
 Add record to GAMSSymbol More...
 
GAMSSymbolRecord FindRecord (params string[] keys)
 Find record in GAMSSymbol More...
 
GAMSSymbolRecord MergeRecord (params string[] keys)
 Finds record in GAMSSymbol if it exists, adds it if not More...
 
GAMSSymbolRecord FirstRecord ()
 Retrieve first record in GAMSSymbol More...
 
GAMSSymbolRecord FirstRecord (params string[] slice)
 Retrieve the first record in GAMSSymbol that meets the slice criteria. More...
 
GAMSSymbolRecord LastRecord ()
 Retrieve last record in GAMSSymbol More...
 
GAMSSymbolRecord LastRecord (params string[] slice)
 Retrieve a slice of the last record in GAMSSymbol More...
 
void CopySymbol (GAMSSymbol target)
 Copys all records of this GAMSSymbol to target GAMSSymbol (if target had records, they will be deleted) More...
 
void CopyToArray (object cube, int field=gamsglobals.val_level)
 Copies values of a dense symbol into a dense array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the parameter field determines what is stored More...
 
int CopyToSqzdArray (object cube, int field, params Tuple< GAMSSet, GAMSSet >[] domains)
 Copies values of a sparse symbol into a squeezed array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the parameter field determines what is stored More...
 
int CopyToSqzdArray (object cube, params Tuple< GAMSSet, GAMSSet >[] domains)
 Copies values of a sparse symbol into a squeezed array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the level is stored. More...
 
int CopySparseToDenseArray (object cube, int field, params GAMSSet[] domains)
 Copies values of a sparse symbol into a dense array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the parameter field determines what is stored More...
 
int CopySparseToDenseArray (object cube, params GAMSSet[] domains)
 Copies values of a sparse symbol into a squeezed array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the level is stored. More...
 
void CopyFromDenseArray (object cube, params GAMSSet[] domains)
 Copies values from dense array into a symbol If the symbol is a set, the defined records are added. If the symbol is a parameter, the defined records are added and the values are set. If the symbol is an equation or a variable, the defined records are added and the levels are set.111 More...
 
void CopySliceFromDenseArray (object cube, params Tuple< GAMSSet, GAMSSet >[] domains)
 Copies values from slice of dense array into a symbol If the symbol is a set, the defined records are added. If the symbol is a parameter, the defined records are added and the values are set. If the symbol is an equation or a variable, the defined records are added and the levels are set.111 More...
 
GAMSSymbolEnumerator GetEnumerator ()
 Retrieve an enumerator for this symbol. More...
 

Protected Member Functions

 GAMSSymbol (GAMSDatabase database, IntPtr symPtr)
 Constructor More...
 
 GAMSSymbol (GAMSDatabase database, string identifier, int dimension, string explanatoryText)
 Constructor More...
 

Properties

GAMSDatabase GAMSDatabase [get]
 Get GAMSDatabase containing GAMSSymbol More...
 
string Name [get]
 Get GAMSSymbol name More...
 
int Dim [get]
 Get GAMSSymbol dimension More...
 
string Text [get]
 Get explanatory text of GAMSSymbol More...
 
int NumberRecords [get]
 Retrieve the number of records of the GAMSSymbol More...
 
List< object > Domains [get]
 Domains of Symbol, each element is either a GAMSSet (real domain) or a string (relaxed domain) More...
 
List< string > DomainsAsStrings [get]
 Domains of Symbol, each element is a string Note: If the domain is an alias in GAMS, this call will return the name of the Alias, not the name of the aliased Set More...
 

Detailed Description

This is the representation of a symbol in GAMS. It exists in a GAMSDatabase and contains GAMSSymbolRecords which one can iterate through. Derived classes are GAMSEquation, GAMSParameter, GAMSSet and GAMSVariable.

Constructor & Destructor Documentation

◆ GAMSSymbol() [1/2]

GAMS.GAMSSymbol.GAMSSymbol ( GAMSDatabase  database,
IntPtr  symPtr 
)
inlineprotected

Constructor

Parameters
databaseCorresponding GAMSDatabase
symPtrSymbol Pointer

◆ GAMSSymbol() [2/2]

GAMS.GAMSSymbol.GAMSSymbol ( GAMSDatabase  database,
string  identifier,
int  dimension,
string  explanatoryText 
)
inlineprotected

Constructor

Parameters
databaseCorresponding GAMSDatabase
identifierSymbol name
dimensionSymbol dimension
explanatoryTextExplanatory text to symbol

Member Function Documentation

◆ AddRecord()

GAMSSymbolRecord GAMS.GAMSSymbol.AddRecord ( params string []  keys)
inline

Add record to GAMSSymbol

Parameters
keysList of keys
Returns
Reference to added record

◆ CheckDomains()

bool GAMS.GAMSSymbol.CheckDomains ( )
inline

Check if all records are within the specified domain of the symbol

Returns
True: Everything is correct, False: There is a domain violation

◆ Clear()

bool GAMS.GAMSSymbol.Clear ( )
inline

Clear symbol

Returns
True if everything worked, else false

◆ CopyFromDenseArray()

void GAMS.GAMSSymbol.CopyFromDenseArray ( object  cube,
params GAMSSet []  domains 
)
inline

Copies values from dense array into a symbol If the symbol is a set, the defined records are added. If the symbol is a parameter, the defined records are added and the values are set. If the symbol is an equation or a variable, the defined records are added and the levels are set.111

Parameters
cubeArray containing the data, dimension must be equal to dimension of symbol, for a GAMSSet, it must be an int array, for the other symbol types it must be a double array
domainsDomains of the symbol (one GAMSSet per dimension)

◆ CopySliceFromDenseArray()

void GAMS.GAMSSymbol.CopySliceFromDenseArray ( object  cube,
params Tuple< GAMSSet, GAMSSet > []  domains 
)
inline

Copies values from slice of dense array into a symbol If the symbol is a set, the defined records are added. If the symbol is a parameter, the defined records are added and the values are set. If the symbol is an equation or a variable, the defined records are added and the levels are set.111

Parameters
cubeArray containing the data, dimension must be equal to dimension of symbol, for a GAMSSet, it must be an int array, for the other symbol types it must be a double array
domainsFirst item in tuple is the domain of the slice to store, second item is the domain of the source symbol (one tuple per dimension)

◆ CopySparseToDenseArray() [1/2]

int GAMS.GAMSSymbol.CopySparseToDenseArray ( object  cube,
int  field,
params GAMSSet []  domains 
)
inline

Copies values of a sparse symbol into a dense array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the parameter field determines what is stored

Parameters
cubeArray to store data in, dimension must be equal to dimension of symbol, for a GAMSSet, it must be an int array, for the other symbol types it must be a double array
fieldDefines the field to store for Equation or Variable
domainsDomains of the source symbol (one GAMSSet per dimension)
Returns
Number of dropped records

◆ CopySparseToDenseArray() [2/2]

int GAMS.GAMSSymbol.CopySparseToDenseArray ( object  cube,
params GAMSSet []  domains 
)
inline

Copies values of a sparse symbol into a squeezed array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the level is stored.

Parameters
cubeArray to store data in, dimension must be equal to dimension of symbol, for a GAMSSet, it must be an int array, for the other symbol types it must be a double array
domainsDomains of the source symbol (one GAMSSet per dimension)
Returns
Number of dropped records

◆ CopySymbol()

void GAMS.GAMSSymbol.CopySymbol ( GAMSSymbol  target)
inline

Copys all records of this GAMSSymbol to target GAMSSymbol (if target had records, they will be deleted)

Parameters
targetTarget GAMSSymbol

◆ CopyToArray()

void GAMS.GAMSSymbol.CopyToArray ( object  cube,
int  field = gamsglobals.val_level 
)
inline

Copies values of a dense symbol into a dense array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the parameter field determines what is stored

Parameters
cubeArray to store data in, dimension must be equal to dimension of symbol, for a GAMSSet, it must be an int array, for the other symbol types it must be a double array
fieldDefines the field to store for Equation or Variable

◆ CopyToSqzdArray() [1/2]

int GAMS.GAMSSymbol.CopyToSqzdArray ( object  cube,
int  field,
params Tuple< GAMSSet, GAMSSet > []  domains 
)
inline

Copies values of a sparse symbol into a squeezed array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the parameter field determines what is stored

Parameters
cubeArray to store data in, dimension must be equal to dimension of symbol, for a GAMSSet, it must be an int array, for the other symbol types it must be a double array
fieldDefines the field to store for Equation or Variable
domainsFirst item in tuple is the domain of the sqeezed array, second item is the domain of the source symbol (one tuple per dimension)
Returns
Number of dropped records

◆ CopyToSqzdArray() [2/2]

int GAMS.GAMSSymbol.CopyToSqzdArray ( object  cube,
params Tuple< GAMSSet, GAMSSet > []  domains 
)
inline

Copies values of a sparse symbol into a squeezed array If the symbol is a set, the position of each record within the set is stored (1-based). If the symbol is a parameter the value is stored. If the symbol is an equation or a variable the level is stored.

Parameters
cubeArray to store data in, dimension must be equal to dimension of symbol, for a GAMSSet, it must be an int array, for the other symbol types it must be a double array
domainsFirst item in tuple is the domain of the sqeezed array, second item is the domain of the source symbol (one tuple per dimension)
Returns
Number of dropped records

◆ DeleteRecord()

bool GAMS.GAMSSymbol.DeleteRecord ( params string []  keys)
inline

Delete GAMSSymbol record

Parameters
keysList of keys
Returns
True if everything worked, else (record does not exist) false

◆ FindRecord()

GAMSSymbolRecord GAMS.GAMSSymbol.FindRecord ( params string []  keys)
inline

Find record in GAMSSymbol

Parameters
keysList of keys
Returns
Reference to found record

◆ FirstRecord() [1/2]

GAMSSymbolRecord GAMS.GAMSSymbol.FirstRecord ( )
inline

Retrieve first record in GAMSSymbol

try
{
Console.WriteLine("Transportation costs");
GAMSParameterRecord x = job.OutDB.GetParameter("c").FirstRecord();
do
{
Console.WriteLine(x.Keys[0] + "." + x.Keys[1] + ":" + x.Value);
} while (x.MoveNext());
}
catch
{
Console.WriteLine("No records found");
}
Returns
Reference to record

◆ FirstRecord() [2/2]

GAMSSymbolRecord GAMS.GAMSSymbol.FirstRecord ( params string []  slice)
inline

Retrieve the first record in GAMSSymbol that meets the slice criteria.

try
{
Console.WriteLine("Transportation costs from Seattle");
GAMSParameterRecord x = job.OutDB.GetParameter("c").FirstRecord("seattle", " ");
do
{
Console.WriteLine(x.Keys[1] + ":" + x.Value);
} while (x.MoveNext());
}
catch
{
Console.WriteLine("No records found");
}
Parameters
sliceDefine filter for elements whose record should be retrieved
Returns
Refreence to record

◆ GetEnumerator()

GAMSSymbolEnumerator GAMS.GAMSSymbol.GetEnumerator ( )
inline

Retrieve an enumerator for this symbol.

Returns
Instance of GAMSSymbolEnumerator.

◆ GetSymbolDVs()

List<GAMSSymbolDomainViolation> GAMS.GAMSSymbol.GetSymbolDVs ( int  MaxViol = 0)
inline

Return all GAMSSymbolDomainViolations

Parameters
MaxViolThe maximum number of domain violations which should be stored (0 for no limit)
Returns
List of GAMSSymbolDomainViolations

◆ LastRecord() [1/2]

GAMSSymbolRecord GAMS.GAMSSymbol.LastRecord ( )
inline

Retrieve last record in GAMSSymbol

Returns
Reference to record

◆ LastRecord() [2/2]

GAMSSymbolRecord GAMS.GAMSSymbol.LastRecord ( params string []  slice)
inline

Retrieve a slice of the last record in GAMSSymbol

Parameters
sliceDefine filter for elements whose record should be retrieved
Returns
Reference to record

◆ MergeRecord()

GAMSSymbolRecord GAMS.GAMSSymbol.MergeRecord ( params string []  keys)
inline

Finds record in GAMSSymbol if it exists, adds it if not

Parameters
keysList of keys
Returns
Reference to found or added record

Property Documentation

◆ Dim

int GAMS.GAMSSymbol.Dim
get

Get GAMSSymbol dimension

◆ Domains

List<object> GAMS.GAMSSymbol.Domains
get

Domains of Symbol, each element is either a GAMSSet (real domain) or a string (relaxed domain)

◆ DomainsAsStrings

List<string> GAMS.GAMSSymbol.DomainsAsStrings
get

Domains of Symbol, each element is a string Note: If the domain is an alias in GAMS, this call will return the name of the Alias, not the name of the aliased Set

◆ GAMSDatabase

GAMSDatabase GAMS.GAMSSymbol.GAMSDatabase
get

Get GAMSDatabase containing GAMSSymbol

◆ Name

string GAMS.GAMSSymbol.Name
get

Get GAMSSymbol name

◆ NumberRecords

int GAMS.GAMSSymbol.NumberRecords
get

Retrieve the number of records of the GAMSSymbol

◆ Text

string GAMS.GAMSSymbol.Text
get

Get explanatory text of GAMSSymbol