Minion: A Fast, Scalable, Constraint Solver 1 Ian P. Gent 2 and Chris Jefferson 3 and Ian Miguel 2 Abstract. We present Minion, a new constraint solver. Em- pirical results on standard benchmarks show orders of magni- tude performance gains over state-of-the-art constraint toolk- its. These gains increase with problem size – Minion delivers scalable constraint solving. Minion is a general-purpose con- straint solver, with an expressive input language based on the common constraint modelling device of matrix models. Focussing on matrix models supports a highly-optimised im- plementation, exploiting the properties of modern processors. This contrasts with current constraint toolkits, which, in or- der to provide ever more modelling and solving options, have become progressively more complex at the cost of both per- formance and usability. Minion is a black box from the user point of view, deliberately providing few options. This, com- bined with its raw speed, makes Minion a substantial step to- wards Puget’s ‘Model and Run’ constraint solving paradigm. 1 Introduction Constraint programming supports the solution of combinato- rial problems in two stages. First, by characterising or mod- elling them by a set of constraints on decision variables that their solutions must satisfy. Second, by searching for solutions with a constraint solver: assignments to the decision vari- ables that satisfy all constraints. The success of constraint programming is based upon its flexibility and expressivity; constraints provide a rich language allowing most problems to be expressed straightforwardly once the model is selected. Modern constraint solving techniques are typically provided to users in the form of constraint toolkits. These are libraries for programming languages such as C++ (e.g. ILOG Solver, GeCode), Java (e.g. Choco, Koalog) or Prolog (e.g. Eclipse, Sicstus). This approach supports a high degree of customi- sation. For example, it is usually possible for users to add propagation rules for an as-yet undefined constraint to the li- brary. When such additions prove to be generally useful, they are often included in future versions of the popular constraint toolkits. Hence, as Puget pointed out [19], constraint toolkits have become increasingly complex in an effort to provide ever more functionality. The result is that constraint programming for large, realistic problems requires a great deal of exper- tise and fine tuning. Furthermore, to provide this flexibility, 1 We thank Angela Miguel, Karen Petrie, Judith Underwood and ECAI’s referees. Supported by EPSRC Grant GR/S30580 and a Royal Academy of Engineering/EPSRC Research Fellowship. 2 School of Computer Science, University of St Andrews, St An- drews, Fife, KY16 9SS, UK. {ipg,ianm}@dcs.st-and.ac.uk 3 Oxford University Computing Laboratory, University of Oxford, Oxford, UK. chris.jefferson@comlab.ox.ac.uk. Research un- dertaken while at St Andrews University. toolkits have a necessarily complex internal architecture. This results in large overheads in many parts of the solver, with a detrimental effect on efficiency and scalability. Puget suggests that today’s constraint toolkits are far too complex to achieve widespread acceptance and use [19]. He advocates a ‘model and run’ paradigm for constraints simi- lar to that achieved by propositional satisfiability (SAT) and mathematical programming (MP). Our hypothesis is that we can achieve this by taking two important steps. The first step is to supply constraint solvers (instead of toolkits) that ac- cept models rather than programs. These solvers should be black boxes that reduce the bewildering array of options pro- vided by constraint toolkits to a select few. Furthermore, the reliance of constraint programming on heavy fine tuning to achieve an acceptable level of performance is in conflict with ‘model and run’. The second step is therefore to create fast constraint solvers that promote implementation efficiency. Ef- ficiency in turn will reduce the sensitivity of performance to minute parameter changes. Fast solvers will also be more scal- able to large constraint problems. This methodology follows the closely-related fields of propositional SAT and MP where solvers scale to very large problems, and where ‘model and run’ is absolutely standard. To test our hypothesis, we have built a fast and scalable constraint solver, named Minion. Throughout, Minion has been optimised for solving large and hard problems. Experi- mental results show that Minion typically runs between 10 and 100 times faster than state-of-the-art constraint toolkits such as ILOG Solver and GeCode on large, hard problems. On smaller problems or instances where solutions are found with little search, gains are less impressive. Minion takes an expressive input language for matrix models over integer do- mains, allowing a variety of fundamental constraints such as all-different, sum, reification, and others. A number of our design decisions are modelled on those of zChaff, which rev- olutionised modern SAT solving [22]. In particular, we paid special attention to using very small data structures, mak- ing memory usage very small and greatly increasing speed on modern computer architectures. 2 Background A constraint satisfaction problem (CSP [3]) is a set of decision variables, each with an associated domain of potential values, and a set of constraints. An assignment maps a variable to a value from its domain. Each constraint specifies allowed com- binations of assignments of values to a subset of the variables. A solution is an assignment to all the variables that satisfies all the constraints. A constrained optimisation problem is a