File tree 1 file changed +103
-0
lines changed
1 file changed +103
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Traveling salesman problem with genetic algorithm
2
+
3
+
4
+ ## Description
5
+ This code was implemented for the graph discipline the objective is to resolve the traveling salesman problem using a genetic algorithm.
6
+
7
+
8
+ ## Usage
9
+
10
+ To run the code:
11
+
12
+ ```
13
+ pythom3 main.py
14
+ ```
15
+
16
+ ## Settings
17
+ These are the initial settings of the code you can change them according to your specifications.
18
+
19
+ * Population size: 10
20
+ * Probability of mutation: 0.5
21
+ * Crossover: Is defined by function ** mutatedGene** which makes a random change between tho cities.
22
+
23
+ ## Result
24
+ ```
25
+ Current temp: 10000
26
+ Geração 1
27
+ GNOME Valor Fitness
28
+ 0121213651412120 802
29
+ 0121213611452120 773
30
+ 0121123651412120 769
31
+ 0123211651412120 753
32
+ 0121213651412120 802
33
+ 0121213651412120 802
34
+ 0121213651412120 802
35
+ 0151213621412120 752
36
+ 0126213151412120 694
37
+ 0121613251412120 768
38
+
39
+ Current temp: 9000.0
40
+ Geração 2
41
+ GNOME Valor Fitness
42
+ 0126212151412130 667
43
+ 0151213621412120 752
44
+ 0213211651412120 784
45
+ 0121613252412110 676
46
+ 0121143651212120 796
47
+ 0121413611252120 741
48
+ 0121213251416120 768
49
+ 0121213654112120 791
50
+ 0521213611412120 764
51
+ 0123211651412120 753
52
+
53
+ Current temp: 8100.0
54
+ Geração 3
55
+ GNOME Valor Fitness
56
+ 0126212151412130 667
57
+ 0121615232412110 686
58
+ 0121413116252120 683
59
+ 0151213621112420 650
60
+ 0123411651212120 780
61
+ 0421213611512120 773
62
+ 0121213151426120 718
63
+ 0211211653412120 737
64
+ 0121213654111220 681
65
+ 0121143151212620 688
66
+
67
+ Current temp: 7290.0
68
+ Geração 4
69
+ GNOME Valor Fitness
70
+ 0151213621112420 650
71
+ 0126214151212130 667
72
+ 0121211654131220 698
73
+ 0121413116252120 683
74
+ 0121615232112140 734
75
+ 0124113151212620 643
76
+ 0123211151426120 652
77
+ 0511211623412120 710
78
+ 0426213111512120 640
79
+ 0121411651232120 753
80
+
81
+ Current temp: 6561.0
82
+ Geração 5
83
+ GNOME Valor Fitness
84
+ 0421213161512120 790
85
+ 0124113151212620 643
86
+ 0121213621115420 690
87
+ 0122311151426120 575
88
+ 0126214351212110 616
89
+ 0121413216152120 768
90
+ 0621211154131220 648
91
+ 0511211223416120 675
92
+ 0121615232121140 734
93
+ 0121411651232210 645
94
+
95
+ ```
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
You can’t perform that action at this time.
0 commit comments