help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Printing non-zero parts of a solution matrix


From: glpk xypron
Subject: Re: [Help-glpk] Printing non-zero parts of a solution matrix
Date: Sat, 20 Oct 2012 01:31:36 +0200

Hello Reg,

# Generate some random data.
set S := {1..1000};
param x{S} := if Uniform01() > .99 then Uniform01() else 0;
# Print nonzero elements only.
printf {s in S: x[s] > 0 }
  "x[%d] = %f\n", s, x[s];
end;

Best regards

Xypron
-------- Original-Nachricht --------
> Datum: Fri, 19 Oct 2012 14:44:15 -0700 (PDT)
> Betreff: [Help-glpk] Printing non-zero parts of a solution matrix

> The problem I'm solving has a small number of non-zero results in the
> solution matrix.
> 
> Is there a way to print just the non-zero elements w/ GMPL?
> 
> The obvious approach of iterating over the matrix w/ for doesn't allow a
> conditional inside the actions.
> 
> thanks,
> Reg
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk



reply via email to

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