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.
The constraint graph has vertices and the thirteen edges listed in (a). The following original drawing distinguishes named shared-audience edges from the additional society-overlap edges. Vertex colours show one valid slot assignment; they are not extra constraints.
Figure 1.
The scheduling constraint graph with direct conflicts and explicitly assumed society overlaps
. Details.
The unary restriction is a constraint domain restriction and adds no edge. For reference, is adjacent to every other vertex; among the remaining vertices there is a triangle , a cycle , and the edge .
A solution is . Here is a backtracking search with forward checking, listing the chosen value order rather than assuming ascending values. No backtrack is needed on this branch.
Start with the constraint domains in (a). Assign ; remove from . Choose ; remove from each remaining neighbour. Now both have domain and each have . Choose . Its inequality removes from , forcing , and also removes from , leaving . Assigning removes from , leaving .
Choose . The edge reduces to ; makes no further deletion because is already absent from . Choose and then . All variables are assigned, and every constrained pair has different values.
In time order, the schedule is
SlotTalks in parallel
The Head of Department attends slots for ; first-year attendees see in slots ; second-year attendees see in ; the third-year Keble group sees in ; Physics attendees see in . Slot is free of every competing talk, so all assumed society overlaps are respected.
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.
Interpret MyAC as doing at least one initial sweep, then repeating while the preceding sweep deleted a value. Its loop guard otherwise has no initialized truth condition. Both procedures apply the same support-based deletion rule, so both preserve every solution and terminate because finite constraint domains only shrink. Both return false on a detected empty constraint domain; neither successful return establishes satisfiability.
If a sweep changes no constraint domain, every directed arc has been revised against unchanged constraint domains, so all arcs satisfy arc consistency. Conversely, AC-3 places every potentially affected incoming arc back on its work list after a deletion. Its empty work list therefore also establishes arc consistency. When both run to successful completion, they compute the same arc-consistency closure, independently of revision order. To see maximality, any subdomains of the initial constraint domains that satisfy arc consistency survive every revision: each of their values retains a support inside those subdomains. Thus neither procedure can delete a value belonging to any such fixed point. Early failure may leave different intermediate constraint domains, but both failures correctly prove impossibility.
Their scheduling costs differ. AC-3 directs work toward arcs that may have lost supports, with standard time complexity . The full-sweep arc consistency method revisits all arcs after even one remote change. There are at most value deletions, so at most sweeps; a direct implementation including a scan for empty constraint domains costs
If empty-domain detection is maintained during revisions rather than rescanned, the familiar comparison is versus , apart from initialization. These are upper bounds, not exact costs on every input.
In practice MyAC is simple and may have low overhead or benefit from a fortunate sweep order. It can also waste many scans after changes propagate slowly opposite to that order. AC-3 incurs work-list bookkeeping but normally avoids those unrelated revisions. Both inherit the inability of arc consistency to decide arbitrary constraint satisfaction problems.
The conventional worst-case estimate is the backtracking leaf bound given by the product of the initial constraint domain sizes. Before exploiting any attacking-queen constraints, the three models give respectively
Model 1 has binary choices. Model 2 has labeled queens with possible cells each. Model 3 has row variables with possible columns each. The rule of product gives the displayed bounds; assigning variables in one prescribed order avoids multiplying again by the number of variable orderings.
With mutually nonattacking prescribed queens incorporated as singleton constraint domains, the corresponding bounds improve to
In Model 1 only the prescribed occupied cells have been fixed in this estimate; immediate deletion of attacked cells tightens it further. In Model 3 consistent clues occupy distinct rows. If the clues are inconsistent, preprocessing can reject the instance immediately.
These are upper bounds on leaves, rather than exact attained counts for a fully specified pruning implementation. Ordinary backtracking rejects inconsistent partial assignments and often creates far fewer leaves; a stopped branch is itself a leaf even if not all variables were assigned. Such early leaves still obey the backtracking leaf bound, since distinct leaves describe disjoint nonempty families of full domain assignments when constraints are ignored. Counting only possible complete nonattacking assignments is a different question. For example, row/column restrictions alone reduce full assignments to at most in Model 3, but that number does not directly count failed partial leaves. Exact counts depend on variable ordering and constraint propagation, neither of which is specified.
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.
Use one variable per item, with constraint domain . Its value is the recipient agent. Every assignment automatically allocates each item exactly once, so separate coverage and disjointness constraints are unnecessary.
For every ordered pair , impose
Here is an indicator function. The constraint involves every with ; one may formally give it scope , since zero coefficients make the other variables irrelevant. These constraints state envy-free allocation using the comparing agent's additive valuation on both sides. In contrast to part (a), they generally involve more than two variables.
With agent variables, each constraint domain has cardinality . Their total number of listed domain values is , while the Cartesian product of the domains has
complete assignments before constraints.
With item variables, each constraint domain has cardinality . Their total number of listed domain values is , while their Cartesian product has
complete assignments. These are raw domain-space sizes. The larger agent-variable space includes overlaps and missing items; imposing the allocation constraints reduces it to the same actual complete allocations represented directly by item variables.
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.
Queens completion problem 2026-10-25
Complete a prescribed subset of occupied cells to a solution of the N-queens problem while retaining every prescribed queen. In a row-variable constraint satisfaction problem, a clue gives the singleton constraint domain . Conflicting clues prove impossibility immediately, but nonattacking clues need not extend to a full solution. Backtracking decides the finite problem; hill climbing can search large candidate boards without an exhaustive guarantee.
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.
Unary constraint 2026-10-25
A restriction on the value of one variable. In a finite-domain constraint satisfaction problem, it can be applied by deleting disallowed values from that variable's constraint domain before search. It introduces no edge in the binary constraint graph.