$title 'Test for embedded code facility' (EMBGMS01,SEQ=925) $onText Test functionality of the GAMS embedded code facility for GAMS during compilation time Contributor: Michael Bussieck, January 2023 $offText Set i / i1 text for i1 i2 text for i2 / iout(i) j / j1*j3 / ij(i,j) / #i.#j / i_want(i) / i1, i2 / i_want_ex(i) / i1 text 1, i2 text 2 / ij_want(i,j) / i1.j1, i1.j2 / ij_want_merge(i,j) / i1.j1, i1.j2, i1.j3 / ij_want_ex(i,j) / i1.j1 text 1, i1.j2 text 2/; Scalar p0 /0.14/ p0_want / 0.14 /; Parameter p1(i) / #i 1.14 / p2(i,j) / #i.#j 2.14 / p1_want(i) / #i 1.14 / p2_want(i,j) / i1.j1 2.14, i1.j2 2.14 / p2_want_merge(i,j) / i1.j1 2.14, i1.j2 2.14, i1.j3 2.14 /; Variable v0 / fx 0.14 / v1(i) / #i.fx 1.14 / v2(i,j) / #i.#j.fx 2.14 / v0_want / l 0.14, m 0, lo 0, up 10, scale 1 / v1_want(i) / i1.(l 1.14, m 0, lo 0, up 10, scale 1), i2.(l 1.14, m 0, lo 0, up 10, scale 1) / v2_want(i,j) / i1.j1.(l 2.14, m 0, lo 0, up 10, scale 1), i1.j2.(l 2.14, m 0, lo 0, up 10, scale 1) / v2_want_merge(i,j) / i1.j1.(l 2.14, m 0, lo 0, up 10, scale 1), i1.j2.(l 2.14, m 0, lo 0, up 10, scale 1), i1.j3.(l 2.14, m 0, lo 0, up 10, scale 1) /; equation e0 / fx 0.14 / e1(i) / #i.fx 1.14 / e2(i,j) / #i.#j.fx 2.14 / e0_want / l 0.14, m 0, lo 0, up 10, scale 1 / e1_want(i) / i1.(l 1.14, m 0, lo 0, up 10, scale 1), i2.(l 1.14, m 0, lo 0, up 10, scale 1) / e2_want(i,j) / i1.j1.(l 2.14, m 0, lo 0, up 10, scale 1), i1.j2.(l 2.14, m 0, lo 0, up 10, scale 1) / e2_want_merge(i,j) / i1.j1.(l 2.14, m 0, lo 0, up 10, scale 1), i1.j2.(l 2.14, m 0, lo 0, up 10, scale 1), i1.j3.(l 2.14, m 0, lo 0, up 10, scale 1) /; $call rm -f embgms01_log.txt $onEchoV > checkData $gdxOut have.gdx $unLoad %1 $gdxOut $call gdxdiff wanted.gdx have.gdx >> embgms01_log.txt $if errorlevel 1 $abort %2 $offEcho $save embgms01 *** Test default list behavior *** *Test 1.1: Test default list behavior of scalars $onEmbeddedCode GAMS: r=embgms01 abort$(p0<>0.14) "p0 bad"; $offEmbeddedCode *Test 1.2: Test default list behavior of one dimensional parameters $onEmbeddedCode GAMS: r=embgms01 loop(i, abort$(p1(i)<>1.14) 'p1 bad'); $offEmbeddedCode *Test 1.3: Test default list behavior of multi dimensional parameters $onEmbeddedCode GAMS: r=embgms01 loop((i,j), abort$(p2(i,j)<>2.14) 'p2 bad'); $offEmbeddedCode *Test 1.4: Test default list behavior of one dimensional sets $onEmbeddedCode GAMS: r=embgms01 set ix(i) / i1*i2 /, diff(i); diff(i) = i(i) xor ix(i); abort$(card(diff)) 'i1 bad', diff; $offEmbeddedCode *Test 1.5: Test default list behavior of multi dimensional sets $onEmbeddedCode GAMS: r=embgms01 set ijx(i,j) / #i.#j /, diff(i,j); diff(i,j) = ij(i,j) xor ijx(i,j); abort$(card(diff)) 'ij bad', diff; $offEmbeddedCode *Test 1.6: Test default list behavior of scalar variables $onEmbeddedCode GAMS: r=embgms01 abort$(v0.l <>0.14) 'bad v0.l'; abort$(v0.m <>0.00) 'bad v0.m'; abort$(v0.lo <>0.14) 'bad v0.lo'; abort$(v0.up <>0.14) 'bad v0.up'; abort$(v0.scale<>1.00) 'bad v0.scale'; $offEmbeddedCode *Test 1.7: Test default list behavior of one dimensional variables $onEmbeddedCode GAMS: r=embgms01 loop(i, abort$(v1.l (i)<>1.14) 'bad v1.l'; abort$(v1.m (i)<>0.00) 'bad v1.m'; abort$(v1.lo (i)<>1.14) 'bad v1.lo'; abort$(v1.up (i)<>1.14) 'bad v1.up'; abort$(v1.scale(i)<>1.00) 'bad v1.scale'; ); $offEmbeddedCode *Test 1.8: Test default list behavior of multi dimensional variables $onEmbeddedCode GAMS: r=embgms01 loop((i,j), abort$(v2.l (i,j)<>2.14) 'bad v2.l'; abort$(v2.m (i,j)<>0.00) 'bad v2.m'; abort$(v2.lo (i,j)<>2.14) 'bad v2.lo'; abort$(v2.up (i,j)<>2.14) 'bad v2.up'; abort$(v2.scale(i,j)<>1.00) 'bad v2.scale'; ); $offEmbeddedCode *Test 1.9: Test default list behavior of scalar equations $onEmbeddedCode GAMS: r=embgms01 abort$(e0.l <>0.14) 'bad e0.l'; abort$(e0.m <>0.00) 'bad e0.m'; abort$(e0.lo <>0.14) 'bad e0.lo'; abort$(e0.up <>0.14) 'bad e0.up'; abort$(e0.scale<>1.00) 'bad e0.scale'; $offEmbeddedCode *Test 1.10: Test default list behavior of one dimensional equations $onEmbeddedCode GAMS: r=embgms01 loop(i, abort$(e1.l (i)<>1.14) 'bad e1.l'; abort$(e1.m (i)<>0.00) 'bad e1.m'; abort$(e1.lo (i)<>1.14) 'bad e1.lo'; abort$(e1.up (i)<>1.14) 'bad e1.up'; abort$(e1.scale(i)<>1.00) 'bad e1.scale'; ); $offEmbeddedCode *Test 1.11: Test default list behavior of multi dimensional equations $onEmbeddedCode GAMS: r=embgms01 loop((i,j), abort$(e2.l (i,j)<>2.14) 'bad e2.l'; abort$(e2.m (i,j)<>0.00) 'bad e2.m'; abort$(e2.lo (i,j)<>2.14) 'bad e2.lo'; abort$(e2.up (i,j)<>2.14) 'bad e2.up'; abort$(e2.scale(i,j)<>1.00) 'bad e2.scale'; ); $offEmbeddedCode *** Test writing symbol data using labels *** $onMultiR *Test 4.1: Test writing of scalars $gdxOut wanted.gdx $unLoad p0_want=p0 $gdxOut $clear p0 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 p0 = 0.14; $offEmbeddedCode p0 $batInclude checkData p0 'Test 4.1 failed in GAMS' *Test 4.2: Test writing of one dimensional parameters $gdxOut wanted.gdx $unLoad p1_want=p1 $gdxOut $clear p1 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 p1(i) = 1.14; $offEmbeddedCode p1 $batInclude checkData p1 'Test 4.2 failed in GAMS' *Test 4.3: Test writing of multi dimensional parameters $gdxOut wanted.gdx $unLoad p2_want=p2 $gdxOut $clear p2 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 p2('i1', 'j1') = 2.14; p2('i1', 'j2') = 2.14; $offEmbeddedCode p2 $batInclude checkData p2 'Test 4.3 failed in GAMS' *Test 4.4: Test writing of one dimensional sets $gdxOut wanted.gdx $unLoad i_want=iout $gdxOut $clear iout $save embgms01 $onEmbeddedCode GAMS: r=embgms01 iout(i) = yes; $offEmbeddedCode iout $batInclude checkData iout 'Test 4.4a failed in GAMS' $gdxOut wanted.gdx $unLoad i_want_ex=iout $gdxOut $clear iout $onEmbeddedCode GAMS: r=embgms01 $ onMultiR set iout / 'i1' "text 1", 'i2' "text 2" /; $offEmbeddedCode iout $batInclude checkData iout 'Test 4.4b failed in GAMS' *Test 4.5: Test writing of multi dimensional sets $gdxOut wanted.gdx $unLoad ij_want=ij $gdxOut $clear ij $save embgms01 $onEmbeddedCode GAMS: r=embgms01 ij('i1', 'j1') = yes; ij('i1', 'j2') = yes; $offEmbeddedCode ij $batInclude checkData ij 'Test 4.5a failed in GAMS' $gdxOut wanted.gdx $unLoad ij_want_ex=ij $gdxOut $clear ij $onEmbeddedCode GAMS: r=embgms01 $ onMultiR set ij / 'i1'.'j1' "text 1", 'i1'.'j2' "text 2" /; $offEmbeddedCode ij $batInclude checkData ij 'Test 4.5b failed in GAMS' *Test 4.6: Test writing of scalar variable $gdxOut wanted.gdx $unLoad v0_want=v0 $gdxOut $clear v0 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 v0.l = 0.14; v0.m = 0.00; v0.lo = 0.00; v0.up = 10.00; v0.scale = 1.00; $offEmbeddedCode v0 $batInclude checkData v0 'Test 4.6 failed in GAMS' *Test 4.7: Test writing of one dimensonal variables $gdxOut wanted.gdx $unLoad v1_want=v1 $gdxOut $clear v1 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 loop(i, v1.l (i) = 1.14; v1.m (i) = 0.00; v1.lo (i) = 0.00; v1.up (i) = 10.00; v1.scale(i) = 1.00; ); $offEmbeddedCode v1 $batInclude checkData v1 'Test 4.7 failed in GAMS' *Test 4.8: Test writing of multi dimensonal variables $gdxOut wanted.gdx $unLoad v2_want=v2 $gdxOut $clear v2 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 set ij2(i,j) / i1.j1, i1.j2 /; loop(ij2(i,j), v2.l (i,j) = 2.14; v2.m (i,j) = 0.00; v2.lo (i,j) = 0.00; v2.up (i,j) = 10.00; v2.scale(i,j) = 1.00; ); $offEmbeddedCode v2 $batInclude checkData v2 'Test 4.8 failed in GAMS' *Test 4.9: Test writing of scalar equations $gdxOut wanted.gdx $unLoad e0_want=e0 $gdxOut $clear e0 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 e0.l = 0.14; e0.m = 0.00; e0.lo = 0.00; e0.up = 10.00; e0.scale = 1.00; $offEmbeddedCode e0 $batInclude checkData e0 'Test 4.9 failed in GAMS' *Test 4.10: Test writing of one dimensonal equations $gdxOut wanted.gdx $unLoad e1_want=e1 $gdxOut $clear e1 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 loop(i, e1.l (i) = 1.14; e1.m (i) = 0.00; e1.lo (i) = 0.00; e1.up (i) = 10.00; e1.scale(i) = 1.00; ); $offEmbeddedCode e1 $batInclude checkData e1 'Test 4.10 failed in GAMS' *Test 4.11: Test writing of multi dimensonal equations $gdxOut wanted.gdx $unLoad e2_want=e2 $gdxOut $clear e2 $save embgms01 $onEmbeddedCode GAMS: r=embgms01 set ij2(i,j) / i1.j1, i1.j2 /; loop(ij2(i,j), e2.l (i,j) = 2.14; e2.m (i,j) = 0.00; e2.lo (i,j) = 0.00; e2.up (i,j) = 10.00; e2.scale(i,j) = 1.00; ); $offEmbeddedCode e2 $batInclude checkData e2 'Test 4.11 failed in GAMS' $offMulti *Test 5.1: Set unknown symbol dimension to 0 from EC GAMS (empty scalar) parameter p_dim0_1; $onEmbeddedCode GAMS: scalar p_dim0_1 / /; execute_unload "wanted.gdx", p_dim0_1; $offEmbeddedCode p_dim0_1 $batInclude checkData p_dim0_1 'Test 5.1 failed in GAMS' *Test 5.2: Set unknown symbol dimension to 0 from EC GAMS (scalar) parameter p_dim0_2; $onEmbeddedCode GAMS: scalar p_dim0_2 / 3.14 /; execute_unload "wanted.gdx", p_dim0_2; $offEmbeddedCode p_dim0_2 $batInclude checkData p_dim0_2 'Test 5.2 failed in GAMS' *Test 5.3: Set unknown symbol dimension to 0 from EC GAMS (scalar at execution time) parameter p_dim0_3; $onEmbeddedCode GAMS: scalar p_dim0_3; p_dim0_3 = 3.14; execute_unload "wanted.gdx" p_dim0_3; $offEmbeddedCode p_dim0_3 $batInclude checkData p_dim0_3 'Test 5.3 failed in GAMS' *Test 5.4: Set unknown symbol dimension to 1 from EC GAMS (parameter) parameter p_dim1_1; $onEmbeddedCode GAMS: parameter p_dim1_1(*) / i1 1, i2 2 /; execute_unload "wanted.gdx", p_dim1_1; $offEmbeddedCode p_dim1_1 $batInclude checkData p_dim1_1 'Test 5.4 failed in GAMS' *Test 5.5: Set unknown symbol dimension to 1 from EC GAMS (parameter at execution time) parameter p_dim1_2; $onEmbeddedCode GAMS: parameter p_dim1_2(*); p_dim1_2("i1") = 1; p_dim1_2("i2") = 2; execute_unload "wanted.gdx", p_dim1_2; $offEmbeddedCode p_dim1_2 $batInclude checkData p_dim1_2 'Test 5.5 failed in GAMS' *Test 5.6: Set unknown symbol dimension to 2 from EC GAMS (parameter) parameter p_dim2_1; $onEmbeddedCode GAMS: parameter p_dim2_1(*, *) / i1.j1 1, i1.j2 2 /; execute_unload "wanted.gdx", p_dim2_1; $offEmbeddedCode p_dim2_1 $batInclude checkData p_dim2_1 'Test 5.6 failed in GAMS' *Test 5.7: Set unknown symbol dimension to 2 from EC GAMS (parameter at execution time) parameter p_dim2_2; $onEmbeddedCode GAMS: parameter p_dim2_2(*, *); p_dim2_2("i1", "j1") = 1; p_dim2_2("i1", "j2") = 2; execute_unload "wanted.gdx", p_dim2_2; $offEmbeddedCode p_dim2_2 $batInclude checkData p_dim2_2 'Test 5.7 failed in GAMS' *Test 5.8: Set unknown symbol dimension to 1 from EC GAMS (empty set) set s_dim1_1; $onEmbeddedCode GAMS: set s_dim1_1(*) / /; execute_unload "wanted.gdx", s_dim1_1; $offEmbeddedCode s_dim1_1 $batInclude checkData s_dim1_1 'Test 5.8 failed in GAMS' *Test 5.9: Set unknown symbol dimension to 1 from EC GAMS (set) set s_dim1_2; $onEmbeddedCode GAMS: set s_dim1_2 / i1 /; execute_unload "wanted.gdx", s_dim1_2; $offEmbeddedCode s_dim1_2 $batInclude checkData s_dim1_2 'Test 5.9 failed in GAMS' *Test 5.10: Set unknown symbol dimension to 1 from EC GAMS (set at exectuion time) set s_dim1_3; $onEmbeddedCode GAMS: set s_dim1_3(*); s_dim1_3("i1") = yes; execute_unload "wanted.gdx", s_dim1_3; $offEmbeddedCode s_dim1_3 $batInclude checkData s_dim1_3 'Test 5.10 failed in GAMS' *Test 5.11: Set unknown symbol dimension to 2 from EC GAMS (empty set) set s_dim2_1; $onEmbeddedCode GAMS: set s_dim2_1(*,*) / /; execute_unload "wanted.gdx", s_dim2_1; $offEmbeddedCode s_dim2_1 $batInclude checkData s_dim2_1 'Test 5.11 failed in GAMS' *Test 5.12: Set unknown symbol dimension to 2 from EC GAMS (set) set s_dim2_2; $onEmbeddedCode GAMS: set s_dim2_2 / i1.j1 /; execute_unload "wanted.gdx", s_dim2_2; $offEmbeddedCode s_dim2_2 $batInclude checkData s_dim2_2 'Test 5.12 failed in GAMS' *Test 5.13: Set unknown symbol dimension to 2 from EC GAMS (set at execution time) set s_dim2_3; $onEmbeddedCode GAMS: set s_dim2_3(*,*); s_dim2_3("i1", "j1") = yes; execute_unload "wanted.gdx", s_dim2_3; $offEmbeddedCode s_dim2_3 $batInclude checkData s_dim2_3 'Test 5.13 failed in GAMS' *Test 5.14: Set unknown symbol dimension to 0 from EC GAMS (empty variable) variable v_dim0_1; $onEmbeddedCode GAMS: variable v_dim0_1 / /; execute_unload "wanted.gdx", v_dim0_1; $offEmbeddedCode v_dim0_1 $batInclude checkData v_dim0_1 'Test 5.14 failed in GAMS' *Test 5.15: Set unknown symbol dimension to 0 from EC GAMS (variable) variable v_dim0_2; $onEmbeddedCode GAMS: variable v_dim0_2 / l 3.14, m 0, lo 0, up 10, scale 1 /; execute_unload "wanted.gdx", v_dim0_2; $offEmbeddedCode v_dim0_2 $batInclude checkData v_dim0_2 'Test 5.15 failed in GAMS' *Test 5.16: Set unknown symbol dimension to 0 from EC GAMS (variable at execution time) variable v_dim0_3; $onEmbeddedCode GAMS: variable v_dim0_3 / l 3.14, m 0, lo 0, up 10, scale 1 /; v_dim0_3.l = 3.14; v_dim0_3.m = 0; v_dim0_3.lo = 0; v_dim0_3.up = 10; v_dim0_3.scale = 1; execute_unload "wanted.gdx", v_dim0_3; $offEmbeddedCode v_dim0_3 $batInclude checkData v_dim0_3 'Test 5.16 failed in GAMS' *Test 5.17: Set unknown symbol dimension to 1 from EC GAMS (variable) variable v_dim1_1; $onEmbeddedCode GAMS: variable v_dim1_1(*) / i1.l 3.14, i1.m 0.0, i1.lo 0.0, i1.up 10.0, i1.scale 1.0 /; execute_unload "wanted.gdx", v_dim1_1; $offEmbeddedCode v_dim1_1 $batInclude checkData v_dim1_1 'Test 5.17 failed in GAMS' *Test 5.18: Set unknown symbol dimension to 1 from EC GAMS (variable at execution time) variable v_dim1_2; $onEmbeddedCode GAMS: variable v_dim1_2(*); v_dim1_2.l("i1") = 3.14; v_dim1_2.m("i1") = 0; v_dim1_2.lo("i1") = 0; v_dim1_2.up("i1") = 10; v_dim1_2.scale("i1") = 1; execute_unload "wanted.gdx", v_dim1_2; $offEmbeddedCode v_dim1_2 $batInclude checkData v_dim1_2 'Test 5.18 failed in GAMS' *Test 5.19: Set unknown symbol dimension to 2 from EC GAMS (variable) variable v_dim2_1; $onEmbeddedCode GAMS: variable v_dim2_1(*,*) / i1.j1.l 3.14, i1.j1.m 0.0, i1.j1.lo 0.0, i1.j1.up 10.0, i1.j1.scale 1.0, i1.j2.l 4.14, i1.j2.m 0.0, i1.j2.lo 0.0, i1.j2.up 20.0, i1.j2.scale 1.0 /; execute_unload "wanted.gdx", v_dim2_1; $offEmbeddedCode v_dim2_1 $batInclude checkData v_dim2_1 'Test 5.19 failed in GAMS' *Test 5.20: Set unknown symbol dimension to 2 from EC GAMS (variable at execution time) variable v_dim2_2; $onEmbeddedCode GAMS: variable v_dim2_2(*,*); v_dim2_2.l("i1", "j1") = 3.14; v_dim2_2.m("i1", "j1") = 0; v_dim2_2.lo("i1", "j1") = 0; v_dim2_2.up("i1", "j1") = 10; v_dim2_2.scale("i1", "j1") = 1; v_dim2_2.l("i1", "j1") = 4.14; v_dim2_2.m("i1", "j1") = 0; v_dim2_2.lo("i1", "j1") = 0; v_dim2_2.up("i1", "j1") = 20; v_dim2_2.scale("i1", "j1") = 1; execute_unload "wanted.gdx", v_dim2_2; $offEmbeddedCode v_dim2_2 $batInclude checkData v_dim2_2 'Test 5.20 failed in GAMS' *Test 5.21: Set unknown symbol dimension to 0 from EC GAMS (empty equation) equation e_dim0_1; $onEmbeddedCode GAMS: equation e_dim0_1 / /; execute_unload "wanted.gdx", e_dim0_1; $offEmbeddedCode e_dim0_1 $batInclude checkData e_dim0_1 'Test 5.21 failed in GAMS' *Test 5.22: Set unknown symbol dimension to 0 from EC GAMS (equation) equation e_dim0_2; $onEmbeddedCode GAMS: equation e_dim0_2 / l 3.14, m 0, lo 0, up 10, scale 1 /; execute_unload "wanted.gdx", e_dim0_2; $offEmbeddedCode e_dim0_2 $batInclude checkData e_dim0_2 'Test 5.22 failed in GAMS' *Test 5.23: Set unknown symbol dimension to 0 from EC GAMS (equation at execution time) equation e_dim0_3; $onEmbeddedCode GAMS: equation e_dim0_3 / l 3.14, m 0, lo 0, up 10, scale 1 /; e_dim0_3.l = 3.14; e_dim0_3.m = 0; e_dim0_3.lo = 0; e_dim0_3.up = 10; e_dim0_3.scale = 1; execute_unload "wanted.gdx", e_dim0_3; $offEmbeddedCode e_dim0_3 $batInclude checkData e_dim0_3 'Test 5.23 failed in GAMS' *Test 5.24: Set unknown symbol dimension to 1 from EC GAMS (equation) equation e_dim1_1; $onEmbeddedCode GAMS: equation e_dim1_1(*) / i1.l 3.14, i1.m 0.0, i1.lo 0.0, i1.up 10.0, i1.scale 1.0 /; execute_unload "wanted.gdx", e_dim1_1; $offEmbeddedCode e_dim1_1 $batInclude checkData e_dim1_1 'Test 5.24 failed in GAMS' *Test 5.25: Set unknown symbol dimension to 1 from EC GAMS (equation at execution time) equation e_dim1_2; $onEmbeddedCode GAMS: equation e_dim1_2(*); e_dim1_2.l("i1") = 3.14; e_dim1_2.m("i1") = 0; e_dim1_2.lo("i1") = 0; e_dim1_2.up("i1") = 10; e_dim1_2.scale("i1") = 1; execute_unload "wanted.gdx", e_dim1_2; $offEmbeddedCode e_dim1_2 $batInclude checkData e_dim1_2 'Test 5.25 failed in GAMS' *Test 5.26: Set unknown symbol dimension to 2 from EC GAMS (equation) equation e_dim2_1; $onEmbeddedCode GAMS: equation e_dim2_1(*,*) / i1.j1.l 3.14, i1.j1.m 0.0, i1.j1.lo 0.0, i1.j1.up 10.0, i1.j1.scale 1.0, i1.j2.l 4.14, i1.j2.m 0.0, i1.j2.lo 0.0, i1.j2.up 20.0, i1.j2.scale 1.0 /; execute_unload "wanted.gdx", e_dim2_1; $offEmbeddedCode e_dim2_1 $batInclude checkData e_dim2_1 'Test 5.26 failed in GAMS' *Test 5.27: Set unknown symbol dimension to 2 from EC GAMS (equation at execution time) equation e_dim2_2; $onEmbeddedCode GAMS: equation e_dim2_2(*,*); e_dim2_2.l("i1", "j1") = 3.14; e_dim2_2.m("i1", "j1") = 0; e_dim2_2.lo("i1", "j1") = 0; e_dim2_2.up("i1", "j1") = 10; e_dim2_2.scale("i1", "j1") = 1; e_dim2_2.l("i1", "j1") = 4.14; e_dim2_2.m("i1", "j1") = 0; e_dim2_2.lo("i1", "j1") = 0; e_dim2_2.up("i1", "j1") = 20; e_dim2_2.scale("i1", "j1") = 1; execute_unload "wanted.gdx", e_dim2_2; $offEmbeddedCode e_dim2_2 $batInclude checkData e_dim2_2 'Test 5.27 failed in GAMS' *Test 5.28: Test setting symbol with unknown dimension and existing expl. text parameter p_text text from GAMS; $onEmbeddedCode GAMS: parameter p_text text from EC GAMS / 1 /; $offEmbeddedCode p_text $onEmbeddedCode Python: text = gams.db["p_text"].text if text != "text from GAMS": raise Exception("Unexpected expl. text for p_text") $offEmbeddedCode $if not errorfree $abort "Errors" *Test 5.29: Test error for incompatible symbol type parameter p_incomp; $onEmbeddedCode GAMS: binary variable p_incomp; p_incomp.up = 1 $offEmbeddedCode p_incomp $if errorfree $abort "Test 5.29 failes. Expect error for incompatible symbol type" $clearError *Test 5.30: Test filtered read of unknown uel $onEcho > ec5_30.gms set i(*) / i1*i2 /; parameter p(i); $onEmbeddedCode GAMS: Parameter p(*) / i0 1, i1 1 /; $offEmbeddedCode p abort$(p('i1')<>1 or p('i2')<>0) 'bad p', p; $offEcho $call.checkErrorLevel gams ec5_30.gms lo=2