|
Execution errors during model generation |
Top Previous Next |
|
Execution errors may arise when GAMS is generating the model before passing it to the solver. These again can be arithmetic errors or can also be model structure errors. Such model structure errors arise because some equations are improperly set up i.e. being inherently infeasible or the wrong solver is being used. Discovery of such execution errors is sometimes very straightforward but can at other times be fairly involved. An error in the middle of a multi-dimensional equation block and/or in a multi-dimensional equation term within a block can be difficult to find. The most practical way of finding such errors is to use the Limcol/Limrow option commands. Consider the example executmd.gms
sets elems /s1*s25/ parameter data1(elems) data to be exponentiated datadiv(elems) divisors datamult(elems) x limits; data1(elems)=1; data1("s20")=-1; datadiv(elems)=1; datadiv("s21")=0; datamult(elems)=1; datamult("s22")=0; positive variables x(elems) variables variables obj; equations objr objective with bad exponentiation xlim(elems) constraints with bad divisor; objr.. obj=e=sum(elems,data1(elems)**2.1*x(elems)); xlim(elems).. datamult(elems)/datadiv(elems)*x(elems)=e=1; model executerr /all/ option limrow=30; option limcol=30; solve executerr using lp maximizing obj;
In this example, we will have execution errors arise during model generation because of arithmetic problems. Namely
When we run GAMS, we see the execution error messages as follows:
--- Generating model EXECUTERR --- EXECUTMD.GMS(16) 134 Kb *** ExecError 10 at Line 16 ILLEGAL ARGUMENTS IN ** OPERATION --- EXECUTMD.GMS(17) 134 Kb 1 Errors *** ExecError 0 at Line 17 DIVISION BY ZERO *** ExecError 28 at Line 17 EQUATION INFEASIBLE DUE TO RHS VALUE --- EXECUTMD.GMS(20) 134 Kb 3 Errors *** SOLVE aborted *** Status: Execution error(s)
The Limrow section of the LST file reveals
**** EXECUTION ERROR 10 AT LINE 16 .. ILLEGAL ARGUMENTS IN ** OPERATION ---- OBJR =E= objective with bad exponentiation OBJR.. - X(s1) - X(s2) - X(s3) - X(s4) - X(s5) - X(s6) - X(s7) - X(s8) - X(s9) - X(s10) - X(s11) - X(s12) - X(s13) - X(s14) - X(s15) - X(s16) - X(s17) - X(s18) - X(s19) + UNDF*X(s20) - X(s21) - X(s22) - X(s23) - X(s24) - X(s25) + OBJ =E= UNDF ; (LHS = UNDF, INFES = UNDF ***)
**** EXECUTION ERROR 0 AT LINE 17 .. DIVISION BY ZERO **** EXECUTION ERROR 28 AT LINE 17 .. EQUATION INFEASIBLE DUE TO RHS VALUE
**** INFEASIBLE EQUATIONS ... ---- XLIM =E= constraints with bad divisor XLIM(s22).. 0 =E= 1 ; (LHS = 0, INFES = 1 ***)
This does not display the equation limrow listing for the divide by zero error. To get it you have to fix the infeasibility and run again. Then you get
XLIM(s21).. UNDF*X(s21) =E= UNDF ; (LHS = UNDF, INFES = UNDF ***)
Regardless the Limrow display shows the exact elements within the model where the problems have arisen and one may then investigate. Such an investigation may involve displays of the input data used within the equation calculations so one can investigate the numerical properties of specific elements associated with problems. Often even more displays will be involved where one traces faulty input data back through the program investigating places where these data have been calculated to eventually see why these data have taken on the specific numerical values they have. |