Topic
  • 4 replies
  • Latest Post - ‏2013-01-03T09:30:18Z by SystemAdmin
SystemAdmin
SystemAdmin
754 Posts

Pinned topic Writing constraints for subsets of a set.

‏2012-12-30T09:48:21Z |
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,
.
.
.
Updated on 2013-01-03T09:30:18Z at 2013-01-03T09:30:18Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    754 Posts

    Re: Writing constraints for subsets of a set.

    ‏2012-12-30T21:25:06Z  
    Okay.
  • SystemAdmin
    SystemAdmin
    754 Posts

    Re: Writing constraints for subsets of a set.

    ‏2012-12-30T21:40:03Z  
    :) how can i write these constraints (in closed format) by using subsets of this set?
  • SystemAdmin
    SystemAdmin
    754 Posts

    Re: Writing constraints for subsets of a set.

    ‏2013-01-01T23:26:48Z  
    :) how can i write these constraints (in closed format) by using subsets of this set?
    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)
  • SystemAdmin
    SystemAdmin
    754 Posts

    Re: Writing constraints for subsets of a set.

    ‏2013-01-03T09:30:18Z  
    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)
    sir thanks for your help. i am usin OPL. so i'll open a new thread on OPL forum. i'm new at all these :)