Search found 34 matches

by GFA
1 month ago
Forum: Modeling
Topic: Omitting dimensions
Replies: 3
Views: 398

Re: Omitting dimensions

Hi hein,

Have a look here and especially at example 4: https://www.gams.com/latest/docs/UG_GDX.html
You might want to use something like: "$load setNo1<Parameter2.dim1" etc. to load the setelements from GDX.

Regards,
GFA
by GFA
1 month ago
Forum: Syntax
Topic: How to code in a neat way?
Replies: 1
Views: 257

Re: How to code in a neat way?

Hi,

One way would be to write it like this:

Code: Select all

Coef (J,T) = Coef (J,"2000")*(0.95**(ORD(T)-1));
Cheers,
GFA
by GFA
1 month ago
Forum: Modeling
Topic: Incorrect solution in code running
Replies: 4
Views: 1522

Re: Incorrect solution in code running

Hi sandrina,

Try using starting values for your variables, this usually helps the solve. See: https://www.gams.com/latest/docs/UG_Variables.html
Hope this helps.

GFA
by GFA
2 months ago
Forum: Modeling
Topic: Incorrect solution in code running
Replies: 4
Views: 1522

Re: Incorrect solution in code running

Hi Sandrina,

It is hard to give any advice since the information you provided is quite limited.
One thing you could try is to make your model as small as possible, or make a simple toy example. This usually makes it easier to analyse the model's behaviour.

Regards,
GFA
by GFA
2 months ago
Forum: Modeling
Topic: use the loop index list to fix a variable
Replies: 2
Views: 1381

Re: use the loop index list to fix a variable

Hi Shaparak, Not sure what you want to achieve, but you might want to free the attack variable again after the solve, that way the variable only is fixed for the index i it is currently looping over. Regards, GFA loop(i, attack.fx(i)=0; solve T maximizing o using mip; attack.lo(i) = -inf; attack.up(...
by GFA
2 months ago
Forum: Syntax
Topic: From multi-dimensional set table to simple set table
Replies: 1
Views: 989

Re: From multi-dimensional set table to simple set table

Hi lpedauga, Didn't test it but looking at your code there seems to be an error in you mapping. In the SAM you refer to "ctry2.nace1" "ctry2.nace2" and "ctry2.nace3" however there is no mapping in "map", I guess the numbers in red (see below) have to be a 2? Regards GFA map(ctry,CPAxNACE,i) / (ctry1...
by GFA
2 months ago
Forum: Syntax
Topic: parameter with dynamic dependencies
Replies: 3
Views: 1181

Re: parameter with dynamic dependencies

Hi Pitters, Somethings which might be useful: - Inside your table you can write m1*m3 to refer to all set-elements, this way the parameter will have the same value for all materials for the specific country. - Which comes down to the same as: ' tariff("c1",materials) = 10; ' which will also result i...
by GFA
2 months ago
Forum: Syntax
Topic: Problem with loop
Replies: 2
Views: 1359

Re: Problem with loop

Hi, B(z+1) is declared in the same loop as u2(zz), so in the last loop iteration B(z+1) will have a value (772) but u2+1 won't. One way to solve this is to declare u2(zz+1) in the same loop, but keep in mind that now you will miss the first value of u2(zz), but just like the first b-value you can al...
by GFA
3 months ago
Forum: Syntax
Topic: index of elements in GAMS
Replies: 4
Views: 870

Re: index of elements in GAMS

I assume you mean your algorithm in Matlab? I'm sure Matlab has some functionality to write .txt-files in which you could put the right set order after the algorithm is finished. Then you can include that file in your GAMS code to use this set order. So Matlab txt-file contains for example: 3,2,1 An...
by GFA
3 months ago
Forum: Syntax
Topic: index of elements in GAMS
Replies: 4
Views: 870

Re: index of elements in GAMS

Hi,

At the start of your GAMS-code you could define a set that orders set elements (eg "set setord /3,2,1/;), this way every time these set-elements will be presented they will be ordered this way.
Downside is that you have to update this setord-list if your set-elements change..

Cheers,
GFA