Gdxrank

Top  Previous  Next

GDXRANK will sort all one dimensional parameters in a GDX file, and then write the sorted indices as one dimensional parameters in an output GDX file.

Usage:

 gdxrank inputfile outputfile

Each one dimensional parameter will then be read from the input file, sorted and a corresponding integer permutation index will be written to the output file using the same name for the symbol. GAMS special values such as Eps, +Inf and -Inf are recognized.

Example gdxrank.gms

set I /i1 * i6/;

parameter A(I) /i1=+Inf, i2=-Inf, i3=Eps, i4= 10, i5=30, i6=20/;

display A;

* write symbol Array to sort to gdx file

execute_unload "rank_in.gdx", A;

* sort symbol; permutation index will be named A also

execute 'gdxrank rank_in.gdx rank_out.gdx';

* load the permutation index

parameter AIndex(i);

execute_load "rank_out.gdx", AIndex=A;

display AIndex;