If you need a second i index in your equation logic use ALIAS. There were lots of other compilation errors, but this one compiles and produces an optimum solution. Not sure if this is what you had in mind. BTW, for code there a nice code section syntax.

-Michael

```
Set
i 'regions' / A, B /;
Parameter
T(i) 'transportation cost' /A 1
B 1/
lambda(i) 'fraction of labourers in region' / A 0.4
B 0.6 /;
Scalar
delta 'fraction of income spent on manufactured goods' / 0.7 /
epsilon 'substitutability' / 1.5 /;
variables
z 'total income'
y(i) 'income level'
w(i) 'wage level'
p(i) 'price level';
Positive Variable y(i),w(i),p(i);
Equation
incomeEquation(i) 'income level in region i'
wageEquation(i) 'wage level in region i'
priceEquation(i) 'prive level in region i'
GDP 'total income of economy';
alias (i,i2);
GDP.. z =e= sum(i,y(i));
incomeEquation(i).. y(i) =e= (lambda(i)*delta*w(i) + 0.5*(1-delta));
wageEquation(i).. w(i) =e=(sum(i2,y(i2)*(T(i2)**(1-epsilon))*(p(i2)**(epsilon-1))))**(1/epsilon);
priceEquation(i).. p(i) =e= (sum(i2, lambda(i2)*(w(i2)**(1-epsilon))*(T(i2)**(1-epsilon))))**(1/(1-epsilon));
Model neecge / all /;
p.lo(i) = 1e-6;
w.lo(i) = 1e-6;
y.l(i) = 1;
p.l(i) = 1;
w.l(i) = 1;
solve neecge using nlp maximizing z;
```