dmpsym01.gms : Test dmpSym and dmpUserSym feature

Description

This test verifies that the symbol dump printed to the output file
using $debug/option dmpSym (and its variants $debug/option dmpUserSym)
works as expected.
If more internal symbols get added, this test will be adjusted in future.

Contributor: Lutz Westermann, November 2020


Small Model of Type : GAMS


Category : GAMS Test library


Main file : dmpsym01.gms

$title Test dmpSym and dmpUserSym feature (dmpSym01,SEQ=839)

$onText
This test verifies that the symbol dump printed to the output file
using $debug/option dmpSym (and its variants $debug/option dmpUserSym)
works as expected.
If more internal symbols get added, this test will be adjusted in future.

Contributor: Lutz Westermann, November 2020
$offText


$onEcho > t.gms
Set
   i 'canning plants' / seattle,  san-diego /
   j 'markets'        / new-york, chicago, topeka /;

Parameter
   a(i) 'capacity of plant i in cases'
        / seattle    350
          san-diego  600 /

   b(j) 'demand at market j in cases'
        / new-york   325
          chicago    300
          topeka     275 /;

$debug dmpUserSym

Table d(i,j) 'distance in thousands of miles'
              new-york  chicago  topeka
   seattle         2.5      1.7     1.8
   san-diego       2.5      1.8     1.4;

$debug dmpSym


$onExternalInput
Scalar f 'freight in dollars per case per thousand miles' / 90 /;
$offExternalInput

option dmpUserSym;

Parameter c(i,j) 'transport cost in thousands of dollars per case';
c(i,j) = f*d(i,j)/1000;


Variable
   x(i,j) 'shipment quantities in cases'
   z      'total transportation costs in thousands of dollars';

Positive Variable x;

Equation
   cost      'define objective function'
   supply(i) 'observe supply limit at plant i'
   demand(j) 'satisfy demand at market j';

cost..      z =e= sum((i,j), c(i,j)*x(i,j));

supply(i).. sum(j, x(i,j)) =l= a(i);

demand(j).. sum(i, x(i,j)) =g= b(j);

Model transport / all /;

solve transport using lp minimizing z;
option dmpSym;
$offEcho

$onEcho > tWant.txt
SYMBOL TABLE DUMP (USER SYMBOLS ONLY), NR ENTRIES = 4
ENTRY                               ID   TYPE DIM  LENGTH MEMORYEST DEFINED ASSIGNED DATAKNOWN
  138                                i    SET   1       2      0 MB    TRUE    FALSE      TRUE
  139                                j    SET   1       3      0 MB    TRUE    FALSE      TRUE
  140                                a  PARAM   1       2      0 MB    TRUE    FALSE      TRUE
  141                                b  PARAM   1       3      0 MB    TRUE    FALSE      TRUE
END OF SYMBOL TABLE DUMP
SYMBOL TABLE DUMP, NR ENTRIES = 142
ENTRY                               ID   TYPE DIM  DIM-OK  LENGTH MEMORYEST DEFINED ASSIGNED DATAKNOWN ACCESS SPECVAL EXTERN TABLE DOMAIN LAGLEAD
    1                           mapval  FUNCT   0
    2                             ceil  FUNCT   1
    3                            floor  FUNCT   2
    4                            round  FUNCT   3
    5                              mod  FUNCT   4
    6                            trunc  FUNCT   5
    7                             sign  FUNCT   6
    8                              min  FUNCT   7
    9                              max  FUNCT   8
   10                              sqr  FUNCT   9
   11                              exp  FUNCT  10
   12                              log  FUNCT  11
   13                            log10  FUNCT  12
   14                             sqrt  FUNCT  13
   15                              abs  FUNCT  14
   16                              cos  FUNCT  15
   17                              sin  FUNCT  16
   18                           arctan  FUNCT  17
   19                           errorf  FUNCT  18
   20                          uniform  FUNCT  19
   21                           normal  FUNCT  20
   22                            power  FUNCT  21
   23                            jdate  FUNCT  22
   24                            jtime  FUNCT  23
   25                           jstart  FUNCT  24
   26                             jnow  FUNCT  25
   27                        execerror  FUNCT  26
   28                            gyear  FUNCT  27
   29                           gmonth  FUNCT  28
   30                             gday  FUNCT  29
   31                             gdow  FUNCT  30
   32                            gleap  FUNCT  31
   33                            ghour  FUNCT  32
   34                          gminute  FUNCT  33
   35                          gsecond  FUNCT  34
   36                         execseed  FUNCT  35
   37                        timestart  FUNCT  36
   38                         timecomp  FUNCT  37
   39                         timeexec  FUNCT  38
   40                        timeclose  FUNCT  39
   41                             frac  FUNCT  40
   42                       ErrorLevel  FUNCT  41
   43                         HeapSize  FUNCT  42
   44                             Fact  FUNCT  43
   45                       UniformInt  FUNCT  44
   46                               PI  FUNCT  45
   47                             NcpF  FUNCT  46
   48                            NcpCM  FUNCT  47
   49                          Entropy  FUNCT  48
   50                          Sigmoid  FUNCT  49
   51                             log2  FUNCT  50
   52                         bool_not  FUNCT  51
   53                         bool_and  FUNCT  52
   54                          bool_or  FUNCT  53
   55                         bool_xor  FUNCT  54
   56                         bool_imp  FUNCT  55
   57                         bool_eqv  FUNCT  56
   58                           rel_eq  FUNCT  57
   59                           rel_gt  FUNCT  58
   60                           rel_ge  FUNCT  59
   61                           rel_lt  FUNCT  60
   62                           rel_le  FUNCT  61
   63                           rel_ne  FUNCT  62
   64                           IfThen  FUNCT  63
   65                           rPower  FUNCT  64
   66                            EDist  FUNCT  65
   67                              div  FUNCT  66
   68                             div0  FUNCT  67
   69                          sllog10  FUNCT  68
   70                          sqlog10  FUNCT  69
   71                            slexp  FUNCT  70
   72                            sqexp  FUNCT  71
   73                            slrec  FUNCT  72
   74                            sqrec  FUNCT  73
   75                          cvPower  FUNCT  74
   76                          vcPower  FUNCT  75
   77                         Centropy  FUNCT  76
   78                        Gmillisec  FUNCT  77
   79                     MaxExecError  FUNCT  78
   80                      TimeElapsed  FUNCT  79
   81                            Gamma  FUNCT  80
   82                         LogGamma  FUNCT  81
   83                             Beta  FUNCT  82
   84                          LogBeta  FUNCT  83
   85                         GammaReg  FUNCT  84
   86                          BetaReg  FUNCT  85
   87                             sinh  FUNCT  86
   88                             cosh  FUNCT  87
   89                             tanh  FUNCT  88
   90                       MathLastRC  FUNCT  89
   91                       MathLastEC  FUNCT  90
   92                         MathOVal  FUNCT  91
   93                        SignPower  FUNCT  92
   94                     HandleStatus  FUNCT  93
   95                         NcpVUsin  FUNCT  94
   96                         NcpVUpow  FUNCT  95
   97                         Binomial  FUNCT  96
   98                     HandleSubmit  FUNCT  97
   99                      GamsVersion  FUNCT  98
  100                     HandleDelete  FUNCT  99
  101                              tan  FUNCT 100
  102                           arccos  FUNCT 101
  103                           arcsin  FUNCT 102
  104                          arctan2  FUNCT 103
  105                            sleep  FUNCT 104
  106                         HeapFree  FUNCT 105
  107                    HandleCollect  FUNCT 106
  108                      GamsRelease  FUNCT 107
  109                             Poly  FUNCT 108
  110                    LicenseStatus  FUNCT 109
  111                     LicenseLevel  FUNCT 110
  112                        HeapLimit  FUNCT 111
  113                       RandLinear  FUNCT 112
  114                     RandTriangle  FUNCT 113
  115                       ForceError  FUNCT 114
  116                    ForceErrorCnt  FUNCT 115
  117                     RandBinomial  FUNCT 116
  118                        JobHandle  FUNCT 117
  119                        JobStatus  FUNCT 118
  120                          JobKill  FUNCT 119
  121                     JobTerminate  FUNCT 120
  122                         NumCores  FUNCT 121
  123                   EmbeddedHandle  FUNCT 122
  124                     PlatformCode  FUNCT 123
  125                            Logit  FUNCT 124
  126                           LSEMax  FUNCT 125
  127                         LSEMaxSc  FUNCT 126
  128                           LSEMin  FUNCT 127
  129                         LSEMinSc  FUNCT 128
  130                         unknown*  FUNCT 129
  131                           SameAs   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  132                             Diag   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  133                          Solvers   PRED   1   FALSE       0              TRUE    FALSE     FALSE      0
  134                     LicenseCodes   PRED   1   FALSE       0              TRUE    FALSE     FALSE      0
  135               SolverCapabilities   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  136                       SortedUels   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  137                             FILE   FILE   0   FALSE       0             FALSE    FALSE     FALSE      0

ENTRY                               ID   TYPE DIM  DIM-OK  LENGTH MEMORYEST DEFINED ASSIGNED DATAKNOWN ACCESS SPECVAL EXTERN TABLE DOMAIN LAGLEAD
  138                                i    SET   1    TRUE       2      0 MB    TRUE    FALSE      TRUE      0                        TRUE   FALSE
  139                                j    SET   1    TRUE       3      0 MB    TRUE    FALSE      TRUE      0                        TRUE   FALSE
  140                                a  PARAM   1    TRUE       2      0 MB    TRUE    FALSE      TRUE      0   FALSE        FALSE
  141                                b  PARAM   1    TRUE       3      0 MB    TRUE    FALSE      TRUE      0   FALSE        FALSE
  142                                d  PARAM   2    TRUE       6      0 MB    TRUE    FALSE      TRUE      0   FALSE         TRUE
END OF SYMBOL TABLE DUMP
SYMBOL TABLE DUMP (USER SYMBOLS ONLY), NR ENTRIES = 13
ENTRY                               ID   TYPE DIM  LENGTH MEMORYEST DEFINED ASSIGNED DATAKNOWN
  138                                i    SET   1       2      0 MB    TRUE    FALSE      TRUE
  139                                j    SET   1       3      0 MB    TRUE    FALSE      TRUE
  140                                a  PARAM   1       2      0 MB    TRUE    FALSE      TRUE
  141                                b  PARAM   1       3      0 MB    TRUE    FALSE      TRUE
  142                                d  PARAM   2       6      0 MB    TRUE    FALSE      TRUE
  143                                f  PARAM   0       1      0 MB    TRUE    FALSE      TRUE
  144                                c  PARAM   2       0      0 MB    TRUE     TRUE     FALSE
  145                                x    VAR   2       0      0 MB   FALSE     TRUE     FALSE
  146                                z    VAR   0       0      0 MB   FALSE     TRUE     FALSE
  147                             cost    EQU   0       0      0 MB   FALSE     TRUE     FALSE
  148                           supply    EQU   1       0      0 MB   FALSE     TRUE     FALSE
  149                           demand    EQU   1       0      0 MB   FALSE     TRUE     FALSE
  150                        transport  MODEL   0       3              TRUE     TRUE      TRUE
END OF SYMBOL TABLE DUMP
SYMBOL TABLE DUMP, NR ENTRIES = 150
ENTRY                               ID   TYPE DIM  DIM-OK  LENGTH MEMORYEST DEFINED ASSIGNED DATAKNOWN ACCESS SPECVAL EXTERN TABLE DOMAIN LAGLEAD
    1                           mapval  FUNCT   0
    2                             ceil  FUNCT   1
    3                            floor  FUNCT   2
    4                            round  FUNCT   3
    5                              mod  FUNCT   4
    6                            trunc  FUNCT   5
    7                             sign  FUNCT   6
    8                              min  FUNCT   7
    9                              max  FUNCT   8
   10                              sqr  FUNCT   9
   11                              exp  FUNCT  10
   12                              log  FUNCT  11
   13                            log10  FUNCT  12
   14                             sqrt  FUNCT  13
   15                              abs  FUNCT  14
   16                              cos  FUNCT  15
   17                              sin  FUNCT  16
   18                           arctan  FUNCT  17
   19                           errorf  FUNCT  18
   20                          uniform  FUNCT  19
   21                           normal  FUNCT  20
   22                            power  FUNCT  21
   23                            jdate  FUNCT  22
   24                            jtime  FUNCT  23
   25                           jstart  FUNCT  24
   26                             jnow  FUNCT  25
   27                        execerror  FUNCT  26
   28                            gyear  FUNCT  27
   29                           gmonth  FUNCT  28
   30                             gday  FUNCT  29
   31                             gdow  FUNCT  30
   32                            gleap  FUNCT  31
   33                            ghour  FUNCT  32
   34                          gminute  FUNCT  33
   35                          gsecond  FUNCT  34
   36                         execseed  FUNCT  35
   37                        timestart  FUNCT  36
   38                         timecomp  FUNCT  37
   39                         timeexec  FUNCT  38
   40                        timeclose  FUNCT  39
   41                             frac  FUNCT  40
   42                       ErrorLevel  FUNCT  41
   43                         HeapSize  FUNCT  42
   44                             Fact  FUNCT  43
   45                       UniformInt  FUNCT  44
   46                               PI  FUNCT  45
   47                             NcpF  FUNCT  46
   48                            NcpCM  FUNCT  47
   49                          Entropy  FUNCT  48
   50                          Sigmoid  FUNCT  49
   51                             log2  FUNCT  50
   52                         bool_not  FUNCT  51
   53                         bool_and  FUNCT  52
   54                          bool_or  FUNCT  53
   55                         bool_xor  FUNCT  54
   56                         bool_imp  FUNCT  55
   57                         bool_eqv  FUNCT  56
   58                           rel_eq  FUNCT  57
   59                           rel_gt  FUNCT  58
   60                           rel_ge  FUNCT  59
   61                           rel_lt  FUNCT  60
   62                           rel_le  FUNCT  61
   63                           rel_ne  FUNCT  62
   64                           IfThen  FUNCT  63
   65                           rPower  FUNCT  64
   66                            EDist  FUNCT  65
   67                              div  FUNCT  66
   68                             div0  FUNCT  67
   69                          sllog10  FUNCT  68
   70                          sqlog10  FUNCT  69
   71                            slexp  FUNCT  70
   72                            sqexp  FUNCT  71
   73                            slrec  FUNCT  72
   74                            sqrec  FUNCT  73
   75                          cvPower  FUNCT  74
   76                          vcPower  FUNCT  75
   77                         Centropy  FUNCT  76
   78                        Gmillisec  FUNCT  77
   79                     MaxExecError  FUNCT  78
   80                      TimeElapsed  FUNCT  79
   81                            Gamma  FUNCT  80
   82                         LogGamma  FUNCT  81
   83                             Beta  FUNCT  82
   84                          LogBeta  FUNCT  83
   85                         GammaReg  FUNCT  84
   86                          BetaReg  FUNCT  85
   87                             sinh  FUNCT  86
   88                             cosh  FUNCT  87
   89                             tanh  FUNCT  88
   90                       MathLastRC  FUNCT  89
   91                       MathLastEC  FUNCT  90
   92                         MathOVal  FUNCT  91
   93                        SignPower  FUNCT  92
   94                     HandleStatus  FUNCT  93
   95                         NcpVUsin  FUNCT  94
   96                         NcpVUpow  FUNCT  95
   97                         Binomial  FUNCT  96
   98                     HandleSubmit  FUNCT  97
   99                      GamsVersion  FUNCT  98
  100                     HandleDelete  FUNCT  99
  101                              tan  FUNCT 100
  102                           arccos  FUNCT 101
  103                           arcsin  FUNCT 102
  104                          arctan2  FUNCT 103
  105                            sleep  FUNCT 104
  106                         HeapFree  FUNCT 105
  107                    HandleCollect  FUNCT 106
  108                      GamsRelease  FUNCT 107
  109                             Poly  FUNCT 108
  110                    LicenseStatus  FUNCT 109
  111                     LicenseLevel  FUNCT 110
  112                        HeapLimit  FUNCT 111
  113                       RandLinear  FUNCT 112
  114                     RandTriangle  FUNCT 113
  115                       ForceError  FUNCT 114
  116                    ForceErrorCnt  FUNCT 115
  117                     RandBinomial  FUNCT 116
  118                        JobHandle  FUNCT 117
  119                        JobStatus  FUNCT 118
  120                          JobKill  FUNCT 119
  121                     JobTerminate  FUNCT 120
  122                         NumCores  FUNCT 121
  123                   EmbeddedHandle  FUNCT 122
  124                     PlatformCode  FUNCT 123
  125                            Logit  FUNCT 124
  126                           LSEMax  FUNCT 125
  127                         LSEMaxSc  FUNCT 126
  128                           LSEMin  FUNCT 127
  129                         LSEMinSc  FUNCT 128
  130                         unknown*  FUNCT 129
  131                           SameAs   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  132                             Diag   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  133                          Solvers   PRED   1   FALSE       0              TRUE    FALSE     FALSE      0
  134                     LicenseCodes   PRED   1   FALSE       0              TRUE    FALSE     FALSE      0
  135               SolverCapabilities   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  136                       SortedUels   PRED   2   FALSE       0              TRUE    FALSE     FALSE      0
  137                             FILE   FILE   0   FALSE       0             FALSE    FALSE     FALSE      0

