Loading...
Searching...
No Matches

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.
 
bool Clear ()
 Clear symbol.
 
bool CheckDomains ()
 Check if all records are within the specified domain of the symbol.
 
List< GAMSSymbolDomainViolationGetSymbolDVs (int MaxViol=0)
 Return all GAMSSymbolDomainViolations.
 
GAMSSymbolRecord AddRecord (params string[] keys)
 Add record to GAMSSymbol.
 
GAMSSymbolRecord FindRecord (params string[] keys)
 Find record in GAMSSymbol.
 
GAMSSymbolRecord MergeRecord (params string[] keys)
 Finds record in GAMSSymbol if it exists, adds it if not.
 
GAMSSymbolRecord FirstRecord ()
 Retrieve first record in GAMSSymbol.
 
GAMSSymbolRecord FirstRecord (params string[] slice)
 Retrieve the first record in GAMSSymbol that meets the slice criteria.
 
GAMSSymbolRecord LastRecord ()
 Retrieve last record in GAMSSymbol.
 
GAMSSymbolRecord LastRecord (params string[] slice)
 Retrieve a slice of the last record in GAMSSymbol.
 
void CopySymbol (GAMSSymbol target)
 Copys all records of this GAMSSymbol to target GAMSSymbol (if target had records, they will be deleted)
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
override bool Equals (object obj)
 Indicates whether another object is "equal to" this one. This is the case if they hold the same Symbol Pointer (aka the same internal reference).
 
override int GetHashCode ()
 Calculates a Hash Code based on the Sympol Pointer (aka the internal reference).
 
bool Equals (GAMSSymbol s)
 Indicates whether another GAMSSymbol is "equal to" this one. This is the case if they hold the same Symbol Pointer (aka the same internal reference).
 
GAMSSymbolEnumerator GetEnumerator ()
 Retrieve an enumerator for this symbol.
 

Static Public Member Functions

static bool operator== (GAMSSymbol lhs, GAMSSymbol rhs)
 Indicate whether two GAMSSybols are equal to each other. This is the case if they hold the same Symbol Pointer (aka the same internal reference).
 
static bool operator!= (GAMSSymbol lhs, GAMSSymbol rhs)
 Indicate whether two GAMSSybols are not equal to each other. This is the case if they hold different Symbol Pointer (aka different internal references).
 

Protected Member Functions

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

Properties

GAMSDatabase GAMSDatabase [get]
 Get GAMSDatabase containing GAMSSymbol.
 
string Name [get]
 Get GAMSSymbol name.
 
int Dim [get]
 Get GAMSSymbol dimension.
 
string Text [get]
 Get explanatory text of GAMSSymbol.
 
int NumberRecords [get]
 Retrieve the number of records of the GAMSSymbol.
 
List< object > Domains [get]
 Domains of Symbol, each element is either a GAMSSet (real domain) or a string (relaxed domain)
 
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.
 

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

◆ Equals() [1/2]

bool GAMS.GAMSSymbol.Equals ( GAMSSymbol  s)
inline

Indicates whether another GAMSSymbol is "equal to" this one. This is the case if they hold the same Symbol Pointer (aka the same internal reference).

Parameters
sThe reference GAMSSymbol with which to compare
Returns
True if this GAMSSymbol is the same as the s argument; False otherwise.

◆ Equals() [2/2]

override bool GAMS.GAMSSymbol.Equals ( object  obj)
inline

Indicates whether another object is "equal to" this one. This is the case if they hold the same Symbol Pointer (aka the same internal reference).

Parameters
objThe reference object with which to compare
Returns
True if this object is the same as the obj argument; False otherwise.

◆ 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");
}
This is the representation of a single record of a GAMSParameter.
Definition: GAMSParameterRecord.cs:10
double Value
Get: Retrieve the value of this GAMSParameterRecord Set: Set the value of this GAMSParameterRecord.
Definition: GAMSParameterRecord.cs:38
bool MoveNext()
Iterate to next GAMSSymbolRecord of GAMSSymbol.
Definition: GAMSSymbolRecord.cs:83
string[] Keys
Retrieve keys of GAMSSymbolRecord.
Definition: GAMSSymbolRecord.cs:58
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.

◆ GetHashCode()

override int GAMS.GAMSSymbol.GetHashCode ( )
inline

Calculates a Hash Code based on the Sympol Pointer (aka the internal reference).

Returns
A Hash Code based on the Sympol Pointer (aka the internal reference)

◆ 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

◆ operator!=()

static bool GAMS.GAMSSymbol.operator!= ( GAMSSymbol  lhs,
GAMSSymbol  rhs 
)
inlinestatic

Indicate whether two GAMSSybols are not equal to each other. This is the case if they hold different Symbol Pointer (aka different internal references).

Parameters
lhsFirst GAMSSybol to be compared.
rhsSecond GAMSSybol to be compared.
Returns
True if both GAMSSymbols are different; False otherwise.

◆ operator==()

static bool GAMS.GAMSSymbol.operator== ( GAMSSymbol  lhs,
GAMSSymbol  rhs 
)
inlinestatic

Indicate whether two GAMSSybols are equal to each other. This is the case if they hold the same Symbol Pointer (aka the same internal reference).

Parameters
lhsFirst GAMSSybol to be compared.
rhsSecond GAMSSybol to be compared.
Returns
True if both GAMSSymbols are the same; False otherwise.

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.