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