1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | language Essence 1.3 $ Problem Number Partition $ $ Problem details available at http://www.csplib.org/Problems/prob049/ $ $ Essence model by Andrew Martin $ $ Licenced under CC-BY-4.0 : http://creativecommons.org/licenses/by/4.0/ given n : int (1..) where n%2 = 0 letting dNum be domain int (1..n) $ find sets (cardinality is enforced by size) find setA: set ( size n/2) of dNum find setB: set ( size n/2) of dNum such that $ setlist must include all elements in dNum |setA union setB| = n , $ cannot share any elements |setA intersect setB| = 0 , $ constraints from problem ( sum i in setA . i) = ( sum i in setB . i) , ( sum i in setA . i*i) = ( sum i in setB . i*i) |