Hi, the final number of variables depends on the constraints.
For more detail: You don’t need to declare the domain of the variable (as in variable P(A,B)). You can just write variable p;
Then, if the variable appears in the constraints, it will be part of the model. Check out this example:
sets A /1*5/
A1(A) /2,3/
variable d,t;
equation Q,dummy;
Q(A1).. d(a1) =E= 0;
dummy.. t=l=2;
model p /all/;
solve p using lp maximizing t