Generalizing AllDifferent: The SomeDifferent Constraint

  • Yossi Richter
  • Ari Freund
  • Yehuda Naveh
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4204)


We introduce the SomeDifferent constraint as a generalization of AllDifferent. SomeDifferent requires that values assigned to some pairs of variables will be different. It has many practical applications. For example, in workforce management, it may enforce the requirement that the same worker is not assigned to two jobs which are overlapping in time. Propagation of the constraint for hyper-arc consistency is NP hard. We present a propagation algorithm with worst case time complexity O(n 3 β n ) where n is the number of variables and β≈3.5 (ignoring a trivial dependence on the representation of the domains). We also elaborate on several heuristics which greatly reduce the algorithm’s running time in practice. We provide experimental results, obtained on a real-world workforce management problem and on synthetic data, which demonstrate the feasibility of our approach.


Chromatic Number Constraint Programming Constraint Satisfaction Problem Graph Coloring Giant Component 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Appa, G., Magos, D., Mourtos, I.: On the system of two all_different predicates. Info. Process. Letters 94(3), 99–105 (2005)MATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Barnier, N., Brisset, P.: Graph coloring for air traffic flow management. In: Proc. of 4th CP-AI-OR workshop, pp. 133–147 (2002)Google Scholar
  3. 3.
    Beigel, R., Eppstein, D.: 3-coloring in time O(1.3289n). J. of Algorithms 54(2), 168–204 (2005)MATHCrossRefMathSciNetGoogle Scholar
  4. 4.
    Bodlaender, H.L., Kratsch, D.: An exact algorithm for graph coloring with polynomial memory. Technical Report UU-CS-2006-015. Department of Information and Computing Sciences. Utrecht University (2006)Google Scholar
  5. 5.
    Brelaz, D.: New methods to color the vertices of a graph. Communication of ACM 22(4), 251–256 (1979)MATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Byskov, J.M.: Exact algorithms for graph colouring and exact satisfiability. Ph.D thesis, University of Aarhus, Aarhus, Denmark (2005)Google Scholar
  7. 7.
    Dechter, R.: Constraint Processing. Morgan Kaufmann Publishers, San Francisco (2003)Google Scholar
  8. 8.
    Eppstein, D.: Small maximal independent sets and faster excat graph coloring. J. Graph Algorithms and Applications 7(2), 131–140 (2003)MATHMathSciNetGoogle Scholar
  9. 9.
    Grönkvist, M.: A constraint programming model for tail assignment. In: Proc. of 1st CP-AI-OR Conf., pp. 142–156 (2004)Google Scholar
  10. 10.
    Klotz, W.: Graph coloring algorithms. Technical Report Mathematik-Bericht 2002/5 TU Clausthal (2002)Google Scholar
  11. 11.
    Lawler, E.L.: A note on the complexity of the chromatic number problem. Info. Process. Letters 5(3), 66–67 (1976)MATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Naveh, Y., Emek, R.: Random stimuli generation for functional hardware verification as a cp application. In: van Beek, P. (ed.) CP 2005. LNCS, vol. 3709, pp. 882–882. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  13. 13.
    Quimper, C.-G., van Beek, P., López-Ortiz, A., Golynski, A., Sadjad, S.B.S.: An efficient bounds consistency algorithm for the global cardinality constraint. In: Rossi, F. (ed.) CP 2003. LNCS, vol. 2833, pp. 600–614. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  14. 14.
    Régin, J.-C.: A filtering algorithm for constraints of difference in CSPs. Technical Report R.R.LIRMM 93-068; (1993) Conf. version at AAAI 1994Google Scholar
  15. 15.
    Sellmann, M.: Approximated Consistency for Knapsack Constraints. In: Rossi, F. (ed.) CP 2003. LNCS, vol. 2833, pp. 679–693. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  16. 16.
    Sellmann, M.: Cost-based filtering for shorter path constraints. In: Rossi, F. (ed.) CP 2003. LNCS, vol. 2833, pp. 694–708. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  17. 17.
    Sellmann, M.: Approximated consistency for the automatic recording problem. In: van Beek, P. (ed.) CP 2005. LNCS, vol. 3709, pp. 822–826. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  18. 18.
    Tsang, E., Ford, J., Mills, P., Bradwell, R., Williams, R., Scott, P.: ZDC-rostering: A personnel scheduling system based on constraint programming. Technical Report 406, University of Essex, Colchester, UK (2004)Google Scholar
  19. 19.
    van Hoeve, W.-J.: The Alldifferent constraint: a systematic overview. Under construction (2006),
  20. 20.
    West, D.B.: Introduction to graph theory. Prentice Hall, Englewood Cliffs (2000)Google Scholar
  21. 21.
    Yang, R.: Solving a workforce management problem with constraint programming. In: The 2nd International Conference on the Practical Application of Constraint Technology, pp. 373–387, The Practical Application Company Ltd. (1996)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Yossi Richter
    • 1
  • Ari Freund
    • 1
  • Yehuda Naveh
    • 1
  1. 1.IBM Haifa Research Lab, Haifa University CampusHaifaIsrael

Personalised recommendations