gdxxrw10.gms : GDXXRW - Testing cMerge when reading Sets with the values Option

Description

The option cMerge is tested by reading set elements and explanatory text
with merged Excel ranges. In addition, all different values specifications for
reading sets are considered.

Contributor: Jan-Erik Justkowiak, September 2018


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gdxxrw10.gms

$title GDXXRW - Testing cMerge when reading Sets with the values Option (GDXXRW10,SEQ=779)

$onText
The option cMerge is tested by reading set elements and explanatory text
with merged Excel ranges. In addition, all different values specifications for
reading sets are considered.

Contributor: Jan-Erik Justkowiak, September 2018
$offText

$callTool win32.msappavail Excel
$if errorlevel 1 $abort.noError "No Excel available"

$onEcho > howToRead.txt
cMerge=0
set=yn_0     rng=A1 cDim=1 values=yn
set=sparse_0 rng=A1 cDim=1 values=sparse
set=noData_0 rng=A1 cDim=1 values=noData
set=dense_0  rng=A1 cDim=1 values=dense

cMerge=1
set=yn_1     rng=A1 cDim=1 values=yn
set=sparse_1 rng=A1 cDim=1 values=sparse
set=noData_1 rng=A1 cDim=1 values=noData
set=dense_1  rng=A1 cDim=1 values=dense

* values noData can be skipped for cMerge=2, since the data range won't be considered
cMerge=2
set=yn_2     rng=A1 cDim=1 values=yn
set=sparse_2 rng=A1 cDim=1 values=sparse
set=dense_2  rng=A1 cDim=1 values=dense
$offEcho

$call gdxxrw cMerge_values.xlsx maxDupeErrors=37 @howToRead.txt trace=0
$ifE errorLevel<>0 $abort Error reading from spreadsheet!

* Expected results
Set
   yn_0     / a, c, e, i, k /
   yn_1     / a, c, d, e, i, k, m /
   yn_2     / a, c, d, e, f, i, k, m /
   sparse_0 / a 'Y', b 'N', c 'Y', d 'N', e 'Y', g 'N', i 'Y', j 'N', k 'Y', l 'N' /
   sparse_1 / a 'Y', b 'N', c 'Y', d 'N', e 'Y', g 'N', i 'Y', j 'N', k 'Y', l 'N', m 'Y', n 'N' /
   sparse_2 / a 'Y', b 'N', c 'Y', d 'N', e 'Y', f 'Y', g 'N', h 'N', i 'Y', j 'N', k 'Y', l 'N', m 'Y', n 'N' /
   noData_0 / a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r /
   noData_1 / a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r /
   dense_0  / a 'Y', b 'N', c 'Y', d 'N', e 'Y', f, g 'N', h, i 'Y', j 'N', k 'Y', l 'N', m, n, o, p, q, r /
   dense_1  / a 'Y', b 'N', c 'Y', d 'N', e 'Y', f, g 'N', h, i 'Y', j 'N', k 'Y', l 'N', m, n, o, p, q, r /
   dense_2  / a 'Y', b 'N', c 'Y', d 'N', e 'Y', f 'Y', g 'N', h 'N', i 'Y', j 'N', k 'Y', l 'N', m, n, o, p, q, r /;

$gdxOut controlData
$unload yn_0 yn_1 yn_2 sparse_0 sparse_1 sparse_2 noData_0 noData_1 dense_0 dense_1 dense_2
$gdxOut

$call gdxdiff cMerge_values.gdx controlData.gdx > %system.nullfile%
$ifE errorLevel<>0 $abort Data is not correct!