search and search trees in general. In this case, it may
be sensitive to focus on simple properties like node
indexes, node depth in a search tree, or the number of
decisions taken during search up to a certain node. In
contrast, if one wants to optimize a search heuristics
for a certain problem class, more complex, composed
criteria (as e.g. in Definition 4) might be important.
To allow a definition of criteria as individually and
freely as possible, we decided to define and handle
themselves as CSPs. Such CSP models of criteria are
called filter CSPs or filter models in the following.
A filter model is a CSP F modeled around an orig-
inal CSP P (i.e. the problem CSP) and its search tree.
One the one hand, a filter model F may contain ad-
ditional variables and constraints to enhance the origi-
nal CSP P. This may help to shrink a given problem to
be able to consider partial aspects of P, e.g. consider
P, where a certain variable instantiation is somehow
fixed. On the other hand (and more interestingly), the
filter CSP F describes constraints over the nodes of
the search tree. Thus, the variables of F represent tree
nodes and tree node properties. Accordingly, the do-
main D
n
of such a search node variable n is the set
of all search tree nodes (represented by a unique node
index), the domain D
n,prop
of a property variable of
a tree node is the set of the possible values of such
a property. Finally, constraints of F describe search
node sets and constraints on them.
Definition 6 (filter model). Given a problem CSP P =
(X, D,C). A filter CSP (or filter model) F = (X
P
∪
X
N
, D
P
∪ D
N
,C
F
) consists of
• a set X
P
of variables with finite domains D
P
(to
enhance the original CSP P),
• a set X
N
of variables with finite domains D
N
(to
describe search tree nodes and search tree node
properties)
• a set C
F
of constraints over X
P
∪ X
N
∪ X.
While the set C
F
of constraints may contain fur-
ther model constraints on P (as explained above), it
primarily consists of constraints on search tree nodes.
These constraints are used to specify node sets of a
search tree by specifying desired node properties and
relations between the nodes and node properties.
Example 3. Let the CSP P from Example 1 describ-
ing the 5-queens problem be given. A filter model
F = (X
N
, D
N
,C
F
) with
• X
N
= {n, n
isSolution
},
• D
N
= {D
n
, D
n
isSolution
= B }, where D
n
is the set of
all search tree nodes (represented by unique in-
dexes), and
• C
F
= {n ≤ 30, n
isSolution
= true}
specifies a filter which provides all solutions within
the first 30 search tree nodes visited during backtrack-
ing search.
More complex examples, including the search for
subtrees with restrictions on the domain reduction and
solution density, are given in Section 5.
Since the original problem CSP P is an FD-CSP,
it is ensured that all search trees of P are finite. Thus,
the number of search tree nodes and their concern-
ing properties is finite as well. However, in practice,
we do not know in advance, the concrete nodes of a
proper search tree nor their property values because a
search tree is generated dynamicall during the evalu-
ation of the original problem CSP P. Thus, while we
are able to formulate the needed variables and con-
straints on them for the filter CSP F, we cannot pro-
vide their property values in advance. In this way,
the filter CSP F is initially incomplete. During search
additional constraints for defining the property values
of the nodes must be added to F. This is discussed in
more detail in the following section.
4 FILTER IMPLEMENTATION
The Visual Constraint Solver (VCS) is a tool for the
visualization of FD-CSPs and their evaluation, devel-
oped at BTU Cottbus-Senftenberg in a series of bach-
elor/master theses (Buckenauer, 2019; Reda, 2020;
Bels, 2022). As input, VCS takes MiniZinc programs
which specify CSPs. MiniZinc (Stuckey et al., 2020;
MiniZinc, 2022) is a high-level, solver-independent
constraint modeling language whose constraint mod-
els are compiled via the intermediate language Flat-
Zinc into other constraint programming languages
such as Choco (Choco, 2022). Choco is a Java li-
brary for constraint solving and it is used inside VCS
to solve FD-CSPs.
Filter models (as described in Section 3) are our
new extension of VCS. Observe, that they are just
CSPs on search tree nodes and their properties. Thus,
the main idea of their implementation is to represent
them by constraint models and to handle them by con-
straint solvers. This yields an extended workflow:
Filter models are defined just like problem CSP
models using MiniZinc. They are as well compiled
into a Choco constraint model F
choco
via FlatZinc.
When the original problem CSP P
choco
is solved by
the Choco solver, additional information about the
nodes and node properties is collected and used to ex-
tend the Choco filter model. The resulting enhanced
filter constraint model F+
choco
is again solved by the
Choco solver. Its solutions are used to enhance and
decorate the visualization of the solutions of P
choco
in
ICAART 2023 - 15th International Conference on Agents and Artificial Intelligence
224