Search found 639 matches

by Renger
4 years ago
Forum: Syntax
Topic: Summation with parameter
Replies: 13
Views: 16995

Re: Summation with parameter

Hi sum(j$(ord(j) q), sum(s$(ord(s) < pp(j)-1), ... I am not sure if you really need to have s defined as a set based on pp(j). If you define s over all possible intervals and use the $-conditions in the summation, all should be fine. However, you could also use an explicit mapping (look for mapping ...
by Renger
4 years ago
Forum: Syntax
Topic: Exec Error: division by zero (0)
Replies: 2
Views: 3636

Re: Exec Error: division by zero (0)

Hi Judith If Gams tells you something is zero, you better believe it and you should using display statements to check your code. A quick check (display TOTO) reveals that TOTO has a value of zero. If you look in your gdx file, TOTO is empty. Now, if I look at your gdxxrw command to read your data, y...
by Renger
4 years ago
Forum: Syntax
Topic: Summation with parameter
Replies: 13
Views: 16995

Re: Summation with parameter

Hi
You can use the dollar sign to restrict the summation:

Code: Select all

sum((i,j,k)$r(j,k), ...
If this is not what you are looking for, please send your code with the summation, parameter and the sets defined, even if it doesn't work, so it is easier for us to help you.
Cheers
Renger
by Renger
4 years ago
Forum: Archive Google Group
Topic: The way to control total solve time
Replies: 4
Views: 38249

Re: The way to control total solve time

Hi Lucas

You could introduce an if condition using the time used from your two models:

Code: Select all

parameter totaltime 'Total time used';
model mymodel /all/;
solve...
totaltime = mymodel.resusd;

solve...
totaltime = totaltime + mymodel.resusd;

if(totaltime < 3600,
    solve mymodel
);
Cheers
Renger
by Renger
4 years ago
Forum: Syntax
Topic: CEG Model
Replies: 8
Views: 5444

Re: CEG Model

Hi Baud Gams tells you exactly what is wrong with your code: In the case of the error 625 XSO(j) = Baud("Total Ligne",j); **** $148 148 Dimension different - The symbol is referenced with more/less indices as declared Gams puts the $148 below Baud. If you go up in your code, you will find ...
by Renger
4 years ago
Forum: Solvers
Topic: Can someone help me with GAMS Error 148
Replies: 4
Views: 7258

Re: Can someone help me with GAMS Error 148

Hi You are trying to find the minimum of the variable ETA which is defined over the set i using an optimization approach. In your case, you could just find the minimum of sum(t,p_pvf(i,t)*c_pv(i)): parameter mymin ; mymin = smin(i, sum(t,p_pvf(i,t)*c_pv(i))); In your formulation you have a i objecti...
by Renger
4 years ago
Forum: Tools
Topic: 3 question about documentation code
Replies: 2
Views: 23125

Re: 3 question about documentation code

Hi
The extension "py" stands for a script in Python (see the documentation on using Python in Gams code).
You can use macros, but they are not as powerful as using python code.
Cheers
Renger
by Renger
4 years ago
Forum: Modeling
Topic: Need Help with constraint for a Facility Location model
Replies: 1
Views: 1777

Re: Need Help with constraint for a Facility Location model

Hi ToSan

THis would probably be the constraint you are looking for:

Code: Select all

OnlyOneI(i)..
    sum(s, akt(i,s)) =l= 1;
At every i there can only be one or zero plants.

Cheers
Renger
by Renger
4 years ago
Forum: Syntax
Topic: Equations Defined over the Domain of Dynamic Sets
Replies: 2
Views: 3905

Re: Equations Defined over the Domain of Dynamic Sets

Hi In equation 5 you defined your equation over c(nd,nd): these are only the diagonal elements (which are not part of the mapping). Use c(nd,nf) and the equation appears. This is probably due to the confusion resulting from the definition of a parameter, set, variable over a double index of the same...