Arc consistency 2026-10-25
A directed requirement for a binary constraint : every remaining has at least one support with . Revising the arc deletes unsupported values from ; it does not directly delete values from . Full arc consistency requires the condition in both directions on every edge of the constraint graph. On general graphs, it need not imply that a complete solution exists.
Constraint graph 2026-10-25
For a binary constraint satisfaction problem, the undirected graph with one vertex per variable and an edge for each variable pair sharing a binary constraint. Unary conditions restrict constraint domains but add no edges. A more general constraint can be represented in a primal constraint graph by joining every pair of variables in its scope; such edges do not make a genuinely many-variable constraint binary.
After restricting constraint domains, a binary constraint can become automatically satisfied for every remaining pair of values. Removing such constraints can reveal a tree and enable tree-structured constraint satisfaction.
Cutset conditioning 2026-10-25
Enumerate assignments to a cycle cutset, reject internal violations, filter all crossing binary constraints, and solve the residual forest by tree-structured constraint satisfaction. A full solution restricts to one enumerated cutset assignment; the residual tree passes preserve all its values. Conversely, a consistent cutset assignment combined with supported residual solutions satisfies every constraint. These observations prove completeness and soundness.
With variables, maximum constraint domain size and cutset size , there are at most assignments and residual tree work per assignment. Internal cutset and crossing-constraint tests require additional accounting. The method is attractive when a small cycle cutset is available.[ref]
Represent each original value choice by a Boolean variable and impose an exactly-one constraint for each original variable. For every forbidden tuple of a constraint with scope , add the Boolean clause . A complete original assignment satisfies every constraint exactly when its one-hot indicators satisfy all these Boolean clauses: each forbidden-tuple Boolean clause excludes precisely that joint choice. A satisfying assignment decodes by reading the unique true indicator for each original variable.
For constraint domain sizes , pairwise uniqueness requires Boolean clauses. If a constraint has forbidden tuples and arity , its contribution is Boolean clauses and literal occurrences. Thus bounded arity gives a polynomial-size encoding in explicitly listed domains, whereas enumerating a succinct high-arity relation can be exponential in its description length. Unit propagation on this encoding can be weaker than arc consistency on the original binary constraints.
Hidden-variable encoding 2026-10-25
Replace a finite many-variable relation by one auxiliary variable whose domain is the allowed tuples of , together with binary constraints equating each tuple coordinate to its corresponding . Any original satisfying assignment extends to exactly its allowed tuple, and any satisfying encoded assignment projects to a solution of . The tuple domain can be large; the transformation changes arity, not necessarily representation size efficiently when is succinct.
No-waste allocation 2026-10-24
For nonnegative additive valuations, the requirement that each allocated item be assigned to an agent who values it strictly positively. This condition alone does not require allocating every item.
Let and restrict agent 's constraint domain to subsets of , or to nonempty subsets when required. If , the two bundles are automatically disjoint and each agent values the other's bundle at zero. Both directional envy-free allocation binary constraints are then automatic. Thus positive-support overlaps determine which pairs can still matter in the residual constraint graph.
Let be the board squares and let mean that the absolute coordinate differences are or .
One variable per knight. Use , with each constraint domain equal to . For every pair , require
Every satisfying assignment places distinct nonattacking knights, and any such placement gives an assignment after labelling its knights. This has only variables and binary constraints, but domains of size . Relabelling the knights gives assignments for the same unlabelled board, so the representation contains considerable redundancy.
One Boolean variable per square. Use for every . Impose the cardinality constraint
and for every knight-attack pair impose . There are variables, each with a two-element constraint domain, and only local attack restrictions, because each square attacks at most eight others. The single counting constraint is a global constraint, not a binary constraint.
The square encoding avoids knight-label redundancy and has sparse local attack relations; the knight encoding uses fewer variables when is small and makes single-knight moves natural. Both are exact representations of the nonattacking knights problem. Neither may impose one knight per row: several knights can legally share a row.
Forward checking makes minimum remaining values respond to current restrictions rather than the original constraint domain sizes. After , its neighbors may have fewer choices, become forced or lose all choices. Minimum remaining values then selects the newly constrained variable early, while an empty constraint domain triggers immediate failure. The two mechanisms expose failure sooner and reduce wasted backtracking.
Forward checking only tests an unassigned neighbor against the newly assigned value. It need not check whether two still-unassigned variables have mutually supporting values. Arc consistency requires every value at either end of each binary constraint to have support in the other constraint domain, and AC-3 propagates deletions until this condition stabilizes or a constraint domain becomes empty.[ref]
For example, let initially have constraint domains with constraints and . Assigning makes forward checking reduce to , but leaves . Arc consistency also deletes from , leaving . Neither procedure alone decides every general constraint satisfaction problem: a triangle of two-valued inequalities satisfies arc consistency but is unsatisfiable.
One solution is . Use ascending value order; after minimum remaining values and the degree heuristic, break any remaining variable tie alphabetically. Apply the unary restrictions first:
Minimum remaining values selects , even though has greater initial vertex degree. Set . Forward checking removes from the three neighbors :
Now is the unique minimum remaining values choice. Set . Forward checking removes from , giving
Select and set . Its remaining neighbors are , so forward checking gives
The two remaining variables tie on constraint domain size and each has one unassigned neighbor, so the degree heuristic also ties. Alphabetical order selects ; take . Since is already absent from , forward checking makes no further deletion. Finally choose . No empty constraint domain or violation occurs, so this branch needs no backtracking.
All eight binary constraints are checked explicitly by the unequal value pairs
The unary restrictions also hold. Equalities and are permitted because those pairs have no edges in the constraint graph.
Use seven variables , with and every other constraint domain . Each conflict is a binary constraint .
The audience assumptions are part of the constraint satisfaction problem. Talks occupy whole common-length slots, room capacity and travel times impose no additional restrictions, and different CS year cohorts do not overlap. Physics attendees are treated as separate from those cohorts and the Head of Department. To protect possible society overlaps, assume society members occur in each relevant student cohort and that the Head of Department may also need to attend . No additional overlap between otherwise distinct audience groups is assumed. These are declared modelling choices, rather than claims about the actual membership of any group.
The shared-audience restrictions give the edge pairs
For example, the Head of Department's three introductions produce all three pairwise inequalities on ; the Physics audience gives . The possible society overlaps add
Together these thirteen inequalities and give a binary formulation. There is no need for an all-different constraint on all seven variables: compatible talks may run in parallel. At least two rooms suffice for the solution below.
If the Head of Department is stipulated not to attend , remove just ; the exhibited schedule remains valid. If actual society membership excludes a specified cohort, remove its corresponding additional conflicts too. This separation makes clear which restrictions are direct requirements and which protect assumed overlapping attendance.
Choose one global direction and impose it on every adjacent pair. Keep , introduce , and impose for each the relation
Because the same occurs everywhere, transitivity gives either a strictly increasing whole sequence or a strictly decreasing one. Choosing independently between and at each edge would merely require adjacent values to differ and would incorrectly allow zigzags.
If a binary formulation is required, replace each ternary relation by a hidden-variable encoding. Add a variable with domain
Use three binary constraints: the sign component of equals , its first numeric component equals , and its second equals . These enforce exactly the relation above while leaving the original variable domains unchanged. Each auxiliary domain has values.
For , the projected solutions in the original variables number when , and zero otherwise. In particular gives exactly and . For , direction is irrelevant and the projected solutions number , not .
The first assertion is true. Each deletion removes a value with no support in an adjacent constraint domain. If a complete solution still used that value, the solution’s neighboring value would supply exactly such a support, a contradiction. By mathematical induction, AC-3 never deletes a value used by an original solution. An empty constraint domain therefore proves that no solution exists.
The second assertion is false. Take three Boolean variables with constraint domains and the binary constraints , , . Every value has the opposite value as support across each edge, so AC-3 deletes nothing and returns true. Yet and imply , contradicting . Arc consistency checks local support, not compatibility of all supports in one complete assignment.
Figure 1.
Every value has pairwise support, but following the three inequality constraints makes a complete assignment impossible
. Details.
The third assertion is true under the usual explicit-input, constant-cost constraint-checking model. With variables, constrained pairs and maximum constraint domain size , AC-3 has time complexity in Big O notation. A revision costs ; each deletion can re-enqueue incoming arcs, and each constraint domain loses at most values, giving revisions including the initial arcs. For two-valued constraint domains, , so this is , linear in the explicit input size. This uses fixed-size relations, or already combined constant-time tests per pair. “Binary” normally describes constraint arity, not two-valued constraint domains; the latter restriction is the extra hypothesis needed here. As usual, initially empty constraint domains should be rejected before entering the algorithm, including isolated variables.
Write for the prescribed occupied cells, with . The source’s lowercase in its coordinate bound is read as the stated board size . If two prescribed queens already attack each other, no completion exists. Each model below correctly expresses that impossibility as well as consistent inputs.
Model 1: one Boolean variable per cell. Let indicate occupancy. Require
and impose for every two distinct cells sharing a row, a column or a diagonal. Equivalently, impose exactly one queen in each row and column and at most one on each diagonal. Explicit diagonal constraints are
Together with the total-count constraint and the attacking-pair binary constraints, these force exactly the intended boards. The count and diagonal-sum constraints are legitimate many-variable constraints; this model need not be binary.
Model 2: one variable per labeled queen. Let for . Enumerate and restrict for . For every , impose the binary constraint
There are exactly variables and distinct rows, so these are distinct queens. Labeling the prescribed queens does not lose a board completion: the queens are physically indistinguishable, and any completion can be labeled to give the prescribed ones those indices. It does create redundant assignments for the remaining labels.
Model 3: one variable per row. Let be the queen’s column in row . For every , require
and impose for every . These restrictions give queens, one per row; the all-different constraint on the columns gives one per column. For nonattacking queens on rows, exactly one per row is forced by the pigeonhole principle, so no solutions are lost. Inconsistent prescribed positions in a single row give incompatible unary restrictions. All three are exact constraint satisfaction problem encodings of the queens completion problem.
For fair division, let and let the additive valuation of agent be . Use one variable per agent, with constraint domain , the power set of the items. Empty bundles are permitted in this original formulation.
Require pairwise disjoint sets:
Each such binary constraint involves exactly . Require complete allocation by the single all-variable constraint
Finally impose the envy-free allocation binary constraints
each on . The two directions for a pair use different agents' additive valuations and must both hold. These conditions give precisely an ordered set partition of the items that is an envy-free allocation.
Before using no-waste allocation to restrict the constraint domains, there is one constraint graph vertex for each of . Every distinct pair has a disjointness binary constraint, and also the two directional envy-free allocation constraints. Thus the constraint graph is the complete graph , with all ten edges.
The nonempty-bundle and no-waste allocation requirements are unary and add no edges. The original all-item coverage constraint has been removed because this variant permits unallocated items.
Figure 1.
The allocation constraint graph before restricting the constraint domains
. Details.
Restrict each agent to nonempty bundles of items that they value positively. Let the positive-value supports be
The residual constraint domains are , with sizes , respectively. The no-waste allocation and nonempty-bundle requirements are now built into these constraint domains.
If , every pair , is disjoint. Moreover, , so both envy-free allocation inequalities hold automatically because all values are nonnegative. Thus all three binary constraints disappear for the pairs
The only positive-support overlaps, and hence the remaining constraint graph edges, are
where parentheses list the shared items.
Each listed pair really retains restrictions. For , , , , respectively, let both endpoints choose , , , : this violates disjointness while belonging to both residual constraint domains. The directional envy-free allocation inequalities are also individually nontrivial. For example, for , choosing and makes envious, while choosing and makes envious. The analogous shared-item comparisons apply on the other three edges.
Figure 1.
The residual allocation constraint graph; labels show shared positive-value items
. Details.
The residual constraint graph is a tree, rooted conveniently at , with children and with a child of . Solve it by the tree-structured constraint satisfaction algorithm: enforce arc consistency from children toward their parents, then choose a surviving root value and select supported child values in the opposite direction.
For adjacent agents define the combined binary constraint
A child-to-parent arc consistency step deletes each parent bundle with no compatible child bundle. Process the edges in the order , , , .
First, needs a nonempty subset of . Supporting reduces 's constraint domain to
Indeed, leaves only for but gives value ; and leave no possible item for . Each of the four retained choices has a compatible choice for .
Next, supporting reduces 's constraint domain to all nonempty subsets of . To see why item cannot remain in 's bundle, a disjoint compatible bundle from would have to be , but then values its own bundle at and 's at least at . Conversely any nonempty subset of is compatible with .
Supporting next reduces 's constraint domain to
If held item , disjointness would force , whose value is below 's value for 's bundle. If holds but not , then , and needs value at least to avoid envying . If holds neither, supports every nonempty subset of .
Finally, supporting leaves
The removed choices contained both and , leaving no item for . Every displayed choice has a compatible choice for .
Choose , then supported child values, giving
Items remain unallocated, which this variant expressly permits. To check every envy-free allocation inequality, the matrix of agents' additive valuations of these bundles, with rows and columns both ordered , is
Each diagonal entry is at least every entry in its row. The bundles are nonempty, pairwise disjoint, and contain only positively valued items, so all remaining requirements hold.
Why does selecting supported children suffice? The residual constraint graph has no graph cycle, so different child subtrees have no constraints between them. Child-to-parent arc consistency has already ensured a compatible continuation below every retained parent value. Applying this observation recursively proves that the downward choices complete a solution without backtracking. With variables and maximum constraint domain size , the basic compatibility checks require time complexity in Big O notation, counting each binary constraint evaluation as one operation; evaluating bundle sums has its own input-dependent cost.
A binary constraint satisfaction problem whose constraint graph is a tree. Restrict constraint domains by unary conditions first. Choose a rooted tree orientation and process children before parents. For each child of , retain in only values having a compatible value in the already reduced . Thus every retained parent value has support in each child subtree.
If the root constraint domain becomes empty, no solution exists. Otherwise choose any root value, then recursively choose supported child values. A child-to-parent arc consistency pass need not enforce full arc consistency in both directions; the chosen directional condition suffices for this construction.
The proof uses mathematical induction on subtrees. A retained leaf value satisfies its unary requirements. Each retained parent value has a supported value in every child subtree. Those subtree solutions can be combined because the tree has no edges between different child subtrees. Therefore every retained parent value extends to a whole subtree solution, and every retained root value extends to a complete solution without backtracking.
For variables and maximum constraint domain size , scanning all value pairs once per edge costs time complexity in Big O notation, when one binary constraint evaluation has unit cost. If a constraint requires summing bundle values, its evaluation cost must also be counted.