Topic
1 reply Latest Post - ‏2012-11-13T14:56:01Z by ol
SystemAdmin
SystemAdmin
554 Posts
ACCEPTED ANSWER

Pinned topic Global cardinality constraint with ranges

‏2012-11-12T23:28:20Z |
Hi,

does CP Optimizer somehow offer the ability to define the following global cardinality constraint?

count( | P >= x | >= n )

... that is, is there a way to constraint the number of variables P that take values greater than or equal to a value x to greater than or equal to the number n ?

IloDistribute doesn't seem to be able to do it -- do I have to implement my own global constraint to do this?

Thanks!
Updated on 2012-11-13T14:56:01Z at 2012-11-13T14:56:01Z by ol
  • ol
    ol
    53 Posts
    ACCEPTED ANSWER

    Re: Global cardinality constraint with ranges

    ‏2012-11-13T14:56:01Z  in response to SystemAdmin
    Hello,
    you want the number of Pi greater or equal than value x to be greater or equal than n: count( | P >= x |) >= n.
    You can introduce an array of 0-1 variables, Q, s.t. Qi = (Pi >= x)
    Then you can express your constraint by: sum(Q) >= n. No need to use count() or distribute() here.
    Regards,
    ol