[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-glpk] Is anyway to generate a certain subset of the set

**From**: |
Leandro Barcelos |

**Subject**: |
Re: [Help-glpk] Is anyway to generate a certain subset of the set |

**Date**: |
Tue, 21 Aug 2007 16:15:55 -0300 |

Hi, Andy
I think you can try some like...
#
param N := 10;
set A := 1..N;
set B{i in A} := setof{j in A : j<=i} j;
/* testing... */
printf "\n";
for {i in A}{
printf{j in A : j<=i} " %s", j;
printf "\n";
}
#
On 8/21/07, address@hidden <address@hidden> wrote:
>
>* Hi, here is my problem:*
>
>* I have defined a set:*
>* set A := 1 .. N # where N may be 1000 as a param*
>
>* Is there any easy way to generate all the N subsets from A as follows:*
>
>* A1={1}, A2={1,2}, A3={1,2,3} ..., An-1= {1, ..., N-1}, An={1, 2, ..., N}?*
>
>* thanks very much.*
>
>
>* _______________________________________________*
>* Help-glpk mailing list*
>* address@hidden*
>* http://lists.gnu.org/mailman/listinfo/help-glpk*
>
>
--
Leandro B. Barcelos