Search code examples
gams-math

GAMS- Domain Violation for set


I got two types of error in my GAMS code.

1- error **** 171 Domain violation for set

2- error 148, Dimension different - The symbol is referenced with more/less **** indices as declared

I don't know where I am making a mistake.

Px1 is my equation name, representing the power of x, so represent as "px"

Px(x,t,w) is defined variable

Sets:

d2 'number of extreme points in the feasible region' /d2*d2/;

coeff 'combination coefficient of the feasible region of CHP unit' /a*e/;

x ’chp units’ /x1*x1/;

t ’time periods’ /t1*t24/;

w ’scenarios’ /w1*w20/;

Px1(x,t,w).. Px(x,t,w)=e=sum((d2),Px(x,d2)*coeff(x,t,w,d2));


Solution

  • Px1(x,t,w).. Px(x,t,w)=e=sum((d2),Px(x,d2)*coeff(x,t,w,d2));
    

    You use Px here in two different ways: First, Px(x,t,w), which seems to match your declaration, but then as part of the sum as Px(x,d2), which must be wrong and seems to cause both error messages. That should probably be a different symbol?