It would be better to attach the code…, but here some hints. Look always at the first error that appears. Following errors can be caused by the first error.
In your case error 148
148 Dimension different - The symbol is referenced with more/less 148 indices as declared
It looks like you defined obf over a set (something like obv(i)).
Furthermore, if you sum over two indices, they should be surround by parentheses (e.g. sum(i,t…), b(i,t)*x(i,t));). Furthermore, your summing of the objective misses a closing matrix.
Cheers
Renger
Hi Ranger and thank for your answer.
Well, now i’m going to attach the code that i wrote. I wrote only the parameter, the function objective (1) (called “fob” in the code) and the constraint (3) (called “vincolo3(i)” in the code). Please, answer me if you have more hints or if you can write this code in the correct way.
Best regards, stef. Progetto.gms (1.01 KB)
As I wrote before,f you sum over two indices, they should be surrounded by parentheses (e.g. sum(i,t…), b(i,t)x(i,t));). Furthermore, your summing of the objective misses a closing matrix.
As GAMS collects all the set elements used in a model from begin to start in a unified element list (UEL), you will run into problems if you try to use ord(t), as GAMS, in your case, first reads the set with an element /5/ and at the end all the t elements.
It will complain that t is not ordered. You can either use a non-used set with all the numbers at the beginning (like set overall /110/) or move set t to the beginning.
Your code will run without a problem, if you correct your objective using the hints I gave:
Hi Renger,
I correct the compilation and now the code runs without problems. Now i’m having problems with the writing of constrains (4), (5) and (6), because of:
the presence of the variable x(i,j) instead of the variable x(i,t);
the presence of the parameter a(k,i) and r(t,k) instead of the parameter a(i,k) and r(k,t);
the presence of max and min over the sum;
Sorry for the lot of questions, but i don’t have sufficient experience to write this constraint.
Can you help me in the writing, please?
(P.S. i’m going to attach the corrected version of the code).
Best regards, Stef. Progetto.gms (1.01 KB)
Hi. When I create and write the mathematical model, I get the following Errors. I would appreciate your help.
GAMS 31.1.0 r55b6ce3 Released May 1, 2020 WEX-WEI x86 64bit/MS Windows - 05/16/20 17:39:01 Page 1
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
C o m p i l a t i o n