embpy11.gms : Test proper domain info in Embedded Code

Description

Contributor: Michael Bussieck, September 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : embpy11.gms

$title Test proper domain info in Embedded Code (EMBPY11,SEQ=877)

$onText
Contributor: Michael Bussieck, September 2021
$offText


$log --- Using Python library %sysEnv.GMSPYTHONLIB%


Set i /i1*i2/
    j /j1*j2/;
    
Alias (i,ii), (ii,iii);

Set ij(iii,*,j,*) / #i.uni.#j.uni /;

$onEmbeddedCode Python:
pdomain = gams.db['ij'].domains
if type(pdomain[0]) != GamsSet:
   raise(Exception('pdomain[0] type should be GamsSet: ' + str(pdomain)))
if type(pdomain[2]) != GamsSet:
   raise(Exception('pdomain[2] type should be GamsSet: ' + str(pdomain)))
if [ pdomain[0].name, '*', pdomain[2].name, '*'] != [ 'i', '*', 'j', '*']:
   raise(Exception('Unexpected pdomain: ' + str([ pdomain[0].name, '*', pdomain[2].name, '*'])))

sdomain = gams.db['ij'].domains_as_strings
if sdomain != [ 'iii', '*', 'j', '*']:
   raise(Exception('Unexpected sdomain: ' + str(sdomain)))
$offEmbeddedCode