User:Tizio/Csp

Definitions
Constraint: variables + relation. In most cases, constraints are of a predefined form (numerical inequalities, Boolean), but the most general formulation is that a single constraint comprises both the list of variables and the relation, which is a set of tuples of values the variables can take.

Every variable is associated a domain, which can also be seen as a unary constraint.

If a csp does not contain a constraint on some variables, it is implicitly assumed to contain the constraint with all tuples allowed. This is important because sometimes Rij is used even if there is no constraint between variables xi and xj

(D) Consistent partial instantiation/partial solution=assigment to some variables that satisfy all constraints whose variables are all assigned. In other words, constraints that have one or more unassigned variables are not considered.

(MS) partial solution=a part of a solution (part of an assignmen to all variables that satisfies all constraints)

(MS) domain=assignment of a set to each variable; false domain=one that assigns the empty set to some variables

(MS) arc consistency is defined relative to a specific constraint (not relative to two variables)

Extended composition
Given a set of constraints and a subset of their variables, their extended composition is the constraint that has the set of variables as a scope, and is satisfied by a tuple if there exists an extension of the tuple on all variables of the constraints that satisfies all constraints.

Binary projection network
Binary projection network: given a constraint, its projection network is made of all Pij obtained by projecting the original constraint over the variables ij. This network includes all solutions of the original problem. Moreover, it is the tightest network with this property, where the "tighter than" relation on a pair of network is defined by comparing every Rij in both networks. Note that this definition is about the single constraint over pairs of variables, not over the projected relations.

Inference
Constraint inference: creation of new constraints (or tightening of old ones). As an example, the composition of two constraints Rxy and Ryz is defined as the constraint Rxz that contains all pairs (a,b) such that there exists a value c such that Rxy contains (a,c) and Ryz contains (c,b).

Backjumping
When finding out that x_1...x_k=a_1...a_k is inconsistent with any possible evaluation of xk+1, backtracking simply goes back to xk and changes its value from ak to the next to be checked. However, it may be that x_1..x_i=a1..ai is already inconsistent with any evaluation of xk+1 for some i<k. If this is the case, one can simply go back to xi and change its value (possibly backtracking if no other value is to be checked.)

A warning about what "inconsistent" means. It can be interpreted in various ways, but only the first interpretation is used here:


 * 1) a partial solution is inconsistent if it violates a constraint; only constraints over the evaluated variables are considered;
 * 2) the condition used by the algorithm for checking partial evaluations without evaluating any more variable; it is a sufficient condition for a partial evaluation not to satisfy the constraints, such as the consistency of constraints containing only the evaluated variables, but may also include the same condition plus arc consistency, etc.
 * 3) the condition where the algorithm has tried to find a solution extending a partial evaluation (possibly by evaluating new variables) but failed;
 * 4) the condition that a partial solution is not part of a solution

Some definitions:


 * conflict set : a consistent evaluation of some variables that is inconsistent with every value of another variable x is a conflict set for x; minimal conflict set=removing any variable inconsistency disappears;
 * inconsistency is defined as in the first definition above;
 * dead end state : the state of backtracking where the evaluation x_1...x_k=a_1...a_k is consistent but every extension with a value for x_k+1 has been tried without finding a solution;
 * conflict sets are based on inconsistency (first definition above) while this definition is based on the algorithm trying and failing to find a solution (second definition above);
 * leaf dead end : is a dead end where x_1...x_k=a_1...a_k is inconsistent with every evaluation of x_k;
 * inconsistency is the specific condition used by the algorithm (first definition above);
 * this is also a dead end, which is defined in terms of the second definition above;
 * it is a leaf of the search tree;
 * no-good : a partial evaluation that is not part of any solution;
 * semantic condition (third definition above)
 * safe jump : for a leaf dead end state x_1..x_k=a_1..a_k, a safe jump is an index j<k such that a_1...a_j is a no-good

Note that the definition of no-goods explicitely refers to the solutions of a problem. The algorithms obviously do not have access to this set. An algorithm may be able to prove that a partial evaluation is a no-good, but cannot for sure establish that a partial evaluation is not a no-good (that would require finding a solution.)

In other words, no-goods are purely semantical (they refer to the solution), while the algorithm can only be sure that an evaluation is a no-good but not that an evaluation is not a no-good. As a result, an algorithm can establish that a jump is safe, but cannot in general be sure that the jump is maximally safe. For example, in a state where the safe jumps are from 3 on, an algorithm may only be able to jump to index 5, another to 6, etc.

Graph- and conflict-based backjumping
Some examples here may be useful.

Constraint learning
To do:


 * deep and shallow learning
 * learning may make randomized backtracking-based algorithms complete.
 * other kinds of learning?

Skipped

 * Inference for Boolean theories (8.4)
 * Identifying row convex relations (8.5.1)
 * Linear inequalities (8.6)
 * Hybrid for propositional theories (10.2.2)

Missing

 * Bucket elimination for constraint optimization: hard constraints (pg. 365)
 * Violated constraints close to cutset (pg. 203)
 * is there only oneĞ possible division of a graph into nonseparable components? check (pg. 287)

Cycle cutset
A cycle cutset is a set of nodes that makes a graph having no cycles. In the case of binary CSPs, if a set of variables forms a cutset of the graph, then every partial evaluation of these variables make the resulting instance being a tree, and therefore solvable in polynomial time. As a result, if a csp has a cycle cutset of size k, it can be solved in time exponential in k only (something like a.b^k).

An algorithm for solving the problem on the resulting tree is based on collecting the minimal "cost" of each variable evaluation in terms of the number of violated constraints. In particular, assigned variables can be assigned cost 0 as their value is considered fixed anyway. For all other variables, the cost of one of its values is computed by considering all possible values of the variables joined to it. In particular, the evaluation of the other variable has its cost. To this cost, the fact that the constraint between the two variables may be violated is also considered.

The total cost of the value of a variable is the minimal of all costs obtained by considering the other variables. In other words, if $$x$$ is joined to $$y_1,\ldots,y_n$$, the cost of $$x=a$$ is as follows, where $$Violated(x=a, y_i=b)$$ is 0 or 1 depending on whether the constraint between these two variables is satisfied by the two values or not:


 * $$Cost(x=a) = \sum_{i=1,\ldots,n} \min_{y_i=b} ( Cost(y_i=b) + Violated(x=a, y_i=b) ) $$

The cost of $$x=a$$ is the minimal number of constraints that are violated by extending this assignment to the other variables in the subtree of $$x$$. Computing this value can be done easily because the variables are arranged in a tree.

This algorithm not allows checking the satisfiability of constraints from a given assignment. Indeed, if there exists an assignment to the root that has cost zero, the problem has solution. A similar procedure works for forests.

In case of unsatisfiability, this algorithm produces the number of constraints that can be satisfied by a given assignment. This value can be used by a mixed local search/tree satisfiability algorithm. Such an algorithm can proceed as follows:


 * 1) identify a cycle cutset of the graph of constraint (a set of variables that once removed makes the graph a forest)
 * 2) start from a random assignment of the variables of the cutset
 * 3) iteratively:
 * 4) evaluate the costs of assignments of the variables not in the cutset
 * 5) perform local search on the variables of the cutset

If the result of 3.1 is that all variables have a value with cost 0, then the problem is satisfiable. Otherwise, the costs of variable assignments tell how much the current assignment of the cutset is close to a solution. As a result, this cost can be use to drive local search.