By-Product Synergy Model Bugs Declaration

Dear All,

This is my first time using GAMS, and I’m struggling with some errors I couldn’t solve. I’ve viewed all the available resources but still can’t solve my errors. Would someone help me with that?

  1. In my model, I’m using x(i,j), and i also need to use x(j, i). How can I identify that in GAMS? I declared it a new variable, but it didn’t solve the error.
  2. The most repeated error in my model is error 171; how can I solve that?

Thanks in advance for your help, and I appreciate your support and efforts
Thesis Model Replication.gms (5.31 KB)

Hi,

If you need to use x(i,j) and x(j,i), then you should not declare variable x with domain (i,j). If sets i and j both describe subsets of nodes, you can declare a superset of nodes and make i and j subsets of this superset. Then you can declare x over the superset of all nodes and should be good, e.g.

Sets
n superset of nodes  /x1,x2,x3,x4,x5, r1,r2,r3,r4,r5/
i(n) subset of nodes /x1,x2,x3,x4,x5/
j(n) subset of nodes /r1,r2,r3,r4,r5/
[...]
Positive Variable
      x(n,n)  Amount of flow between nodes;
[...]

There are many more errors in your model and I guess only you can know how to fix them because only you know what you want to model. E.g. in

C2(j)..     sum((i),AH(i,j)*x(i,j)) =E= BT(i,j)*sum((i),x(j,i));

the i in BT(i,j) is not controlled which is why you get the following error.

 179  C2(j)..     sum((i),AH(i,j)*x(i,j)) =E= BT(i,j)*sum((i),x(j,i));
****                                              $149
**** 149  Uncontrolled set entered as constant

Further errors again about domain violations.

181  C4(j)..     sum((i),x(i,j)) =L= g(j)*v(j);
****                                     $171 $171
**** 171  Domain violation for set

You declare g over set i but then you use it only with set j as index. The same applies for variable v.

The rest of your model is repeating the same errors in various combinations again and again. Please make sure you understand what those errors mean, e.g. by looking at the tutorial about fixing compilation errors and then try to resolve one error after the other.

Good luck!

Fred