Friday, June 26, 2009

Duplicate rows

I saw a model with:

Const_A5 {i in D, j in S : j!=1 }: (- 1.1) * TA[j] + TA[j-1] + 0.1 * AC[j] - 4 * W['A',j] + 0.1 * OT[j] + 2 = 0 ;

this really generates duplicate constraints: the above constraint is repeated for each i in D. A simpler example would be:

supply{k in K,i in I}: sum{j in J} x[i,j]  <=  a[i] ;

or in GAMS: 

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

Both AMPL, GLPK and GAMS just generate these duplicates without a problem.

I cannot think of a case where such construct is very useful in practice, so modeling languages should probably flag this as an error (or at least a warning).

Some really good presolvers can get rid of this, but this seems an opportunity where a modeling system can give useful feedback to an innocent user.

PS. To debug these cases GAMS has an equation and variable listing controlled by option LIMROW and LIMCOL. Ampl has an `expand’ command to show what is generated. With Glpsol it is often useful to generate a Cplex LP file to see what is generated.

No comments:

Post a Comment