ENTRY                               ID   TYPE DIM  DIM-OK  LENGTH MEMORYEST DEFINED ASSIGNED DATAKNOWN ACCESS SPECVAL EXTERN TABLE DOMAIN LAGLEAD
  138                                i    SET   1    TRUE       2      0 MB    TRUE    FALSE      TRUE      0                        TRUE   FALSE
  139                                j    SET   1    TRUE       3      0 MB    TRUE    FALSE      TRUE      0                        TRUE   FALSE
  140                                a  PARAM   1    TRUE       2      0 MB    TRUE    FALSE      TRUE      0   FALSE        FALSE
  141                                b  PARAM   1    TRUE       3      0 MB    TRUE    FALSE      TRUE      0   FALSE        FALSE
  142                                d  PARAM   2    TRUE       6      0 MB    TRUE    FALSE      TRUE      0   FALSE         TRUE
  143                                f  PARAM   0    TRUE       1      0 MB    TRUE    FALSE      TRUE      0   FALSE  INPUT FALSE
  144                                c  PARAM   2    TRUE       6      0 MB    TRUE     TRUE     FALSE      0   FALSE        FALSE
  145                                x    VAR   2    TRUE       6      0 MB   FALSE     TRUE     FALSE      0
  146                                z    VAR   0    TRUE       0      0 MB   FALSE     TRUE     FALSE      0
  147                             cost    EQU   0    TRUE       1      0 MB   FALSE     TRUE     FALSE      0
  148                           supply    EQU   1    TRUE       2      0 MB   FALSE     TRUE     FALSE      0
  149                           demand    EQU   1    TRUE       3      0 MB   FALSE     TRUE     FALSE      0
  150                        transport  MODEL   0    TRUE       3              TRUE     TRUE      TRUE      0
END OF SYMBOL TABLE DUMP
$offEcho

$call.checkErrorLevel gams t.gms lo=%gams.lo%
$call.checkErrorLevel awk "/SYMBOL TABLE DUMP/,/END OF SYMBOL TABLE DUMP/" t.lst | awk "sub(/ *$/, \"\")" > tHave.txt

$call.checkErrorLevel diff tHave.txt tWant.txt