there is a set "1,2,3,4,5". i wanna write constraints for subsets of this set. for example
x1=1,
x2=1,
x3=1,
x4=1,
x5=1,
x1+x2=2,
x1+x3=2,
x1+x4=2,
x1+x5=2,
x2+x3=2,
x2+x4=2,
x2+x5=2,
x3+x4=2,
x3+x5=2,
x4+x5=2,
x1+x2+x3=3,
x1+x2+x4=3,
x1+x2+x5=3,
x1+x3+x4=3,
x1+x3+x5=3,
x1+x4+x5=3,
x2+x3+x4=3,
x2+x3+x5=3,
x2+x4+x5=3,
.
.
.
Topic

Re: Writing constraints for subsets of a set.
20130101T23:26:48ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121230T21:40:03Z
:) how can i write these constraints (in closed format) by using subsets of this set?
Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe) 
Re: Writing constraints for subsets of a set.
20130103T09:30:18ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20130101T23:26:48Z
In what language are you programming? If it's OPL, you'll have better luck asking on the OPL forum. If it's a general purpose language for which CPLEX has an API (C, C++, Java, Python), there are a few ways to do it, revolving around your favorite way to compute the powerset of a set of integers. If it's MATLAB, there may be a clever way, but you'll need a MATLAB user to tell you (which lets me out).
Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)