help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Defining subset within a set in GMPL


From: Andrew Makhorin
Subject: Re: [Help-glpk] Defining subset within a set in GMPL
Date: Tue, 21 Apr 2009 21:28:16 +0300

> I could use some help with GMPL.  I #8217;m trying to
> define a subset for an existing set.  I have defined the following.
>
> param m;
> /* scalar value */
>  
> set I := 1..m;
> /* list of elements */
>  
> param r{i in I};
> /* scalar value of elements I such that 0 <= r(i) <= 1 */
>  
> Now here is some pseudo code I would like to represent in
> GMPL
>  
> set NEW = set of( i in I, such that r[i]>0.85 )
>  
> How do I define the set NEW in GMPL?

Literally as you wrote:

set NEW := setof{i in I: r[i] > 0.85} i;

>  I suppose I could
> just create two sets and union them but it doesn #8217;t seem very
> elegant and I would like to keep set I intact from 1..m







reply via email to

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