alias Namespace Reference

Functions

def gdxdump2 ()
 
def gdxdump1 ()
 
def get_data_text ()
 
def same_gdx_dump (ws, gdxfile, expected_result)
 
def my_assert (test, msg)
 
def check_alias_logic (prefix, alias_db)
 

Variables

 ws = GamsWorkspace(system_directory = sys.argv[1])
 
 j1 = ws.add_job_from_string(get_data_text())
 
 db = ws.add_database(source_database= j1.out_db)
 
 db2 = ws.add_database()
 
 ii = db2.add_set_dc(db["ii"].name, ["*"], db["ii"].text)
 
 aa_orig = db["aa"]
 
 aa = db2.add_parameter_dc(db["aa"].name, [ii], db["aa"].text, )
 

Function Documentation

◆ check_alias_logic()

def alias.check_alias_logic (   prefix,
  alias_db 
)

Definition at line 107 of file alias.py.

107def check_alias_logic(prefix, alias_db):
108  # Check number of symbols
109  my_assert(len(alias_db) == 5, prefix + "alias_db should have NrSymbols=5: i,j,ij,a,aa.")
110 
111  cnt_symbols = 0
112  for sym in alias_db:
113  cnt_symbols += 1
114  my_assert(cnt_symbols == 5, prefix + "'for sym in alias_db' should result in 5 symbols: i,j,ij,a,aa.")
115 
116  # See if we can retrieve alias sets
117  my_assert(alias_db["ii"].name == "i", prefix + "We should get set i when asking for alias ii.")
118  my_assert(alias_db["jj"].name == "j", prefix + "We should get set j when asking for alias jj.")
119  my_assert(alias_db["iijj"].name == "ij", prefix + "We should get set ij when asking for alias iijj.")
120 
121  # Check domain logic
122  my_assert(alias_db.check_domains() == True, prefix + "Check domains should be true")
123  my_assert(type(alias_db["aa"].domains[0]) is GamsSet, prefix + "domain[0] of aa should be set")
124  my_assert((alias_db["aa"].domains[0]).name == "i", prefix + "domain[0] of aa should point to i")
125 
126  alias_db["ii"].delete_record("i1")
127  my_assert(alias_db.check_domains() == False, prefix + "Check domains should be false after removal of i1")
128  alias_db["ii"].add_record("i1")
129  my_assert(alias_db.check_domains() == True, prefix + "Check domains should be true after adding i1 again")
130 
131 

References my_assert().

◆ gdxdump1()

def alias.gdxdump1 ( )

Definition at line 41 of file alias.py.

◆ gdxdump2()

def alias.gdxdump2 ( )

Definition at line 22 of file alias.py.

◆ get_data_text()

def alias.get_data_text ( )

Definition at line 81 of file alias.py.

◆ my_assert()

def alias.my_assert (   test,
  msg 
)

Definition at line 102 of file alias.py.

Referenced by check_alias_logic().

◆ same_gdx_dump()

def alias.same_gdx_dump (   ws,
  gdxfile,
  expected_result 
)

Definition at line 92 of file alias.py.

Variable Documentation

◆ aa

alias.aa = db2.add_parameter_dc(db["aa"].name, [ii], db["aa"].text, )

Definition at line 159 of file alias.py.

◆ aa_orig

alias.aa_orig = db["aa"]

Definition at line 157 of file alias.py.

◆ db

alias.db = ws.add_database(source_database= j1.out_db)

Definition at line 148 of file alias.py.

◆ db2

alias.db2 = ws.add_database()

Definition at line 153 of file alias.py.

◆ ii

alias.ii = db2.add_set_dc(db["ii"].name, ["*"], db["ii"].text)

Definition at line 154 of file alias.py.

◆ j1

alias.j1 = ws.add_job_from_string(get_data_text())

Definition at line 141 of file alias.py.

◆ ws

alias.ws = GamsWorkspace(system_directory = sys.argv[1])

Definition at line 135 of file alias.py.

def check_alias_logic(prefix, alias_db)
Definition: alias.py:107
def my_assert(test, msg)
Definition: alias.py:102