# Functions of GAMSCHK and Examples – Bruce McCarl
**Source**: https://agecoresearch.tamu.edu/mccarl/gams-related-information/functions-of-gamschk-and-examples/
**Parent**: https://agecoresearch.tamu.edu/mccarl/
- Display the structure of user selected equations and/or variables [example](https://agecon2.tamu.edu/people/faculty/mccarl-bruce/gamschk2.htm#displaycr)
- List the characteristics of selected groups of variables and equations [example](#matchit)
- List the characteristics of equation and variable blocks [example](#blocklist)
- Examine a GAMS model to see whether any variables and equations contain specification errors [example](#analysis)
- Generate a schematic of the structure of the variable and equation blocks [example](#bpicagg)
- Examine the number of coeficients in the intersections of variable and equation blocks [ex](https://agecon2.tamu.edu/people/faculty/mccarl-bruce/gamschk2.htm#bpiccount)[a](#bpiccount)[mple](https://agecon2.tamu.edu/people/faculty/mccarl-bruce/gamschk2.htm#bpiccount)
- Look at the scaling characteristics of the variable and equation blocks [example](#bpicscale)
- Generate a schematic for small GAMS models or portions of larger models depicting the location of coefficients by sign and magnitude [example](#picture)
- Reconstruct the reduced cost of variables after a model solution [example](#postoptx)
- Reconstruct the activity within equations after a model solution [example](#postopteq)
- Find variables or equations which could be causing unbounded or infeasible models [example](#nonopt)
\
[Top of Document](#top)\
Ask for a display of a variable or equation and you receive\
\
—-## VAR MAKECHAIR\
## MAKECHAIR(PLANT2,FUNCTIONAL,NORMAL)
| | |
| --- | --- |
| OBJT | 15.000 |
| RESOURCEQ(PLANT2,SMLLATHE) | 0.80000 |
| RESOURCEQ(PLANT2,LRGLATHE) | 0.50000 |
| TRNCHAIREQ(PLANT2,FUNCTIONAL) | -1.0000 |
| UPPER BOUND | 5000.0 |
| or |
| —-## EQU LINKTABLE |
| ## LINKTABLE(FANCY) |
| MAKETABLE(PLANT1,FANCY) | -1.0000 |
| TRANSPORT(PLANT3,TABLES,FANCY) | -1.0000 |
| SELL(PLANT1,DINSETS,FANCY) | 1.0000 |
| =L= | 0.00000E+00 |
[Top of Document](#top)\
\
Ask about the characteristics of selected variables and equations and you get\
\
\
| | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- |
| | Is | Tot | Pos | Neg | Nln | Minimum | Maximum |
| —-### Requested Variables | Non | Cof | Cof | Cof | Cof | Absolute | Absolute |
| SELL(PLANT1,TABLES, | 0 | 2 | 1 | 1 | 0 | 1.000 | 1.000 |
| FUNCTIONAL) |
| | Is | Tot | Pos | Neg | Nln | Minimum | Maximum |
| —-### Requested Equations | Non | Cof | Cof | Cof | Cof | Absolute | Absolute |
| RESOURCEQ(PLANT1,LABOR) | 0 | 3 | 3 | 0 | 0 | 1.000 | 5.000 |
[Top of Document](#top)\
\
Request a report of the characteristics of equation and variable blocks and you get\
\
| | | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Variable | Sign | Numb | Numb | Pos | Neg | Non | Maximum | Minimum |
| Block | Res | Vars | Nonl | Coef | Coef | Coef | Absolute | Absolute |
| MAKECHAIR | >=0 | 12 | 0 | 60 | 12 | 0 | 1.700 | .2000 |
| MAKETABLE | >=0 | 6 | 0 | 16 | 4 | 0 | 5.000 | 1.000 |
| | | | | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Equation | Type | Numb | Numb | Pos | Neg | Non | Pos | Neg | Maximum | Minimum |
| Block | Res | Eqns | Nonl | Coef | Coef | Coef | RHS | RHS | Absolute | Absolute |
| OBJT | =E= | 1 | 0 | 23 | 10 | 0 | 0 | 0 | 1100. | 5.000 |
| RESOURCEQ | =L= | 12 | 0 | 60 | 0 | 0 | 11 | 0 | 5.000 | .2000 |
[Top of Document](#top)\
\
Examine a GAMS model to see whether any variables and equations contain specification errors and you get messages like the following\
\
—-### Analysis of Variables ( nonlinear terms at current point)\
\
\*\*\*\* Warning These variables will equal zero because they have a zero lower bound an undesirable object function coefficient all 0 or – coefficients in the =G= rows all 0 or + coefficients in the =L= rows and no coefficients in the =E= rows\
\
## MAKETABLE(PLANT2,FUNCTIONAL)\
MAKETABLE(PLANT2,FANCY)\
\
—-### Analysis of Equations ( nonlinear terms at current point)\
\
\*\*\*\* Warning This =L= constraint causes all variables in it to have a zero solution value since the nonnegative variables present have only 0 or + coefficients the nonpositive variables present have only 0 or – coefficients the unrestricted variables have only zero coefficients and the rhs is zero.\
\
## RESOURCEQ(PLANT2,TOP)\
\
[Top of Document](#top)\
\
You can generate a schematic of the structure of the variable and equation blocks and you get something like\
\
| | | | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| | | | M | M | T | | N | | | | |
| | | | A | A | R | | E | | | | |
| | | | K | K | A | | T | | | | |
| | | | E | E | N | | I | | | | |
| | | | C | T | S | | N | | | | |
| | | | H | A | P | S | C | | | | |
| | | | A | B | O | E | O | | | | R |
| | | | I | L | R | L | M | | | | H |
| | | | R | E | T | L | E | | | | S |
| OBJT | | | + | + | + | – | + | | | E | 0 |
| RESOURCEQ | | | + | + | | | | | | L | + |
| LINKTABLE | | | | – | – | + | | | | L | 0 |
| LINKCHAIR | | | | | – | + | | | | L | 0 |
| TRNCHAIREQ | | | – | | + | + | | | | L | 0 |
| TRNTABLEEQ | | | | – | + | + | | | | L | 0 | |
| Variable Typ | | | + | + | + | + | u | | | |
[Top of Document](#top)\
\
Ask for a block picture and you can examine the number of coefficients in the intersections of variable and equation blocks
| | | | | | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| | | | | | | | | | | | | C | # |
| | | | M | M | T | | N | | | | | o | |
| | | | A | A | R | | E | | | | | e | o |
| | | | K | K | A | | T | | | | | f | f |
| | | | E | E | N | | I | | | | | f | |
| | | | C | T | S | | N | | | | | | |
| | | | H | A | P | S | C | | | | | C | E |
| | | | A | B | O | E | O | | | | R | n | q |
| | | | I | L | R | L | M | | | | H | t | n |
| | | | R | E | T | L | E | | | | S | s | s |
| | | | — | — | — | — | — | | | — | — | — | — |
| OBJT | | | 12+ | 4+ | 6+ | | 1+ | | | E | 0 | 23+ | 1 |
| | | | | | | 10- | | | | | | 10- |
| RESOURCEQ | | | 48+ | 12+ | | | | | | L | 11+ | 60+ | 12 |
| | | | | | | | | | | | | |
| LINKTABLE | | | | | | 4+ | | | | L | 0 | 4+ | 2 |
| | | | | 2- | 2- | | | | | | | | 4- |
| LINKCHAIR | | | | | | 2+ | | | | L | 0 | 2+ | 2 |
| | | | | | 4- | | | | | | | | 4- |
| TRNCHAIREQ | | | | | 4+ | 4+ | | | | L | 0 | 8+ | 4 |
| | | | 12- | | | | | | | | | | 12- |
| TRNTABLEEQ | | | | | 2+ | 2+ | | | | L | 0 | 4+ | 2 |
| | | | | 2- | | | | | | | | | 2- |
| | | | — | — | — | — | — | | | — | — | — | — |
| Coeff Cnts | | | 60+ | 16+ | 12+ | 12+ | 1+ | | | | 11+ | 101+ |
| | | | 12- | 4- | 6- | 10- | | | | | 32- |
| # of Vars | | | 12 | 6 | 6 | 10 | 1 | | |
| Variable Typ | | | >=0 | >=0 | >=0 | >=0 | <0> |
[Top of Document](#top)\
\
Ask for a block picture and you can look at the scaling characteristics of the variable and equation blocks
| | | | | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| | | | | | | | | | | | R | E |
| | | | | M | M | T | | N | | | H | q |
| | | | | A | A | R | | E | | | S | u |
| | | | | K | K | A | | T | | | | |
| | | | | E | E | N | | I | | | M | M |
| | | | | C | T | S | | N | | | a | a |
| | | | | H | A | P | S | C | | | x | x |
| | | | | A | B | O | E | O | | | M | M |
| | | | | I | L | R | L | M | | | i | i |
| | | | | R | E | T | L | E | | | n | n |
| | | | | — | — | — | — | — | | | — | — |
| OBJT | Max | | | 26.6 | 100 | 20 | 1100 | 1 | | | 0 | 1100 |
| | Min | | | 15 | 80 | 5 | 82 | 1 | | | 0 | 1 |
| RESOURCEQ | Max | | | 1.7 | 5 | 0 | 0 | 0 | | | 210 | 5 |
| | Min | | | 0.2 | 1 | 0 | 0 | 0 | | | 40 | 0.2 |
| LINKTABLE | Max | | | 0 | 1 | 1 | 1 | 0 | | | 0 | 1 |
| | Min | | | 0 | 1 | 1 | 1 | 0 | | | 0 | 1 |
| LINKCHAIR | Max | | | 0 | 0 | 1 | 6 | 0 | | | 0 | 6 |
| | Min | | | 0 | 0 | 1 | 4 | 0 | | | 0 | 1 |
| TRNCHAIREQ | Max | | | 1 | 0 | 1 | 1 | 0 | | | 0 | 1 |
| | Min | | | 1 | 0 | 1 | 1 | 0 | | | 0 | 1 |
| TRNTABLEEQ | Max | | | 0 | 1 | 1 | 1 | 0 | | | 0 | 1 |
| | Min | | | 0 | 1 | 1 | 1 | 0 | | | 0 | 1 |
| | | | | — | — | — | — | — | | | — | — |
| Total Var | Max | | | 26.6 | 100 | 20 | 1100 | 1 | | | 210 |
| | Min | | | 0.2 | 1 | 1 | 1 | 1 | | | 40 |
[Top of Document](#top)\
\
You can generate a schematic for small GAMS models or portions of larger models depicting the location of coefficients by sign and magnitude as follows
| | | | | | | | | | |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| | | | | | | | | | R | |
| | | | T | T | T | T | T | T | H | |
| | | | R | R | R | R | R | R | S | P | | N |
| | | | A | A | A | A | A | A | | O | | E | | R |
| | | | N | N | N | N | N | N | C | S | | G | | O |
| | | | S | S | S | S | S | S | O | I | A | A | A | W |
| | | | P | P | P | P | P | P | E | T | I | T | I | C |
| | | | O | O | O | O | O | O | F | I | J | I | J | N |
| | | | R | R | R | R | R | R | F | V | | V | | T |
| | | | T | T | T | T | T | T | S | E | S | E | S | S |
| | | | |
| | | | 1 | 2 | 3 | 4 | 5 | 6 |
| ———— |
| OBJT 1 | | | D | E | E | D | D | 6 | = 0 | | 11 | | 1 | | 12 |
| LINKTABLE 1 | | | | | 3 | | | | <0 | | 0 | | 1 | | 1 |
| LINKTABLE 2 | | | | | | 3 | | | <0 | | 0 | | 1 | | 1 |
| LINKCHAIR 1 | | | 3 | | | | 3 | | <0 | | 0 | | 2 | | 2 |
| LINKCHAIR 2 | | | | 3 | | | | 3 | <0 | | 0 | | 2 | | 2 |
| TRNCHAIREQ 1 | | | C | | | | | | <0 | | 1 | | | | 1 |
| ———— |
| LOWER BND | | | 0 | 0 | 0 | 0 | 0 | 0 |
| UPPER BND | | | + | + | + | + | + | + |
| ———— |
| POSITIVE | | | 3 | 0 | 3 | 0 | 3 | 0 |
| COLUMN CTS | | | 0 | 3 | 0 | 3 | 0 | 2 |
| NEGATIVE | | | 1 | 0 | 1 | 0 | 1 | 0 |
| COLUMN CTS | | | 0 | 1 | 0 | 1 | 0 | 2 |
[Top of Document](#top)\
\
Ask to reconstruct the reduced costs after a model solution and you get\
\
| |
| --- |
| —-### BUDGETING VARIABLES |
| |
| —-## VAR MAKECHAIR |
| ## MAKECHAIR(PLANT2,FANCY,NORMAL) |
| SOLUTION VALUE | 73.0195 |
| UPPER BOUND | 5000.00 |
| EQN | Aij | Ui | Aij\*Ui |
| OBJT | 25.000 | 1.0000 | 25.000 |
| RESOURCEQ(PLANT2,SMLLATHE) | 1.2000 | 47.770 | 57.324 |
| RESOURCEQ(PLANT2,LRGLATHE) | .70000 | 38.830 | 27.181 |
| RESOURCEQ(PLANT2,LABOR) | .80000 | 19.369 | 15.495 |
| TRNCHAIREQ(PLANT2,FANCY) | -1.0000 | 125.00 | -125.00 |
| TRUE REDUCED COST | | | .00000E+00 |
[Top of Document](#top)\
\
Ask to reconstruct the activity within equations after a model solution and you get\
\
| |
| --- |
| —-### ROW SUMMING EQUATIONS |
| —-## EQU RESOURCEQ |
| ## RESOURCEQ(PLANT2,SMLLATHE) |
| VAR | Aij | Xj | Aij\*Xj |
| MAKECHAIR(PLANT2,FUNCTIONAL, | .80000 | 62.233 | 49.787 |
| NORMAL) |
| MAKECHAIR(PLANT2,FANCY,NORMAL) | 1.2000 | 73.020 | 87.623 |
| MAKECHAIR(PLANT2,FANCY,MAXLRG) | .50000 | 5.1798 | 2.5899 |
| =L= | | | =L= |
| RHS COEFF | | | 140.00 |
| |
| SLACK EQUALS | | | .00000E+00 |
| SHADOW PRICE | | | 47.770 |
[Top of Document](#top)\
\
Ask the program to find variables or equations which could be causing unbounded or infeasible models and you get\
\
—-### THESE VARIABLES ARE POTENTIALLY UNBOUNDED\
\
To find the cause of unboundedness bound them or the objective function variable at a large value. Then solve and manually or through GAMSCHK find large levels for variables in solution\
\
SELL(PLANT1,TABLES,FUNCTIONAL)\
\
\
—-### THESE EQUATIONS ARE POTENTIALLY INFEASIBLE\
\
RESOUREQ(PLANT1,LABOR)\
\
[Top of Document](#top)\