Re: [Help-glpk] MathProg Question

2012-01-11 Thread Andrew Makhorin
I am having some difficulty with MathProg syntax with regards to logical operators and sets. Basically, I am making a big set, C, that is a set of 2-tuples, where each 2-tuple consists of an element from sets A and B. I can do this for every combination of elements in A and B using setof, but

Re: [Help-glpk] Mathprog question

2009-12-14 Thread Nigel Galloway
It is not necessary to rely on glpk for all your printing needs. You could pipe the output through gawk. Linux and DOS both provide sort utilities. - Original Message - From: Jeffrey Kantor To: xypron Cc: Help-glpk@gnu.org Subject: Re: [Help-glpk] Mathprog question Date: Sat

[Help-glpk] Mathprog question

2009-12-12 Thread Jeffrey Kantor
Hi all -- I'm struggling to come up with a way to print a list ordered by the value of a solved variable. I have var start{TASKS}; solve; and now I'd like to print the tasks ordered by the value of the start variables. Perhaps I'm just not thinking clearly, but is there a simple way to do

Re: [Help-glpk] Mathprog question

2009-12-12 Thread xypron
Hello Jeffrey, see example below. Unfortunately sorted output requires O(n^3) time. Best regards Xypron set I; param a{I} := Uniform01(); var x{I}; s.t. c{i in I}: a[i] = x[i]; solve; printf unsorted\n; for{i in I} printf %10s: %f\n, i, x[i]; printf decreasing order\n; for{i in

Re: [Help-glpk] Mathprog question

2009-12-12 Thread Jeffrey Kantor
I am in awe ... thank you, precisely what I needed. Jeff On Sat, Dec 12, 2009 at 3:57 PM, xypron xypron.g...@gmx.de wrote: Hello Jeffrey, see example below. Unfortunately sorted output requires O(n^3) time. Best regards Xypron set I; param a{I} := Uniform01(); var x{I}; s.t. c{i

Fwd: Re: [Help-glpk] Mathprog question

2009-12-12 Thread glpk xypron
Datum: Sat, 12 Dec 2009 12:57:22 -0800 (PST) Von: xypron An: Help-glpk@gnu.org Betreff: Re: [Help-glpk] Mathprog question Hello Jeffrey, see example below. Unfortunately sorted output requires O(n^3) time. Best regards Xypron set I; param a{I} := Uniform01(); var x{I}; s.t. c{i in I

Re: [Help-glpk] Mathprog question

2009-12-12 Thread Andrew Makhorin
see example below. Unfortunately sorted output requires O(n^3) time. Below here is a simplified Xypron's version. It works if all a[i]'s are different. set I; param a{I} := Uniform01(); printf{k in 1..card(I), i in I: sum{j in I} (if a[i] = a[j] then 1) == k} %-10s %f8.6\n, i, a[i];

Re: Fwd: Re: [Help-glpk] Mathprog question

2009-12-12 Thread Andrew Makhorin
Hi Xypron, currently in GMPL there is no way to retrieve an element of a symbolic set by a logical condition. In the example below I am able to sort the values x{I}, but I am unable to output the indices sorted by the values. One way to add such a functionality would be functions Max{