[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] (no subject)
From: |
Heinrich Schuchardt |
Subject: |
Re: [Help-glpk] (no subject) |
Date: |
Mon, 02 Sep 2013 22:47:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130704 Icedove/17.0.7 |
Hello Antonio,
if your matrix is sparse, keep the model sparse. In the rest of your
model you would only waste memory and CPU time otherwise.
set A, dimen 3;
set I, dimen 2 := setof{(i,j,k) in A}(i,j);
param a{(i,j) in I} := sum{(i,j,k) in A} k;
display A, I, a;
data;
set A :=
(1,1,1)
(1,2,1)
(1,3,1)
(1,4,1)
(2,6,1)
(2,7,1)
(2,8,1)
(2,9,1)
(2,10,1)
(2,13,1)
(2,15,1);
end;
Best regards
Heinrich Schuchardt
On 02.09.2013 22:29, Antonio Carlos Moretti wrote:
How can I define a sparese matrix in GLPK.
I am doing the following:
....
param A{j in voos, i in seq}, default 0.0;
param A:= [1,1] 1
[1,2] 1
[1,3] 1
[1,4] 1
[2,6] 1
[2,7] 1
[2,8] 1
[2,9] 1
[2,10] 1
[2,13] 1
[2,15] 1;
....
Thanks ,
Antonio
_______________________________________________
Help-glpk mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-glpk