[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Re: using multi-dimensional data files

From: Andrew Makhorin
Subject: [Help-glpk] Re: using multi-dimensional data files
Date: Mon, 08 Sep 2003 21:50:17 +0400

>I have been using glpk (the GLPSOL solver) using the GNU MathProg modelling
>language and am trying to use a data file with more than two dimensions.  I
>have tried using the following code:
>set A;
>set G;
>set R;
>set H;
>set B;
>param d{a in A, g in G, r in R, b in B} >=0;
>*** rest of capacity problem
>*** new file for data:
>set A := 1 2 3 4;
>set G := 1 2;
>set R := 1330 1310;
>set H := 102 255 99999;
>set B := acc_emerg icu ccu;
>param d[a,g,r,b] := data( a in A, g in G, r in R, b in B:
>4      2       1330    ccu     7
>3      2       1330    icu     10
>2      1       1330    acc_emerg       15
>*** other parameters
>and I get the error message:
>analysis/capacity_data.txt:10: d requires numeric data
>Context: ...acc_emerg icu ccu ; param d [ a , g , r , b ] := data
>Model processing error
>Do you know where I am going wrong, or another way I can do this?  This is
>just an extract from the data and the real file is quite long, so I don't
>want to have to do too much re-arranging if possible.

In MathProg there is no such construction that you are using for the
parameter d (it looks like the data clause valid in the modeling language
glpk/l which was supported in older versions of glpk).

You need to write something like this:

param d :=
4       2       1330    ccu     7
3       2       1330    icu     10
2       1       1330    acc_emerg       15

or like this:

param d :=
[4,2,1330,ccu]       7
[3,2,1330,icu]       10
[2,1,1330,acc_emerg] 15

There are also another formats for multidimensional data. For details
please consult the language description included in the package (see
doc/lang.dvi and doc/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]