help-glpk
[Top][All Lists]
Advanced

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

RE: [Help-glpk] Multi-dimensional data question


From: Noli.Sicad
Subject: RE: [Help-glpk] Multi-dimensional data question
Date: Thu, 24 Feb 2005 10:06:48 +1100

Hi Jon,

Here example snippet multi-dimensional from http://www.ampl.com/BOOK/EXAMPLES2/index_files.html

Multi.mod and multi.dat (below). I use more than 3 dimensional data in forest management planning modelling and wood processing models. I am just guessing here that you want to LP model and visualise result in GIS (shapefile), right? I like to do this J.

 

I got the 1st edition of AMPL book and it very useful of MathProg (*.mod) development. Get the book it is worth buying it. Good explanations how to do multi-dimensional array/data.

Regards, Noli

~~~~~~~~~~

set ORIG;   # origins

set DEST;   # destinations

set PROD;   # products


param cost {ORIG,DEST,PROD} >= 0;  # shipment costs per unit

minimize Total_Cost:

   sum {i in ORIG, j in DEST, p in PROD}

      cost[i,j,p] * Trans[i,j,p];



param cost :=

 [*,*,bands]:  FRA  DET  LAN  WIN  STL  FRE  LAF :=

        GARY    30   10    8   10   11   71    6

        CLEV    22    7   10    7   21   82   13

        PITT    19   11   12   10   25   83   15

 [*,*,coils]:  FRA  DET  LAN  WIN  STL  FRE  LAF :=

        GARY    39   14   11   14   16   82    8

        CLEV    27    9   12    9   26   95   17

        PITT    24   14   17   13   28   99   20

 [*,*,plate]:  FRA  DET  LAN  WIN  STL  FRE  LAF :=

        GARY    41   15   12   16   17   86    8

        CLEV    29    9   13    9   28   99   18

        PITT    26   14   17   13   31  104   20 ;

~~~~


-----Original Message-----

From: address@hidden [mailto:address@hidden] On Behalf Of Jon Spragg

Sent: Wednesday, 23 February 2005 6:58 PM

To: address@hidden

Subject: [Help-glpk] Multi-dimensional data question

Hi,

 

In the glpk distribution there are examples of two dimensional model objects, such as

 

param a{i in I, j in J}, >= 0;

 

to model, say, geographical coordinates.  These structures are initialised in the data section using code such as:

 

 

param a : 1  2  3  4  5 :=

      1   12 15 12 10 11

      2   23 25 19 11 15

      3   15 40 21 75 8

      4   9  2  9  32 31

      5   15 18 19 10 11;

 

However, if we define a structure with more than two dimensions, such as

 

param a{i in I, j in J, k in K}, >= 0;

 

to represent, say, the amount of resource capacity k at coordinate i, j, then how do you initialise the structure in the data section of the mod file? This is  not clear to me from the documentation supplied with the distribution.

 

Thank you for any help.

 

Jon Spragg 


reply via email to

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