Example: Ordering of one-dimensional sets and use of ord() and card() 09/10/01 16:11:39 PAGE 1 GAMS Rev 121 Linux/Intel 2 4 5 * define two wacko sets 6 set I / soccer, football /; 7 set K / 1*4, 25*29, me2you*me10you/; 8 9 parameter A(I), B(K); 10 11 scalar cardI, cardK; 12 13 * components of A and B set to the ord() of successive elements 14 A(I) = ord(I); 15 B(K) = ord(K); 16 17 * show the sets 18 display I, K; 19 20 * check their cardinality 21 cardI = card(I); 22 cardK = card(K); 23 display cardI, cardK; 24 25 * check the ord() 26 display A, B; Example: Ordering of one-dimensional sets and use of ord() and card() 09/10/01 16:11:39 PAGE 2 Unique Element Listing GAMS Rev 121 Linux/Intel Unique Elements in Entry Order 1 soccer football 1 2 3 4 25 26 27 28 11 29 me2you me3you me4you me5you me6you me7you me8you me9you me10you Unique Elements in Sorted Order 1 1 2 25 26 27 28 29 3 4 football 11 me10you me2you me3you me4you me5you me6you me7you me8you me9you soccer COMPILATION TIME = 0.000 SECONDS 0.7 Mb LNX200-121 Example: Ordering of one-dimensional sets and use of ord() and card() 09/10/01 16:11:39 PAGE 3 E x e c u t i o n GAMS Rev 121 Linux/Intel ---- 18 SET I soccer , football ---- 18 SET K 1 , 2 , 3 , 4 , 25 , 26 , 27 , 28 , 29 , me2you , me3you me4you , me5you , me6you , me7you , me8you , me9you , me10you ---- 23 PARAMETER cardI = 2.000 PARAMETER cardK = 18.000 ---- 26 PARAMETER A soccer 1.000, football 2.000 ---- 26 PARAMETER B 1 1.000, 2 2.000, 3 3.000, 4 4.000, 25 5.000, 26 6.000, 27 7.000 28 8.000, 29 9.000, me2you 10.000, me3you 11.000, me4you 12.000, me5you 13.000, me6you 14.000 me7you 15.000, me8you 16.000, me9you 17.000, me10you 18.000 EXECUTION TIME = 0.000 SECONDS 1.3 Mb LNX200-121 USER: Computer Sciences Dept. G010628:1627AS-LNX University of Wisconsin-Madison DC2621 **** FILE SUMMARY INPUT /afs/cs.wisc.edu/u/s/w/swright/public/html/635/examples/ordered_sets.gms OUTPUT /afs/cs.wisc.edu/u/s/w/swright/public/html/635/examples/ordered_sets.lst