This works- perfect!
Thanks Xypron
Regards
Yaron
On Sat, Oct 25, 2008 at 8:52 PM, xypron <[EMAIL PROTECTED]> wrote:
>
> Hello Yaron,
>
> 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;
> table result { i in I, j in J : v[i,j] > 0 } OUT 'iODBC'
> 'DSN=glpk;UID=glpk;PWD=gnu'
> 'DROP TABLE IF EXISTS yaron_result'
> 'CREATE TABLE yaron_result (i INT, j INT, v INT )'
> 'yaron_result' :
> i, j, v[i,j];
> printf "Non-zero results\n";
> for { i in I, j in J : v[i,j] > 0 }
> printf "v[%d, %d] = %d\n", i, j, v[i,j];
> end;
>
> Best regards
>
> Xypron
>
>
> kretch wrote:
> >
> > Hi All.
> > I'm solving a diet problem, and would like to display only the values of
> > foods which have non-zero quantities.
> > I'm using tables to formulate both input and output, so any information
> > which would enable me to write just the non-zero variables to a table
> > would
> > be most appreciated.
> >
> > Thanks
> > Yaron
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Displaying-non-zero-values-only-tp20163644p20163877.html
> Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.
>
>
>
> _______________________________________________
> Help-glpk mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/help-glpk
>
_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk