High-Level Nondeterministic Abstractions in C++ Laurent Michel 1 , Andrew See 1 , and Pascal Van Hentenryck 2 1 University of Connecticut, Storrs, CT 06269-2155 2 Brown University, Box 1910, Providence, RI 02912 Abstract. This paper presents high-level abstractions for nondetermin- istic search in C++ which provide the counterpart to advanced features found in recent constraint languages. The abstractions have several bene- fits: they explicitly highlight the nondeterministic nature of the code, pro- vide a natural iterative style, simplify debugging, and are efficiently im- plementable using macros and continuations. Their efficiency is demon- strated by comparing their performance with the C++ library Gecode, both for programming search procedures and search engines. 1 Introduction The ability to specify search procedures has been a fundamental asset of con- straint programming languages since their inception (e.g., [1, 3, 13]) and a dif- ferentiator compared to earlier tools such as Alice [7] and MIP systems where search was hard-coded in the solver. Indeed, by programming the search, users may define problem-specific branching procedures and heuristics, exploit uncon- ventional search strategies, break symmetries dynamically, and specify termina- tion criteria for the problem at hand. The last two decades have also witnessed significant progress in this area (e.g., [6, 8, 9, 12, 14, 15]): Modern constraint pro- gramming languages enable programmers to specify both the search tree and the search strategy, provide high-level nondeterministic abstractions with dynamic filtering and ordering, and support hybrid and heuristic search. The embedding of constraint programming in mainstream languages such as C++ has also been a fundamental step in its acceptance, especially in indus- try. With constraint programming libraries, practitioners may use familiar lan- guages and environments, which also simplifies the integration of a constraint programming solution within a larger application. Ilog Solver [10] is the pio- neering system in this respect: it showed how the nondeterministic abstractions of constraint logic programming (e.g., goals, disjunction, and conjunction) can be naturally mapped into C++ objects. To specify a search procedure, users thus define C++ objects called goals, and combine them with logical connectives such as or and and. In recent years, constraint programming libraries have been en- hanced to accommodate search strategies [9, 4] (originally proposed in Oz [12]) and high-level nondeterministic abstractions [8] (originally from OPL [14]). However these libraries, while widely successful, still have two inconveniences as far as specifying search procedures. On the one hand, they impose a recur- sive style for search procedures, which contrasts with the more familiar itera- tive constructs of OPL as indicated in [2]. Second, these libraries may obscure