Loading...
Searching...
No Matches
gams.control.database._GamsSymbol Class Reference

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

Inheritance diagram for gams.control.database._GamsSymbol:
gams.control.database.GamsEquation gams.control.database.GamsParameter gams.control.database.GamsSet gams.control.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)
 
def delete_record (self, keys=None)
 Delete GamsSymbol record.
 
def clear (self)
 Clear symbol.
 
def find_record (self, keys=None)
 Find record in GamsSymbol.
 
def add_record (self, keys=None)
 Add record to GamsSymbol.
 
def merge_record (self, keys=None)
 Finds record in GamsSymbol if it exists, adds it if not.
 
def first_record (self, slice=None)
 Retrieve first record in GamsSymbol.
 
def check_domains (self)
 Check if all records are within the specified domain of the symbol.
 
def get_symbol_dvs (self, max_viol=0)
 return all GamsSymbolDomainViolations
 

Properties

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

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.control.database._GamsSymbol.add_record (   self,
  keys = None 
)

Add record to GamsSymbol.

Parameters
keysList of keys
Returns
Reference to added record

◆ check_domains()

def gams.control.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.control.database._GamsSymbol.clear (   self)

Clear symbol.

Returns
True if everything worked, else False

◆ copy_symbol()

def gams.control.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.control.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.control.database._GamsSymbol.find_record (   self,
  keys = None 
)

Find record in GamsSymbol.

Parameters
keysList of keys
Returns
Reference to found record

◆ first_record()

def gams.control.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.control.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.control.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

property gams.control.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

property gams.control.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)