domain_checking.py File Reference

Enforcing referential integrity also known in the GAMS lingo as domain checking is an essential and important part of GAMS. More...

Go to the source code of this file.

Functions

def domain_checking.get_data_text ()
 

Variables

 domain_checking.ws = GamsWorkspace(system_directory = sys.argv[1])
 
list domain_checking.plants = [ "Seattle", "San-Diego" ]
 
list domain_checking.markets = [ "New-York", "Chicago", "Topeka" ]
 
dictionary domain_checking.capacity = { "Seattle": 350.0, "San-Diego": 600.0 }
 
dictionary domain_checking.demand = { "New-York": 325.0, "Chicago": 300.0, "Topeka": 275.0 }
 
dictionary domain_checking.distance
 
 domain_checking.db = ws.add_database()
 
 domain_checking.i = db.add_set("i", 1, "canning plants")
 
 domain_checking.j = GamsSet(db, "j", 1, "markets")
 
 domain_checking.a = db.add_parameter_dc("a", [i], "capacity at plant")
 
 domain_checking.value
 
 domain_checking.b = db.add_parameter_dc("b", ["j"], "demand at market j in cases")
 
 domain_checking.d = db.add_parameter_dc("d",[i,j], "distance in thousands of miles")
 
int domain_checking.dv_cnt = 0
 
 domain_checking.end
 
 domain_checking.vi
 
 domain_checking.keys
 
bool domain_checking.saw_exception = False
 
 domain_checking.suppress_auto_domain_checking
 
 domain_checking.db2 = ws.add_database_from_gdx("test.gdx")
 
 domain_checking.d2 = db2.get_parameter("d")
 
 domain_checking.j_alias = ws.add_job_from_string(get_data_text())
 
 domain_checking.ii = j_alias.out_db.get_set("ii")
 
 domain_checking.test_db = ws.add_database()
 
 domain_checking.test_set = test_db.add_set("test", 1)
 
 domain_checking.text
 
 domain_checking.Text
 

Detailed Description

Enforcing referential integrity also known in the GAMS lingo as domain checking is an essential and important part of GAMS.

The Object- oriented API does a delayed domain checking of symbols. So you can add records to a domain controlled parameter (e.g. p(i)) even though the GamsSet i does not contain the label (yet). The user can trigger an explicit check of the referential integrity by calling the GamsDatabase.check_domains (or GamsSymbol.check_domains) method. The Object- oriented API provides methods to access the records that violate the referential integrity (see GamsDatabaseDomainViolation for details). Domain checking is implicitly done when the GamsDatabase is exported to a GDX file via the GamsDatabase.export method or for databases provided in the GamsJob.run method. The implicit domain check can be suppressed (and left to GAMS when importing data) via the GamsDatabase.suppress_auto_domain_checking property. This example demonstrates how to trigger domain checking and how to access the records that violate the referential integrity.

Definition in file domain_checking.py.