Problem with subset

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Problem with subset

Post by Archiver »



Hi all, and sorry for my english.

I'm creating a GAMS program and i have a little problem. This is the
program:

Set

i demand points
/ Amv, Cbr, Cng, Crv, Clg, Lln, Ons, Prs, Pma, Pmb, Pln, Png,
Rbs, Rbd /
j supply points
/ Amv, Cbr, Cng, Crv, Clg, Lln, Ons, Prs, Pma, Pmb, Pln, Png,
Rbs, Rbd /

Table

t(i,j) transport cost i to j

Amv Cbr Cng Crv Clg Lln Ons Prs Pma Pmb Pln Png Rbs Rbd
Amv 0 48 16 52 56 60 31 25 79 89 44 38 42 76
Cbr 48 0 32 56 60 41 17 40 31 37 60 81 49 52
Cng 16 32 0 37 41 45 15 10 63 74 29 49 27 61
Crv 52 56 37 0 8 31 49 30 80 60 49 86 16 46
Clg 56 60 41 8 0 34 52 33 83 63 47 89 19 49
Lln 60 41 45 31 34 0 35 36 54 34 55 99 23 21
Ons 31 17 15 49 52 35 0 23 47 53 42 63 40 50
Prs 25 40 10 30 33 36 23 0 72 67 21 58 20 53
Pma 79 31 63 80 83 54 47 72 0 22 92 113 74 39
Pmb 89 37 74 60 63 34 53 67 22 0 85 123 53 16
Pln 44 60 29 49 47 55 42 21 92 85 0 76 37 71
Png 38 81 49 86 89 99 63 58 113 123 76 0 75 108
Rbs 42 49 27 16 19 23 40 20 74 53 37 75 0 39
Rbd 76 52 61 46 49 21 50 53 39 16 71 108 39 0;

and i want to set a subset N(j) = {j| t(i,j) <= 30}, a subset of j,
wich transport cost is 30 or less.

Thanks for your help.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Problem with subset

Post by Archiver »



so i understand it, you would like to sort all values beyond 30 of the
table.
Vector N(j)does not exist , because every element J from T(i,j) has
more than one value below 30

you can realise simply sort-loop

Parameter
n(i,j)
;

loop(i,
loop(j,
if (t(i,j)<30,
n(i,j)=t(i,j)
);
);
);

Display
n
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Problem with subset

Post by Archiver »



I guess you made a typo when you wrote "N(j) = {j| t(i,j) wrote:
> > Hi all, and sorry for my english.
> >
> > I'm creating a GAMS program and i have a little problem. This is the
> > program:
> >
> > Set
> >
> > i demand points
> > / Amv, Cbr, Cng, Crv, Clg, Lln, Ons, Prs, Pma, Pmb, Pln, Png,
> > Rbs, Rbd /
> > j supply points
> > / Amv, Cbr, Cng, Crv, Clg, Lln, Ons, Prs, Pma, Pmb, Pln, Png,
> > Rbs, Rbd /
> >
> > Table
> >
> > t(i,j) transport cost i to j
> >
> > Amv Cbr Cng Crv Clg Lln Ons Prs Pma Pmb Pln Png Rbs Rbd
> > Amv 0 48 16 52 56 60 31 25 79 89 44 38 42 76
> > Cbr 48 0 32 56 60 41 17 40 31 37 60 81 49 52
> > Cng 16 32 0 37 41 45 15 10 63 74 29 49 27 61
> > Crv 52 56 37 0 8 31 49 30 80 60 49 86 16 46
> > Clg 56 60 41 8 0 34 52 33 83 63 47 89 19 49
> > Lln 60 41 45 31 34 0 35 36 54 34 55 99 23 21
> > Ons 31 17 15 49 52 35 0 23 47 53 42 63 40 50
> > Prs 25 40 10 30 33 36 23 0 72 67 21 58 20 53
> > Pma 79 31 63 80 83 54 47 72 0 22 92 113 74 39
> > Pmb 89 37 74 60 63 34 53 67 22 0 85 123 53 16
> > Pln 44 60 29 49 47 55 42 21 92 85 0 76 37 71
> > Png 38 81 49 86 89 99 63 58 113 123 76 0 75 108
> > Rbs 42 49 27 16 19 23 40 20 74 53 37 75 0 39
> > Rbd 76 52 61 46 49 21 50 53 39 16 71 108 39 0;
> >
> > and i want to set a subset N(j) = {j| t(i,j) > wich transport cost is 30 or less.
> >
> > Thanks for your help.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~--~---


Post Reply