Rank

Table of Contents

Note
This tool is part of the GAMS Tools Library. Please inspect the general information about GAMS Tools.

This sorts one dimensional symbol sym and stores sorted indices in one dimensional parameter symIdx.

Usage

Command line:

gamstool [alg.]Rank sym symIdx gdxIn=fileIn.gdx gdxOut=fileOut.gdx

Compile time:

$callTool [alg.]Rank sym symIdx [gdxIn=fileIn.gdx] [gdxOut=fileOut.gdx]

Execution time:

executeTool '[alg.]Rank sym symIdx [gdxIn=fileIn.gdx] [gdxOut=fileOut.gdx]';

Where:

Argument Description
sym Name of parameter or set to be sorted sym(*)
symIdx Name of parameter containing sort indexes symIdx(*)

The following named parameters are available:

Parameter Description
gdxIn=fileIn.gdx Name of GDX file that contains symbol sym. Mandatory if called from the command line, otherwise optional.
gdxOut=fileOut.gdx Name of GDX file that contains symbol symIdx after execution. Mandatory if called from the command line, otherwise optional.

Example

set I /i1 * i6/;
parameter A(I) /i1=+Inf, i2=-Inf, i3=Eps, i4= 10, i5=30, i6=20/;
parameter AIndex(i) 'permutation index';

* sort symbol; result in parameter AIndex
$callTool.checkErrorLevel 'alg.Rank A AIndex'
display AIndex;

The complete example is also part of the GAMS Data Utilities Library, see model [GDXRANKExample18] for reference. The libInclude rank.gms uses this tool internally.