gams.database._GamsSymbol Class Reference

This is the representation of a symbol in GAMS. More...

Inheritance diagram for gams.database._GamsSymbol:
gams.database.GamsEquation gams.database.GamsParameter gams.database.GamsSet gams.database.GamsVariable

Public Member Functions

def __len__ (self)
 Retrieve the number of records of the GamsSymbol.
 
def copy_symbol (self, target)
 Copys all records from the GamsSymbol to the target GamsSymbol (if target had records, they will be deleted) More...
 
def delete_record (self, keys=None)
 Delete GamsSymbol record. More...
 
def clear (self)
 Clear symbol. More...
 
def find_record (self, keys=None)
 Find record in GamsSymbol. More...
 
def add_record (self, keys=None)
 Add record to GamsSymbol. More...
 
def merge_record (self, keys=None)
 Finds record in GamsSymbol if it exists, adds it if not. More...
 
def first_record (self, slice=None)
 Retrieve first record in GamsSymbol. More...
 
def check_domains (self)
 Check if all records are within the specified domain of the symbol. More...
 
def get_symbol_dvs (self, max_viol=0)
 return all GamsSymbolDomainViolations More...
 

Properties

 domains = property(get_domains)
 Domains of Symbol, each element is either a GamsSet (real domain) or a string (relaxed domain)
 
 domains_as_strings = property(get_domains_as_strings)
 Domains of Symbol, each element is a string. More...
 
 dimension = property(get_dimension)
 Get GamsSymbol dimension.
 
 text = property(get_text)
 Get explanatory text of GamsSymbol.
 
 name = property(get_name)
 Get GamsSymbol name.
 
 database = property(get_database)
 Get GamsDatabase containing GamsSymbol.
 
 number_records = property(get_number_records)
 Retrieve the number of records of the GamsSymbol. 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.

Member Function Documentation

◆ add_record()

def gams.database._GamsSymbol.add_record (   self,
  keys = None 
)

Add record to GamsSymbol.

Parameters
keysList of keys
Returns
Reference to added record

◆ check_domains()

def gams.database._GamsSymbol.check_domains (   self)

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

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

◆ clear()

def gams.database._GamsSymbol.clear (   self)

Clear symbol.

Returns
True if everything worked, else False

◆ copy_symbol()

def gams.database._GamsSymbol.copy_symbol (   self,
  target 
)

Copys all records from the GamsSymbol to the target GamsSymbol (if target had records, they will be deleted)

Parameters
targetTarget GamsSymbol
Returns
True if everything worked, else false

◆ delete_record()

def gams.database._GamsSymbol.delete_record (   self,
  keys = None 
)

Delete GamsSymbol record.

Parameters
keysList of keys
Returns
True if everything worked, else False

◆ find_record()

def gams.database._GamsSymbol.find_record (   self,
  keys = None 
)

Find record in GamsSymbol.

Parameters
keysList of keys
Returns
Reference to found record

◆ first_record()

def gams.database._GamsSymbol.first_record (   self,
  slice = None 
)

Retrieve first record in GamsSymbol.

Parameters
sliceDefine filter for elements whose record should be retrieved
print "Transportation costs from Seattle"
record = job.out_db.get_parameter("c").first_record(["seattle", " "])
Returns
Reference to record

◆ get_symbol_dvs()

def gams.database._GamsSymbol.get_symbol_dvs (   self,
  max_viol = 0 
)

return all GamsSymbolDomainViolations

Parameters
max_violThe maximum number of domain violations which should be stored (0 for no limit)
Returns
List containing GamsSymbolDomainViolation objects

◆ merge_record()

def gams.database._GamsSymbol.merge_record (   self,
  keys = None 
)

Finds record in GamsSymbol if it exists, adds it if not.

Parameters
keysList of keys
Returns
Reference to found or added record

Property Documentation

◆ domains_as_strings

gams.database._GamsSymbol.domains_as_strings = property(get_domains_as_strings)
static

Domains of Symbol, each element is a string.

Note: If the domains is as alias in GAMS, this call will return the name of the alias, not the name of the aliased set

◆ number_records

gams.database._GamsSymbol.number_records = property(get_number_records)
static

Retrieve the number of records of the GamsSymbol.

Note
This is the same as calling len(symbol)