[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Mathprog question
From: |
xypron |
Subject: |
Re: [Help-glpk] Mathprog question |
Date: |
Sat, 12 Dec 2009 12:57:22 -0800 (PST) |
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.