help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Inputting a large sparse matrix in GLPK data file


From: xypron
Subject: Re: [Help-glpk] Inputting a large sparse matrix in GLPK data file
Date: Fri, 24 Oct 2008 22:39:50 -0700 (PDT)

Hello Rajesh,

when dealing with sparse matrices a good idea is to use sets instead of
parameters. This does not only allow to save memory but often eases
formulating constraints.

set I :=  1..8;
set J := 1..8;
set A dimen 3 := { (3, 4, 2), (7, 8, 1) };
var v{i in I, j in J}, >= 0;
minimize sum : sum{i in I, j in J} v[i,j];
s.t. constraint {(i,j,x) in A}:
  v[i,j] >=  x;
solve;
display v;
end;

When dealing with large data sets consider using a SQL data base and the
table statement.

Best regards

Xypron


Rajesh Kavasseri wrote:
> 
> Hello GLPK users,
> 
> I am a newbie to GLPK - but am enjoying this !
> 
> I need to input (or specify)  a large sparse integer matrix A which is 
> say 1500 X 1500.
> Only a few entries are integers, say 100 of them are integers and the 
> rest are zeros.
> How does one go about inputting this in to GLPK ?
> 
> How is this done neatly in GLPK ? (ie initializing all entries of A to 
> zero) and inputting only the non-zero ones
> I was trying something along the lines of  saying (in the MOD file)
> 
> set I :=  1..1500;
> set J := 1..1500;
> param A{i in I, j in J}, >=0, default 0.0;
> 
> How are the non-zero entries specified then ?
> When I tried setting [in the DAT file]
> 
> A[1,2] := 5; A[3, 2]:=9, A[1,6]: = 6;
> I get an error.
> 
> Please help !!!
> 
> 
> Many thanks || Rajesh
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-glpk
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Inputting-a-large-sparse-matrix-in-GLPK-data-file-tp20121244p20161527.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.





reply via email to

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