Evolutionary
Computation and Artificial Life
Exercise
2
Roee Zahor 013701362
Itai
Barami 037172632
Date:
Question 1
In this question we tried to maximize the function f(x1,x2) = 21.5 + x1 * sin(4*pi*x1) + x2 * sin(20*pi*x2) over the range -3.0 to 12.1 for x1 and 4.1 to 5.8 for x2.
We made three experiments: fitness-proportionate selection, rank
selection (with beta=1.1) and tournament selection (with k=7).
Experimental results:
For all experiments: population size = 100, number of generation = 300, pc = 0.7, pm = 0.001.
Fitness-proportionate selection

Rank selection (beta=1.1)

Tournament selection (with k=7)

Conclusions:
Question 2
In this question, we tried to create magic squares using a GA. The genome representation we used is an array of n*n numbers in the range [1,n]. Each number in each cell represents this number in the matching cell in the square.
The fitness function is calculated as follows:
Experimental results:
For all experiments: population size = 200, number of generation = 200, pc = 0.7, pm = 0.1.
n=3 (fitness 45 is perfect match)
|
2 |
9 |
4 |
|
7 |
5 |
3 |
|
6 |
1 |
8 |
n=4 (fitness 136 is perfect match)

|
4 |
7 |
13 |
10 |
|
9 |
14 |
8 |
3 |
|
16 |
11 |
1 |
6 |
|
5 |
2 |
12 |
15 |
n=5 (fitness 325 is perfect match)

|
9 |
19 |
11 |
25 |
1 |
|
15 |
13 |
12 |
23 |
2 |
|
10 |
7 |
22 |
6 |
20 |
|
17 |
5 |
16 |
3 |
24 |
|
14 |
21 |
4 |
8 |
18 |
Conclusions:
Question 3
Experimental results (fitness normalized to [0,1]
scale):
For all experiments: population size = 100, number of generation = 200, pc = 0.4, pm = 0.001.
n=10, M=29

n=11, M=36

n=12, M=41

n=13, M=46

n=14, M=52

n=15, M=58

n=16, M=60

Observations:
Conclusions:
Question 4
In this question we chose to implement the TSP problem using a representations similar to the one we used in question 2.
The only difference is the fitness function. The fitness is calculated as 20000 – (total path length).
Experimental results:
We tried to run the experiments with 3 different parameters sets:
We will display the results from the third series of experiments, which yielded the best results.

The graph shows the fitness of the three best runs, and the average fitness of all 10 runs.
Best path found:
|
Leg # |
From |
To |
Leg distance |
Accumulated distance |
|
1 |
Venezia |
|
157 |
157 |
|
2 |
|
|
290 |
447 |
|
3 |
|
|
295 |
742 |
|
4 |
|
Milano |
210 |
952 |
|
5 |
Milano |
|
138 |
1090 |
|
6 |
|
Aosta |
110 |
1200 |
|
7 |
Aosta |
Genova |
245 |
1445 |
|
8 |
Genova |
|
225 |
1670 |
|
9 |
|
|
262 |
1932 |
|
10 |
|
|
139 |
2071 |
|
11 |
|
Roma |
192 |
2263 |
|
12 |
Roma |
L'Acquila |
113 |
2376 |
|
13 |
L'Acquila |
Campo Basso |
199 |
2575 |
|
14 |
Campo Basso |
|
160 |
2735 |
|
15 |
|
|
158 |
2893 |
|
16 |
|
|
668 |
3561 |
|
17 |
|
Catan zaro |
383 |
3944 |
|
18 |
Catan zaro |
|
362 |
4306 |
|
19 |
|
Venezia |
818 |
5124 |
Conclusions: