Using Indices in Model Set

Can I use indices in a model definition?
I’m trying to solve models with different indices, but somehow get multiple erros.

1: EQdp(i) ..       dp(i) =e= x(i,'P_gen')-P_L(i)-sum(j,(x(i,'theta')-x(j,'theta'))*B(i,j))

2: EQg(i) ..      0 =e= EQdp(i)

3: EQcost(i) ..     cost(i) =e= sum(gen,co(gen,'a')+co(gen,'b')*x(gen,'P')+co(gen,'c')*x(gen,'P')**2)+sum(l ne i,lambda(l)*EQdp(l));



4: Model Reg1 /EQg('b1')/;
5: solve Reg1 using NLP minimizing EQcost('b1');

6: Model Reg2 /EQg('b3')/;
7: solve Reg2 using NLP minimizing EQcost('b2');

8: Model Reg3 /EQg('b3')/;
9: solve Reg3 using NLP minimizing EQcost('b3');

Can anyone help me with this? What am I doing wrong?

The error messages are in the model definition and are always the same in each line:

Line2: 409  Unrecognizable item - skip to find a new statement
       looking for a ';' or a key word to get started again
Line4+6+8: 2  Identifier expected
140  Unknown symbol
182  Closing '/' missing in a set, parameter or model statement
Line5+7+9:243  Objective is not a variable
257  Solve statement not checked because of previous errors

Hi,
Mentioned GAMS error is common and self-explanatory. For example, unkown symbol - states that symbol is not defined. find the symbol and define it or check for typo error if you think it is already defined.
Use GAMS manual for removing the error.
As you have not posted complete GAMS code, it is difficult to provide you error free code.

All the best.

Yeah I managed to solve it, problem was mainly the summation.

Alias(i,j);

Wanted to do something like:

summmarize for all (l notequal i)

(Line 3)
But had to write all the summands on my own.
Do you know if there is a possibility to do so?

Yeah solved the Problem now.
Wanted to do something like:

summarize for all (l notequal i)

(Line 3)
And the vocabulary I was using wasnt right.

But didnt find a quick solution, so I had to write all the summands explicitly.
Problem solved but I#M wondering if there is a more elegant way.
Do you know if there is a quick way to do so, thanks?

You mean

https://www.gams.com/latest/docs/UG_CondExpr.html#UG_CondExpr_ConditionalIndexedOperations

?