ecal_ass2

advertisement
1) Problem Description:
Implement a genetic algorithm to solve the TSP problem in known European cities
(while starting and finishing in Amsterdam).
Process of Work:
- Genome representation:
We chose to represent our genomes with a normal path representation, a
permutation of 36 cities (no need for Amsterdam).
- Fitness:
The fitness is an inverse proportional to the distant traveled by the path in the
genome including Amsterdam.
Fitness = 30000 / (30000 + fitness)
30,000 was chosen from the range of minimum 10,072 to the supreme 109,721,
after a lot of experiment 30000 was chosen.
-
Genetic Operators:
o Selection:
We tried to use fitness-proportionate selection with roulette-wheel sampling,
rank selection with a constant of 2.0 and tournament selection with constant 2
with and without reentrant.
And we tried to incorporated an elitism mechanism.
o Cross-Over:
We tried to use two cross-over's. We used order-X cross-over with several X
values raging from 1 to 15, and we tried to use passthrough (clones the
cparents).
o Mutation:
We used a decreasing linear adaptive mutation, increasing exponential mutation
and constant mutation, with rate range (0.9, 0.05).
Running Results (1000 runds):
Result: Amsterdam ,Turin, Strasbourg, Edinburgh, Le Havre, Bern, Rome, Zurich,
Vienna, Nice, Rotterdam, Hamburg, Munich, Venice, Paris, Milan, Berlin, Marseille,
London, Madrid, Genoa, Brussels, Stuttgart, The Hague, Naples, Geneva,
Copenhagen, Lyon, Prague, Lisbon, Cologne, Luxembourg, Frankfurt, Calais, Athens,
Barcelona, Amsterdam. (16481Km)
Result: Amsterdam, Turin, Stuttgart, The Hague, Naples, Geneva, Copenhagen,
Edinburgh, Le Havre, Bern, Rome, Zurich, Barcelona, Vienna, Nice, Rotterdam,
Hamburg, Munich ,Venice, Brussels, Genoa, Madrid, Paris, Milan, Berlin, Marseille,
London, Prague, Lisbon, Cologne, Luxembourg, Frankfurt, Calais, Athens,
Strasbourg, Turin, Antwerp, Amsterdam. (16670Km)
Result: Amsterdam, Copenhagen, Edinburgh, Le Havre, Bern, Rome, Zurich,
Barcelona, Vienna, Rotterdam, Nice, Hamburg, Munich, Venice, Paris, Milan, Berlin,
Marseille, London, Madrid, Genoa, Brussels, Stuttgart, The Hague, Naples, Geneva,
Lyon, Prague, Lisbon, Cologne, Luxembourg, Frankfurt, Calais, Athens, Strasbourg,
Turin, Antwerp, Amsterdam. (16482Km)
Running Results (5000 runds):
Result: Amsterdam, Edinburgh, Le Havre, Bern, Rome, Zurich, Barcelona, Vienna,
Rotterdam, Nice, Hamburg, Munich, Venice, Paris, Milan, Berlin, Marseille, London,
Madrid, Genoa, Brussels, Stuttgart, The Hague, Naples, Geneva, Copenhagen, Lyon,
Cologne, Luxembourg, Frankfurt, Lisbon, Prague, Calais, Athens, Strasbourg
Turin, Antwerp, Amsterdam. (16635Km)
Result: Amsterdam, Luxembourg, Frankfurt, Cologne, Lisbon, Prague, London,
Marseille, Berlin, Milan, Paris, Nice, Rotterdam, Hamburg, Munich, Venice,
Amsterdam, Madrid, Genoa, Brussels, Stuttgart, The Hague, Naples, Vienna,
Barcelona, Zurich, Rome, Bern, Le Havre, Edinburgh, Copenhagen, Geneva, Lyon,
Calais, Athens, Strasbourg, Turin, Antwerp, Amsterdam. (16847Km)
Result: Amsterdam, Luxembourg, Frankfurt, Cologne, Lisbon, Prague, London,
Marseille, Berlin, Milan, Madrid, Genoa, Brussels, Munich, Venice, Paris, Hamburg,
Rotterdam, Nice, Vienna, Barcelona, Zurich, Rome, Naples, The Hague, Stuttgart,
Geneva, Bern, Le Havre, Edinburgh, Copenhagen, Lyon, Calais, Athens, Strasbourg
Turin, Antwerp, Amsterdam. (16843Km)
Best Run: Amsterdam ,Turin, Strasbourg, Edinburgh, Le Havre, Bern, Rome, Zurich,
Vienna, Nice, Rotterdam, Hamburg, Munich, Venice, Paris, Milan, Berlin, Marseille,
London, Madrid, Genoa, Brussels, Stuttgart, The Hague, Naples, Geneva,
Copenhagen, Lyon, Prague, Lisbon, Cologne, Luxembourg, Frankfurt, Calais, Athens,
Barcelona, Amsterdam. (16481Km)
Conclusions:
We tried several combinations of the standard genetic operators before.
The first thing to improve the runnings was changing the fitness to a proportional one.
The second thing that made a big difference was changing the mutation to decreasing
linear adaptive with a big start probability which caused early exploration of the
problem space and increased the probability of higher results. The third thing that
made a difference was changing the order-X cross-over to exchange genome endings
with a probability of 0.25, finally in an effort to improve runnings with long
generation a history mechanism was added which elevates the mutation probability in
prolong unchanging time slots, the history mechanism had negligible effect over long
runnings.
Usage (needs JFreeChart):
3) Problem Description:
Implement a genetic algorithm to solve a the Robby the Robot problem a robot that
needs to peek up canes on a 10x10 board preferable without bumping into walls
and leaving cans on the floor.
Process of Work:
- Genome representation:
We chose to represent our genomes with an array containing an enumeration of
possible action choices. Each element in the genome corresponds to a specific
situation in the vicinity of the robot (there are 3^5 of these).
- Fitness:
The fitness is the proportional average result in conducting several simulation on
boards created on startup time (each board has a distribution of proximally 50%
can occupation). The fitness was offset to prevent negative values.
fitness = average((run-score(i)+MIN_SCORE)/(MAX_SCORE+MIM_SCORE))
-
Genetic Operators:
o Selection:
We tried to use fitness-proportionate selection with roulette-wheel sampling,
rank selection with a constant of 2.0 and tournament selection with constant 2
with and without reentrant.
And we incorporated an elitism mechanism.
o Cross-Over:
We tried to use several crossovers all with rate of 0.7. We used a one point
cross-over with constant length which warps around, We used uniform crossover, we used order-X cross-over and we tried to use passthrough (clones the
cparents).
o Mutation:
We used a linear adaptive mutation rate with the range (0.8, 0.05). There were
two mutation one normal flip mutation and the second a mutation that flips only
to non-negative choices (don't move to a wall when you know there is one).
Running Results (Noticeable runs):
- 482.0 point average (pop=50, gen=2000);
- 469.0 point average (pop=100, gen=1000);
- 464.2 point average (pop=100, gen=1000);
- 420.6 point average (pop=200, gen=500);
- 419.5 point average (pop=200, gen=500);
- 416.3 point average (pop=200, gen=500);
Best Run:
Remark: the result genome is in the file output.txt each score matches a specific
genome
Conclusions:
We tried several combinations of the standard genetic operators before moving on to
specially fitted versions.
The first thing to improve the runnings was changing the fitness to a proportional one
without negative values. The second thing that made a big difference was changing
the mutation to a more constructive one (by not letting it to do thing that were known
to be wrong in every situation). The third thing that made a difference was elitism,
Together with rank selection a very constructive algorithm was constructed which let
us decrease the population size and running session count in exchange for generation
count with better result. In the end we came close to a score of 500 which is the
estimated supermom with the longest run and fewest populations.
Usage (needs JFreeChart):
Download