NAIS: A Calibrated Immune Inspired Algorithm To Solve Binary Constraint Satisfaction Problems
NAIS: A Calibrated Immune Inspired Algorithm To Solve Binary Constraint Satisfaction Problems
NAIS: A Calibrated Immune Inspired Algorithm To Solve Binary Constraint Satisfaction Problems
1 Introduction
Constraint satisfaction problems (CSPs) involve finding values for problem vari-
ables subject to constraints on which combinations are acceptable. Over the
few years, many algorithms and heuristics were developed to find a solution of
CSPs. Following these trends from the constraint research community in the bio-
inspired computation community, some approaches have also been proposed to
tackle CSP with success such that evolutionary algorithms [4], [8], [10], [12], [11],
[14], ants algorithms [13]. Given that recent publications indicate that artificial
immune systems offer advantages in solving complex problems [1], [3], our goal
here is to propose an efficient immune inspired algorithm which can solve CSPs.
Immune artificial systems as well as evolutionary algorithms are very sensitive
to the values of their parameters. Garret in [18] proposed a parameter-free clonal
selection using adaptive changes.
In this paper, we focalize our attention in a new method proposed for tuning,
that is a method that uses statistical properties to determine the best set of
parameter values for an evoltuionary algorithm.
The contributions of this paper are:
?
Supported by Fondecyt Project 1060377
– An immune inspired algorithm which can solve hard CSPs,
– A new application of the tuning method Relevance Estimation and Value
Calibration (REVAC) proposed for evolutionary algorithms, [15],
The paper is structured as follows. In the next section, we define the Con-
straint Satisfaction Problem. In section 3 we introduce our new approach NAIS.
The results of tests and a comparison with other incomplete method are given
in section 4. In our summary, we give some conclusions and future works.
A solution consists of a structural antibody which does not violate any con-
straint, that is, whose conflicting antibody complements the antigen.
Before defining the B-cell we need to introduce the idea of affinity in the context
of our problem.
v
u n
uX
Acsp (Ag, Abc ) = t (Agi − Abci )2 (1)
i=1
The algorithm NAIS is shown in figure 1. NAIS works with a set of B-cells, fol-
lowing an iterative maturation process. Some of these B-cells are selected, doing
a clonal selection, prefering those with bigger affinity values A csp , that is, those
that satisfy a greater number of constraints. It uses a Roulette Wheel selection,
[17]. The algorithm generates a number of clones of the B-cells selected, that is
done by the clonal expansion procedure. These clones follow a hypermutation
process in the affinity maturation step.
The new set of B-cells is composed of a selected set of hypermutated B-cells.
This selection is done in the build network using the HA s values in order to
have a diversity of B-cells. A hypermutated B-cell could belong to the new set of
B-cells if the hypermutated B-cell is quite different from the B-cells in memory.
This difference is measured using the hamming distance, controlling the minimal
degree of required diversity by the parameter value. Thus, a B-cell be accepted
to be a new memory member when (1 − HA n ) > . The value is known as the
s
Hypermutation(B-cell)
Begin
Repeat
V = Select randomly a variable to be changed
If Abc (V ) > 0 then
Repeat
Choose v a new value for V from its domain
N Abc (V ) = Number of conflicts for V using v
If N Abc (V ) < Abc (V ) then
Abs (V ) = v
Re-compute Abc
End If
Until (N Abc (V ) < Abc (V )) or (Max tries)
End If
Until Num hyper
returns(B-cell)
End
4 Tests
The idea of these tests is to study the behavior of the algorithm solving hard
problems. We use two models to generate binary CSPs. That is because GSA
has been reported using model B proposed in [5] and SAW has been reported
using model E, [14].
Model B: The binary CSPs belonging to the hard zone are randomly generated
using the model proposed by B. Smith in [5]. This model considers four param-
eters to obtain a CSP. That is, the number of variables (n), the domain size for
each variable (m), the probability that exists a constraint between two variables
(p1 ), and the probability of compatibility values(p 2 ). This model exactly deter-
mines the number of constraints and the number of consistent instantiations for
the variables that are relevant for a given constraint. Thus, for each set of prob-
lems randomly generated the number of constraints are p1 n(n−1)2 and for a given
constraint the number of consistent instantiations are m 2 p2 . Given (n, m, p1 ) B.
Smith defines a function to compute critical p2 values, those values that allow
to obtain CSPs on the transition phase, that is the problems that are harder to
be solved.
1
http://www-sop.inria.fr/orion/personnel/Marcos.Zuniga/CSPsolver.zip
2
− (n−1)p
p̂2 (n, m, p1 ) = m 1 (2)
crit
Model E: This model also considers four parameters (n, m, p, k). The param-
eters n and m have the same interpretation than in model B. For binary CSPs
whose constraints have two relevant variable k = 2 in model E. The higher p the
more difficult, on average, problem instances will be.
4.2 REVAC
The Relevance Estimation and Value Calibration has recently been proposed in
[15]. The goal of this algorithm is to determine the parameter values for evolu-
tionary algorithms. It is also able to identify which operators are not relevant
for the algorithm. Roughly speaking, REVAC is a steady-state evolutionary al-
gorithm that uses a real-value representation, where each value corresponds to a
parameter value of the algorithm to be tunned. Each chromosome in REVAC is
evaluated by the performance obtained by the algorithm (to be tunned) using its
parameter values. A new individual is randomly created, however the value for
each variable is obtained only considering the values that are in the population
for this variable. It does 1000 evaluations.
In order to apply REVAC for calibrating NAIS, we have selected 14 problems,
two from each category < 10, 10, p1 , p2 > using model B. The performance for
each chromosome is computed as the number of satisfied constraints by the so-
lution obtained by NAIS using these parameter values. The parameter values
found by this tuning procedure were:
– n1 = 0.3, rate of cells to be expanded,
– n2 = 0.4, rate of cells to be incorporated on the memory
– = 0.40, threshold reactivity between clones
– B − cells = 5
– Number of clones = 100
That means that NAIS requires to do more exploration than it does using a
hand-made calibration. In the hand-made calibration the hypermutated cell is
accepted if it differs at least in a 54% ( = 0.46) from the memory cells. Now, it
must differ at least in a 60% to be accepted. Furthermore, the number of cells to
be expanded has been reduced in 0.2. The procedure required around 14 hours,
computational time, to determine these parameter values.
GSA NAIS
Category
50.000 ev. time [s] 10.000 ev. time [s] 50.000 ev. time [s] 75.000 ev. time [s]
c0.3 t0.7 93.33 2.18 87.5 0.68 93.75 1.85 97.5 1.98
c0.5 t0.5 84.4 2.82 91 0.61 98.33 1.08 99.33 0.98
c0.5 t0.7 100 2.76 84 0.61 83.33 2.79 84.33 3.91
c0.7 t0.5 16.7 10.35 87 0.77 87 2.09 90.67 3.34
c0.7 t0.7 100 2.51 80.67 0.66 80.33 2.15 82 4.52
c0.9 t0.5 3.3 13.77 83.67 0.52 86.33 2.15 87.33 4.19
c0.9 t0.7 99.0 1.58 75.33 0.82 75.33 3.92 75.67 6.03
Figure3. Success rate and CPU time for NAIS and GSA
NAIS has a higher satisfaction rate than GSA, moreover it converges very quickly
to good solutions. Furthermore, considering just 10.000 evaluations the average
succes rate for NAIS was around 83% instead of 72% for GSA. However, in some
categories GSA outperforms NAIS.
SAW NAIS
p 100000 ev. 10000 it. 50000 it. 75000 it.
succes time [s] succes time [s] succes time [s] succes time [s]
0.24 100 0.74 100 0.32 100 0.33 100 0.3
0.25 100 2.33 100 0.44 100 0.43 100 0.4
0.26 97 6.83 100 0.56 100 0.6 100 0.61
0.27 60 11.39 100 1.2 100 1.1 100 1
0.28 25 18.66 98.4 2.06 100 2.26 100 2.05
0.29 17 20.57 84 4.11 99.6 5.24 100 5.41
0.3 5 22.27 47.6 6.99 84.4 17.17 90 21.02
0.31 1 22.47 16.8 8.62 38.4 35.1 46.8 48.91
0.32 0 22.39 24 8.22 59.6 27.64 63.6 37.95
0.33 1 22.38 24.4 8.3 59.6 27.4 68.4 34.85
Figure4. Success rate and CPU time for NAIS and SAW
We can observe that NAIS outperforms SAW in both time and success rate.
Moreover, the average success rate for SAW is 40.6% instead of a 69.2% for
NAIS, just considering 10.000 iterations. NAIS required, for these number of
iterations, in average, just 4.1 seconds.
Figure 5 shows the results for NAIS and SAW. We can observe in NAIS the
transition phase in p = 0.31.
80
60
40
20
0
0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34
5 Conclusions
The artificial immune systems have some interesting characteristics from the
computational point of view: pattern recognition, affinity evaluation, immune
networks and diversity. All of these characteristics have been included in our
algorithm. The B-cell structure is useful to determine both the solution of the
problems and also to identify conflicts. The conflicting antibody is used by the
algorithm to guide the reparation of the solutions (hypermutation process), giv-
ing more priority to the variables involved in a higher number of conflicts. For
the problems in the hardest zone NAIS just using 10.000 iterations (avg. 4.1 sec-
onds) solved, on average, 28% more problems than SAW, one of the best known
evolutionary algorithm. The calibrated NAIS solved more problems than GSA,
that is a sophisticated genetic algorithm which incorporated many constraints
concepts to solve CSP. Artificial Immune Systems is a promising technique to
solve constrained combinatorial problems.
6 Future Work