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...
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< GAMSSymbolDomainViolation > | GetSymbolDVs (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]
|
inlineprotected |
Constructor.
- Parameters
-
database Corresponding GAMSDatabase symPtr Symbol Pointer
◆ GAMSSymbol() [2/2]
|
inlineprotected |
Constructor.
- Parameters
-
database Corresponding GAMSDatabase identifier Symbol name dimension Symbol dimension explanatoryText Explanatory text to symbol
Member Function Documentation
◆ AddRecord()
|
inline |
Add record to GAMSSymbol.
- Parameters
-
keys List of keys
- Returns
- Reference to added record
◆ 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()
|
inline |
Clear symbol.
- Returns
- True if everything worked, else false
◆ CopyFromDenseArray()
|
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
-
cube Array 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 domains Domains of the symbol (one GAMSSet per dimension)
◆ CopySliceFromDenseArray()
|
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
-
cube Array 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 domains First 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]
|
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
-
cube Array 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 field Defines the field to store for Equation or Variable domains Domains of the source symbol (one GAMSSet per dimension)
- Returns
- Number of dropped records
◆ CopySparseToDenseArray() [2/2]
|
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
-
cube Array 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 domains Domains of the source symbol (one GAMSSet per dimension)
- Returns
- Number of dropped records
◆ CopySymbol()
|
inline |
Copys all records of this GAMSSymbol to target GAMSSymbol (if target had records, they will be deleted)
- Parameters
-
target Target GAMSSymbol
◆ CopyToArray()
|
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
-
cube Array 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 field Defines the field to store for Equation or Variable
◆ CopyToSqzdArray() [1/2]
|
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
-
cube Array 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 field Defines the field to store for Equation or Variable domains First 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]
|
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
-
cube Array 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 domains First 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()
|
inline |
Delete GAMSSymbol record.
- Parameters
-
keys List of keys
- Returns
- True if everything worked, else (record does not exist) false
◆ Equals() [1/2]
|
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
-
s The reference GAMSSymbol with which to compare
- Returns
- True if this GAMSSymbol is the same as the s argument; False otherwise.
◆ Equals() [2/2]
|
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
-
obj The reference object with which to compare
- Returns
- True if this object is the same as the obj argument; False otherwise.
◆ FindRecord()
|
inline |
Find record in GAMSSymbol.
- Parameters
-
keys List of keys
- Returns
- Reference to found record
◆ FirstRecord() [1/2]
|
inline |
Retrieve first record in GAMSSymbol.
- Returns
- Reference to record
◆ FirstRecord() [2/2]
|
inline |
Retrieve the first record in GAMSSymbol that meets the slice criteria.
- Parameters
-
slice Define filter for elements whose record should be retrieved
- Returns
- Refreence to record
◆ GetEnumerator()
|
inline |
Retrieve an enumerator for this symbol.
- Returns
- Instance of GAMSSymbolEnumerator.
◆ 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()
|
inline |
Return all GAMSSymbolDomainViolations.
- Parameters
-
MaxViol The maximum number of domain violations which should be stored (0 for no limit)
- Returns
- List of GAMSSymbolDomainViolations
◆ LastRecord() [1/2]
|
inline |
Retrieve last record in GAMSSymbol.
- Returns
- Reference to record
◆ LastRecord() [2/2]
|
inline |
Retrieve a slice of the last record in GAMSSymbol.
- Parameters
-
slice Define filter for elements whose record should be retrieved
- Returns
- Reference to record
◆ MergeRecord()
|
inline |
Finds record in GAMSSymbol if it exists, adds it if not.
- Parameters
-
keys List of keys
- Returns
- Reference to found or added record
◆ operator!=()
|
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
-
lhs First GAMSSybol to be compared. rhs Second GAMSSybol to be compared.
- Returns
- True if both GAMSSymbols are different; False otherwise.
◆ operator==()
|
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
-
lhs First GAMSSybol to be compared. rhs Second GAMSSybol to be compared.
- Returns
- True if both GAMSSymbols are the same; False otherwise.
Property Documentation
◆ Dim
|
get |
Get GAMSSymbol dimension.
◆ Domains
|
get |
Domains of Symbol, each element is either a GAMSSet (real domain) or a string (relaxed domain)
◆ 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
|
get |
Get GAMSDatabase containing GAMSSymbol.
◆ Name
|
get |
Get GAMSSymbol name.
◆ NumberRecords
|
get |
Retrieve the number of records of the GAMSSymbol.
◆ Text
|
get |
Get explanatory text of GAMSSymbol.