Sorted index positions

Top  Previous  Next

Select which index positions in the GDX display are sorted alphabetically or by entry order.

 

clip0036

 

In the example above both index positions are sorted alphabetically. The sorting information is stored for each symbol in the project file and will be used again next time the symbol is displayed.

 

set i /i, i7, i8, i9, i1*i6/;

set j /j3, j2, j1/;

parameter A(i,j);

A(i, j) = 10 * Ord(i) + Ord(j);

 

 

Entry order

Entry order

Alphabetical order

Alphabetical order

 

Using the GAMS code above, and showing the symbol A in the GDX data browser without and with sorting.

 

Note that the comparison of the unique elements is not simple alphabetic. If two strings in the comparison start with the same text, but have different numerical tails, the tails will be compared numerically; not alphabetically.

 

Using alphabetical comparison, the following holds: A1 < A11 < A2

The viewer however will sort this as: A1 < A2 < A11