On Thu, Oct 22, 2009 at 3:05 PM, xypron
<address@hidden> wrote:
Hello
>> have a set MBC.
>> Now I need the restriktion, y[x]=0 where x is just the first element of
>> the MBC.
sets in GLPK are unordered. Hence the first element cannot be accessed. Of
cause you could define a parameter with the value of the first element.
Determining a set containing the smallest element of a given set is
possible.
See example below.
Best regards
Xypron
# some set
set S;
# set of the smallest element in S
# GLPK is inefficient here, needing O(n^2) time!
set F := setof{ s in S : forall{u in S} s <= u } s;
# variable
var y{s in S}, >= 0, <=1;
# some objective
maximize obj :
sum{s in S} y[s];
# constraint for the smallest element in S
s.t. c1{s in F} :
y[s] = 0;
# display constraint
display c1;
# initialization
data;
set S := the quick brown fox jumps over a lazy dog;
--
View this message in context: http://www.nabble.com/First-element-of-the-set-tp26010502p26013668.html