Constraint Programming: Combinatorial Inference

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.

1. The model: constraint satisfaction problems

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.

2. How CP solves: propagate, branch, backtrack

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.

3. Global constraints: the power of CP

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.

5. Modeling and solving in practice

The workflow is model-and-solve: express variables and constraints in a modelling layer, then let the solver search.

6. Worked example: job-shop scheduling

Problem: 10 jobs must be processed on 5 shared machines. Each job has a specific sequence and duration.

7. Tools and solvers

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.

Modelling languages

Open-source solvers (free — ideal for learning)

Commercial solvers

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.

8. Where to learn more

Frequently Asked Questions

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: