help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Mathprog question


From: Nigel Galloway
Subject: Re: [Help-glpk] Mathprog question
Date: Mon, 14 Dec 2009 18:58:14 +0000


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: address@hidden
Subject: Re: [Help-glpk] Mathprog question
Date: Sat, 12 Dec 2009 16:12:03 -0500

I am in awe ... thank you, precisely what I needed.

Jeff


On Sat, Dec 12, 2009 at 3:57 PM, xypron <address@hidden> 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 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 (0..(card(I)-1))}
{
 printf "%d: %f\n", i+1, sum{j in I :
   i == sum{ k in I :
     x[j]<x[k] || ( x[j]==x[k] && j < k )} 1 } x[j];
}
printf "increasing order\n";
for{i in (0..(card(I)-1))}
{
 printf "%d: %f\n", i+1, sum{j in I :
   i == sum{ k in I :
     x[k]<x[j] || ( x[k]==x[j] && k < j )} 1 } x[j];
}
data;
set I := ape bear crocodile elefant lion snake tiger zebra;
end;



Jeffrey Kantor wrote:
>
> 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 this?
>
> Jeff
>
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-glpk
>
>

--
View this message in context: http://old.nabble.com/Mathprog-question-tp26760931p26761080.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.



_______________________________________________
Help-glpk mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-glpk


_______________________________________________
Help-glpk mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-glpk

--

_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com


Powered by Outblaze
reply via email to

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