Constraint with 9 or more IntVars

  • David Torres

    David Torres - 2012-08-14

    hello there,

    I have  a problem, i need to know how to implement a constraint with 9 intVars, for a example  i have a+b+c+d+f+g+h+i<1000, how do i do that on Jacop?

  • Graeme

    Graeme - 2012-08-15

    You can use the Sum constraint to do this. For example if vars is an array of IntVar:-

    store.impose( new Sum(vars,total));
    store.impose( new XlteqC(total, 1000));

    Will ensure that the total of all the elements of vars is kept in total, and this is <= 1000.

  • David Torres

    David Torres - 2012-08-16

    Thanks, i appreciate yor help.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks