Monday, September 1, 2008

GAMS bug in redeclaration

GAMS allows redeclarations of symbols as long as they don't cause a contradiction. I.e. the following is valid GAMS:
set i;
set i /1,2/;
set i(*);

The GAMS compiler gets confused if i is used as domain:
   1  set i;
2 parameter p(i);
3 set i /1,2/;
4 set i(*);
**** $184
**** 184 Domain list redefined

Work-around: make sure line 1 and 4 use both i or i(*).

3 comments:

  1. Hi, I'm a first year undergrad and I'm currently working on a gams problem. I have written out my code but i keep getting errors of 'symbol redefined for with a different type', 'domain list redefined' and 'domain violation for set'. Can you help me please?

    This is my code:
    Sets
    i stream1 /C2H2/
    j stream2 /CO2, O2, N2, H2O/
    k stream3 /CO2, N2/
    l stream4 /H2O/
    m stream5 /O2, N2/
    n stream6 /CH4, CO2, N2/
    o stream7 /H2O /
    p stream8 /H2 /
    q stream9 /H2O /
    r stream10 /H2O /
    s stream11 /O2 /
    t stream12 /H2O/
    u stream13 /N2/
    v stream14 /O2, N2/;

    Parameters F(i), alpha_O2(v);
    *where F is the mass flow rate and alpha is compositions of each component in the stream
    F(i)=100;
    alpha_O2(v)=0.21;


    Variables F(j),F(k),F(l), F(m),F(n),F(o),F(p),F(q),F(r),F(s),F(t(,F(u),F(v),alpha(j), alpha(k), alpha(l), alpha(m), alpha(n), alpha(v), r_11, r_22, r_33;

    ReplyDelete
  2. Contact support@gams.com for technical assistance wrt GAMS.

    ReplyDelete
  3. Thank you very much

    ReplyDelete