2 CSP AND HEURISTICS
In this section, we introduce the basic concepts of
CSP and further, we detail the most common
heuristics used for this kind of problem.
2.1 Constraint Satisfaction Problems
Roughly speaking, CSP are problems defined by a
set of variables X = {X
1
, X
2
,…, X
n
}, where each one
(X
i
) ranges in a known Domain (D), and a set of
Constraints C = {C
1
, C
2
,…, C
n
} which restricts
specifically one or a group of variables with the
values they can assume. A consistent complete
solution corresponds to a full variable valuation,
which is further in accordance with the constraints
imposed. Along the paper, we refer to the variables
as entities. Figure 1 depicts a pedagogical problem.
Figure 1: A pedagogical Constraint Satisfaction Problem.
In the above figure, the entities are {X
1
, X
2
, X
3
, X
4
,
X
5
, X
6
, X
7
} and each one can assume one of the
following value: D = {r,g,b}, referring to the
colours, red, green, and blue, respectively. The only
constraint imposed restricts the neighbouring places
(that is, each pair of nodes linked by an arc) to have
different colours. As usual, this problem can be
reformulated into a search tree problem, where the
branches represent all the possible paths to a
consistent solution. By definition, each branch not in
accordance with C, must be pruned. The
backtracking algorithm, a special case of depth-first,
is neither complete nor optimal, in case of infinite
branches (Vilain et. al, 1989). As we have not
established an optimal solution to the problem, our
worries rely only upon the completeness of the
algorithm. However, we only take into account
problems in which search does not lead to infinite
branches, and thus, the completeness of the problem
is ensured.
2.2 Search Heuristics
Basically, the backtracking search is used for this
sort of problems. Roughly, in a depth-first manner, a
value from the domain is assigned, and whenever an
inconsistency is detected, the algorithm backtracks
to choose another colour (another resource).
Although simple in conception, the search results are
far to be satisfactory. Further, this algorithm lacks
for not being intelligent, in the sense to re-compute
partial valuations already prove to be consistent. A
blind search, like the backtracking, is improved in
efficiency employing some heuristics. Regarding
CSP, general heuristics (that is, problem-
independent, opposite to domain-specific heuristics,
as the ones in A* search (Dechter & Pearl, 1985))
methods speed up the search while removing some
sources of random choice, as:
Which next unassigned variable should be
taken?
Which next value should be assigned?
The answer for the questions above arises by a
variable and value ordering. The most famous
heuristics are highlighted below. Note that the two
first methods concern the variable choice, and the
later refers to the value ordering:
Most Constrained Variable avoids useless
computations when an assignment will
eventually lead the search to an inconsistent
valuation. The idea is to try first the variables
more prone to error;
When the later method is useless, the Degree
Heuristic serves as a tie-breaker, once it
calculates the degree (number of conflicts) of
each entity;
The Least Constraining-Value, in turn, sorts
decreasingly the values in a domain respecting
how much the value conflicts with the related
entities (that is, the values less shared are tried
first).
As said before, we have restricted our scope of
research to the class of problems similar to the
family of the four color theorem, where the domain
is the same for each variable. In this sense, the LCV
heuristic is pointless since the “level” of
constraining for each value is the same. This
drawback force us to search alternatives for sort the
values of CSP in similar situations, but also
improving the efficiency. However, before to
present the solution, it is worth to explain why we
have used the logic constraint programming CHRv
to carry out the tests.
LSVF: LEAST SUGGESTED VALUE FIRST - A New Search Heuristic to Reduce the Amount of Backtracking Calls in
CSP
417