Constraint Programming (CP) is a declarative paradigm for solving combinatorial problems: you describe the problem — the decision variables, the values they may take, and the constraints relating them — and a general-purpose solver searches for assignments that satisfy every constraint (and, optionally, optimise an objective). You model what a valid solution looks like; the solver works out how to find one.
That focus makes CP especially strong on tightly-constrained, discrete problems — scheduling, rostering, timetabling, sequencing, configuration, and resource allocation — where the hard part is satisfying a thicket of interacting rules rather than optimising a smooth numeric objective.
Formally, a Constraint Satisfaction Problem (CSP) is a triple (X, D, C):
A solution assigns every variable a value from its domain such that all constraints hold. Attach an objective function to minimise or maximise and the CSP becomes a Constraint Optimisation Problem (COP).
Textbook problems — map colouring, the n-queens puzzle, Sudoku — make the model concrete, but the industrial payoff is in scheduling, employee rostering, school and exam timetabling, vehicle routing, product configuration, and cutting/packing.
CP interleaves inference (propagation) with search (branching), backtracking whenever it hits a dead end.
How hard the engine tries to prune is its consistency level: node consistency, arc consistency (the classic AC-3 algorithm), bounds consistency, and generalised arc consistency (GAC) for global constraints. Because CP search is systematic, it is complete — given enough time it can prove optimality, or prove that no solution exists at all, which local-search methods cannot.
Global constraints capture complex structural properties of a problem, enabling highly efficient propagation.
A solver's library of global constraints — and how strongly each one propagates — is a major differentiator between tools.
Understanding CP means knowing where it sits among neighbouring techniques:
A practical rule of thumb: reach for CP when the problem is highly combinatorial and rule-dense (scheduling, sequencing, rostering); reach for MIP when it is numeric and well-relaxed. Many modern solvers deliberately blur the line.
The workflow is model-and-solve: express variables and constraints in a modelling layer, then let the solver search.
CHOOSE_MIN_DOMAIN_SIZE — the "fail-first" principle) steers the solver toward contradictions earlier, speeding up the proof of optimality.Problem: 10 jobs must be processed on 5 shared machines. Each job has a specific sequence and duration.
start_time_job_i_machine_j.IntervalVar on each machine ensures a machine only does one job at a time.start_time_task_2 >= end_time_task_1.A defining strength of CP is the separation of model from solver: one high-level model can often run on several back-end engines. The landscape splits into modelling languages, open-source solvers, and commercial solvers.
— a free, solver-independent constraint-modelling language. Write the model once; MiniZinc compiles it to FlatZinc and runs it on any supported back end (Gecode, Chuffed, OR-Tools, CP Optimizer, …). The best place for a newcomer to start.cp_model in Python/C++/Java/C#, Choco's Java API, and so on).
— the dominant modern CP solver. Free, Apache-licensed, lazy-clause-generation/SAT-based, with first-class Python, C++, Java, and C# APIs. The pragmatic default for most new CP work.
— a fast, well-documented C++ CP library and a standard MiniZinc back end.
— a mature Java CP library widely used in research and on the JVM.
— a lazy-clause-generation solver that regularly tops the MiniZinc Challenge.
— the flagship commercial CP solver, part of CPLEX Optimization Studio. Particularly strong on scheduling thanks to rich interval-variable and sequence modelling, with an automatic search that needs little hand-tuning. Free academic and community editions are available.
(formerly LocalSolver) — a commercial "model-and-run" optimiser that tackles large constraint-based combinatorial and routing models with minimal solver tuning.
— a commercial Prolog with a mature CLP(FD) finite-domain constraint library, reflecting CP's roots in constraint logic programming.Adjacent tooling. Planning libraries such as Timefold
(the successor to OptaPlanner) solve constraint-rich scheduling and rostering problems via local search and "constraint streams." They are not classical propagation-based CP, but they target the same family of problems and often surface in the same searches.
What is constraint programming? A declarative paradigm for combinatorial problem-solving: you state decision variables, their possible values (domains), and the constraints relating them, and a solver searches for assignments satisfying all constraints — optionally optimising an objective. You model the problem rather than code the search.
Constraint programming vs linear / integer programming — what's the difference? MIP/LP relaxes integer requirements to a continuous problem and searches with linear-programming bounds, excelling when the problem has a strong linear relaxation. CP works directly on discrete domains via propagation and search, excelling on scheduling, sequencing, and feasibility-heavy problems. Modern solvers increasingly combine both.
What is the best constraint programming solver? For most new projects, Google OR-Tools CP-SAT (free, fast, well-supported) is the pragmatic default. IBM ILOG CP Optimizer is the leading commercial option, especially for scheduling. MiniZinc is the best way to learn and to stay solver-independent.
Is constraint programming only for scheduling? No. Scheduling and rostering are flagship use cases, but CP also handles timetabling, vehicle routing, configuration, resource allocation, and cutting/packing — any tightly-constrained, discrete problem.
See Also: