Subset containing elements not in other subset

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

Subset containing elements not in other subset

Post by Archiver »


Dear all:

What is a suggested syntax to accomplish this:

sets e,a(e),b(e),c(e);

a(e)=(ord(efm)....)$YES
b(e)=(ord(efm)=.....)$YES;

(This syntax is not accepted, but shows what I want to do:)

c(e)=e$yes+a(e)$no+b(e)$no;

Basically, c(e) needs to have those elements in set e that are not members of subsets a(e) or b(e).

Thanks in advance !

Regards
Claudio

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Subset containing elements not in other subset

Post by Archiver »

Claudio,

Is this what you're trying to do?

-Steve

sets
e / e1 * e10 /,
a(e), b(e)
c(e) 'e - a - b'
;
scalars lo /2/, up /6/;

a(e) = (ord(e) up);
b(e) = (ord(e) = lo) or (ord(e) = up);
c(e) = not(a(e)) and not(b(e));


parameter chk(e);
chk(e) = 1 - 1$a(e) - 1$b(e) - 1$c(e);
abort$[card(chk)] 'partition iff chk is zero here', chk, a, b, c;

* this is only a necessary condition, and not so useful for pinpointing the violation
abort$[card(e) (card(a)+card(b)+card(c))] 'bad partition';


On Mon, Feb 1, 2016 at 8:41 AM, Claudio Delpino wrote:

Dear all:

What is a suggested syntax to accomplish this:

sets e,a(e),b(e),c(e);

a(e)=(ord(efm)....)$YES
b(e)=(ord(efm)=.....)$YES;

(This syntax is not accepted, but shows what I want to do:)

c(e)=e$yes+a(e)$no+b(e)$no;

Basically, c(e) needs to have those elements in set e that are not members of subsets a(e) or b(e).

Thanks in advance !

Regards
Claudio

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.




--
Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Subset containing elements not in other subset

Post by Archiver »


Steve: This was precisely what I was trying to do. I wasn't aware you could just declare subset membership like that. Thanks!!!!

On Mon, Feb 1, 2016 at 10:41 AM, Claudio Delpino wrote:

Dear all:

What is a suggested syntax to accomplish this:

sets e,a(e),b(e),c(e);

a(e)=(ord(efm)....)$YES
b(e)=(ord(efm)=.....)$YES;

(This syntax is not accepted, but shows what I want to do:)

c(e)=e$yes+a(e)$no+b(e)$no;

Basically, c(e) needs to have those elements in set e that are not members of subsets a(e) or b(e).

Thanks in advance !

Regards
Claudio


--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Post Reply