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
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk



_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to