├── .classpath ├── .gitattributes ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── LICENSE ├── README.md ├── bin ├── ACO │ ├── ACO.class │ └── Ant.class ├── DP_TSP.class ├── GA │ ├── Chromosome.class │ └── GA.class ├── Greedy_TSP.class ├── PSO │ ├── PSO.class │ └── SO.class ├── SA.class ├── TabuSearchAlgorithm_TSP.class └── util │ ├── TspProblem.class │ └── TspReader.class ├── resources ├── att48.tsp ├── data.txt ├── eil10.txt ├── eil23.txt ├── eil51.opt.txt ├── eil51.txt └── eil76.tsp ├── result.txt └── src ├── ACO ├── ACO.java └── Ant.java ├── DP_TSP.java ├── GA ├── Chromosome.java └── GA.java ├── Greedy_TSP.java ├── PSO ├── PSO.java └── SO.java ├── SA.java ├── TabuSearchAlgorithm_TSP.java └── util ├── TspProblem.java └── TspReader.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | TSP 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Intgrp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 求解TSP问题的智能算法 2 | 包含:蚁群算法、遗传算法、粒子群算法、模拟退火算法、禁忌搜索算法、动态规划算法、贪心算法 3 | 采用公开数据集如att48.tsp、eil10.txt、eil23.txt、eil51.txt、eil76.tsp 4 | 可用于相关智能算法的入门学习、带约束路径规划问题解决方法的理解。 5 | -------------------------------------------------------------------------------- /bin/ACO/ACO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/ACO/ACO.class -------------------------------------------------------------------------------- /bin/ACO/Ant.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/ACO/Ant.class -------------------------------------------------------------------------------- /bin/DP_TSP.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/DP_TSP.class -------------------------------------------------------------------------------- /bin/GA/Chromosome.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/GA/Chromosome.class -------------------------------------------------------------------------------- /bin/GA/GA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/GA/GA.class -------------------------------------------------------------------------------- /bin/Greedy_TSP.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/Greedy_TSP.class -------------------------------------------------------------------------------- /bin/PSO/PSO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/PSO/PSO.class -------------------------------------------------------------------------------- /bin/PSO/SO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/PSO/SO.class -------------------------------------------------------------------------------- /bin/SA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/SA.class -------------------------------------------------------------------------------- /bin/TabuSearchAlgorithm_TSP.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/TabuSearchAlgorithm_TSP.class -------------------------------------------------------------------------------- /bin/util/TspProblem.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/util/TspProblem.class -------------------------------------------------------------------------------- /bin/util/TspReader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/bin/util/TspReader.class -------------------------------------------------------------------------------- /resources/att48.tsp: -------------------------------------------------------------------------------- 1 | NAME : att48 2 | COMMENT : 48 capitals of the US (Padberg/Rinaldi) 3 | TYPE : TSP 4 | DIMENSION : 48 5 | EDGE_WEIGHT_TYPE : ATT 6 | NODE_COORD_SECTION 7 | 1 6734 1453 8 | 2 2233 10 9 | 3 5530 1424 10 | 4 401 841 11 | 5 3082 1644 12 | 6 7608 4458 13 | 7 7573 3716 14 | 8 7265 1268 15 | 9 6898 1885 16 | 10 1112 2049 17 | 11 5468 2606 18 | 12 5989 2873 19 | 13 4706 2674 20 | 14 4612 2035 21 | 15 6347 2683 22 | 16 6107 669 23 | 17 7611 5184 24 | 18 7462 3590 25 | 19 7732 4723 26 | 20 5900 3561 27 | 21 4483 3369 28 | 22 6101 1110 29 | 23 5199 2182 30 | 24 1633 2809 31 | 25 4307 2322 32 | 26 675 1006 33 | 27 7555 4819 34 | 28 7541 3981 35 | 29 3177 756 36 | 30 7352 4506 37 | 31 7545 2801 38 | 32 3245 3305 39 | 33 6426 3173 40 | 34 4608 1198 41 | 35 23 2216 42 | 36 7248 3779 43 | 37 7762 4595 44 | 38 7392 2244 45 | 39 3484 2829 46 | 40 6271 2135 47 | 41 4985 140 48 | 42 1916 1569 49 | 43 7280 4899 50 | 44 7509 3239 51 | 45 10 2676 52 | 46 6807 2993 53 | 47 5185 3258 54 | 48 3023 1942 55 | EOF 56 | -------------------------------------------------------------------------------- /resources/data.txt: -------------------------------------------------------------------------------- 1 | 1 6734 1453 2 | 2 2233 10 3 | 3 5530 1424 4 | 4 401 841 5 | 5 3082 1644 6 | 6 7608 4458 7 | 7 7573 3716 8 | 8 7265 1268 9 | 9 6898 1885 10 | 10 1112 2049 11 | 11 5468 2606 12 | 12 5989 2873 13 | 13 4706 2674 14 | 14 4612 2035 15 | 15 6347 2683 16 | 16 6107 669 17 | 17 7611 5184 18 | 18 7462 3590 19 | 19 7732 4723 20 | 20 5900 3561 21 | 21 4483 3369 22 | 22 6101 1110 23 | 23 5199 2182 24 | 24 1633 2809 25 | 25 4307 2322 26 | 26 675 1006 27 | 27 7555 4819 28 | 28 7541 3981 29 | 29 3177 756 30 | 30 7352 4506 -------------------------------------------------------------------------------- /resources/eil10.txt: -------------------------------------------------------------------------------- 1 | NAME : eil51 2 | COMMENT : 51-city problem (Christofides/Eilon) 3 | TYPE : TSP 4 | DIMENSION : 51 5 | EDGE_WEIGHT_TYPE : EUC_2D 6 | NODE_COORD_SECTION 7 | 1 37 52 8 | 2 49 49 9 | 3 52 64 10 | 4 20 26 11 | 5 40 30 12 | 6 21 47 13 | 7 17 63 14 | 8 31 62 15 | 9 52 33 16 | 10 51 21 -------------------------------------------------------------------------------- /resources/eil23.txt: -------------------------------------------------------------------------------- 1 | NAME : eil51 2 | COMMENT : 51-city problem (Christofides/Eilon) 3 | TYPE : TSP 4 | DIMENSION : 51 5 | EDGE_WEIGHT_TYPE : EUC_2D 6 | NODE_COORD_SECTION 7 | 1 37 52 8 | 2 49 49 9 | 3 52 64 10 | 4 20 26 11 | 5 40 30 12 | 6 21 47 13 | 7 17 63 14 | 8 31 62 15 | 9 52 33 16 | 10 51 21 17 | 11 42 41 18 | 12 31 32 19 | 13 5 25 20 | 14 12 42 21 | 15 36 16 22 | 16 52 41 23 | 17 27 23 24 | 18 17 33 25 | 19 13 13 26 | 20 57 58 27 | 21 62 42 28 | 22 42 57 29 | 23 16 57 -------------------------------------------------------------------------------- /resources/eil51.opt.txt: -------------------------------------------------------------------------------- 1 | NAME : eil51.opt.tour 2 | COMMENT : Optimal tour for eil51.tsp (426) 3 | TYPE : TOUR 4 | DIMENSION : 51 5 | TOUR_SECTION 6 | 1 7 | 22 8 | 8 9 | 26 10 | 31 11 | 28 12 | 3 13 | 36 14 | 35 15 | 20 16 | 2 17 | 29 18 | 21 19 | 16 20 | 50 21 | 34 22 | 30 23 | 9 24 | 49 25 | 10 26 | 39 27 | 33 28 | 45 29 | 15 30 | 44 31 | 42 32 | 40 33 | 19 34 | 41 35 | 13 36 | 25 37 | 14 38 | 24 39 | 43 40 | 7 41 | 23 42 | 48 43 | 6 44 | 27 45 | 51 46 | 46 47 | 12 48 | 47 49 | 18 50 | 4 51 | 17 52 | 37 53 | 5 54 | 38 55 | 11 56 | 32 57 | -1 58 | EOF 59 | -------------------------------------------------------------------------------- /resources/eil51.txt: -------------------------------------------------------------------------------- 1 | NAME : eil51 2 | COMMENT : 51-city problem (Christofides/Eilon) 3 | TYPE : TSP 4 | DIMENSION : 51 5 | EDGE_WEIGHT_TYPE : EUC_2D 6 | NODE_COORD_SECTION 7 | 1 37 52 8 | 2 49 49 9 | 3 52 64 10 | 4 20 26 11 | 5 40 30 12 | 6 21 47 13 | 7 17 63 14 | 8 31 62 15 | 9 52 33 16 | 10 51 21 17 | 11 42 41 18 | 12 31 32 19 | 13 5 25 20 | 14 12 42 21 | 15 36 16 22 | 16 52 41 23 | 17 27 23 24 | 18 17 33 25 | 19 13 13 26 | 20 57 58 27 | 21 62 42 28 | 22 42 57 29 | 23 16 57 30 | 24 8 52 31 | 25 7 38 32 | 26 27 68 33 | 27 30 48 34 | 28 43 67 35 | 29 58 48 36 | 30 58 27 37 | 31 37 69 38 | 32 38 46 39 | 33 46 10 40 | 34 61 33 41 | 35 62 63 42 | 36 63 69 43 | 37 32 22 44 | 38 45 35 45 | 39 59 15 46 | 40 5 6 47 | 41 10 17 48 | 42 21 10 49 | 43 5 64 50 | 44 30 15 51 | 45 39 10 52 | 46 32 39 53 | 47 25 32 54 | 48 25 55 55 | 49 48 28 56 | 50 56 37 57 | 51 30 40 58 | EOF 59 | -------------------------------------------------------------------------------- /resources/eil76.tsp: -------------------------------------------------------------------------------- 1 | NAME : eil76 2 | COMMENT : 76-city problem (Christofides/Eilon) 3 | TYPE : TSP 4 | DIMENSION : 76 5 | EDGE_WEIGHT_TYPE : EUC_2D 6 | NODE_COORD_SECTION 7 | 1 22 22 8 | 2 36 26 9 | 3 21 45 10 | 4 45 35 11 | 5 55 20 12 | 6 33 34 13 | 7 50 50 14 | 8 55 45 15 | 9 26 59 16 | 10 40 66 17 | 11 55 65 18 | 12 35 51 19 | 13 62 35 20 | 14 62 57 21 | 15 62 24 22 | 16 21 36 23 | 17 33 44 24 | 18 9 56 25 | 19 62 48 26 | 20 66 14 27 | 21 44 13 28 | 22 26 13 29 | 23 11 28 30 | 24 7 43 31 | 25 17 64 32 | 26 41 46 33 | 27 55 34 34 | 28 35 16 35 | 29 52 26 36 | 30 43 26 37 | 31 31 76 38 | 32 22 53 39 | 33 26 29 40 | 34 50 40 41 | 35 55 50 42 | 36 54 10 43 | 37 60 15 44 | 38 47 66 45 | 39 30 60 46 | 40 30 50 47 | 41 12 17 48 | 42 15 14 49 | 43 16 19 50 | 44 21 48 51 | 45 50 30 52 | 46 51 42 53 | 47 50 15 54 | 48 48 21 55 | 49 12 38 56 | 50 15 56 57 | 51 29 39 58 | 52 54 38 59 | 53 55 57 60 | 54 67 41 61 | 55 10 70 62 | 56 6 25 63 | 57 65 27 64 | 58 40 60 65 | 59 70 64 66 | 60 64 4 67 | 61 36 6 68 | 62 30 20 69 | 63 20 30 70 | 64 15 5 71 | 65 50 70 72 | 66 57 72 73 | 67 45 42 74 | 68 38 33 75 | 69 50 4 76 | 70 66 8 77 | 71 59 5 78 | 72 35 60 79 | 73 27 24 80 | 74 40 20 81 | 75 40 37 82 | 76 40 40 83 | EOF 84 | -------------------------------------------------------------------------------- /result.txt: -------------------------------------------------------------------------------- 1 | 6.051832705113984E-4 2 | 6.08325761766038E-4 3 | 6.119653653720593E-4 4 | 6.071960621799918E-4 5 | 6.024561971490629E-4 6 | 6.064951308556777E-4 7 | 6.071540976298896E-4 8 | 6.156646350412696E-4 9 | 6.092373235666508E-4 10 | 6.060135062567495E-4 11 | 6.024931718333082E-4 12 | 6.054277287640995E-4 13 | 6.092877525069247E-4 14 | 6.073392548071386E-4 15 | 6.026671916068048E-4 16 | 5.857164396294711E-4 17 | 5.855698338417474E-4 18 | 5.888778781035177E-4 19 | 6.108160566208132E-4 20 | 6.024447491961863E-4 21 | 5.980013344866453E-4 22 | 5.939272097970904E-4 23 | 5.986556925673238E-4 24 | 6.020025658746914E-4 25 | 6.036683407701346E-4 26 | 6.066405934950811E-4 27 | 5.934462340562134E-4 28 | 6.069473953520777E-4 29 | 6.144684466242629E-4 30 | 6.041458785851931E-4 31 | 6.128100352978468E-4 32 | 6.045646306088176E-4 33 | 5.89292633068552E-4 34 | 5.858574977852194E-4 35 | 5.878890212723777E-4 36 | 5.789672929422957E-4 37 | 5.777634485364876E-4 38 | 5.841172547978133E-4 39 | 5.938710872512619E-4 40 | 5.791925676066507E-4 41 | 5.821927771936772E-4 42 | 5.907488969023308E-4 43 | 5.837220047481153E-4 44 | 5.941518363471467E-4 45 | 6.108931768536648E-4 46 | 6.085451166551846E-4 47 | 6.044483537012159E-4 48 | 6.064078246954517E-4 49 | 6.077916722672002E-4 50 | 6.142475844918567E-4 51 | 6.139490871492082E-4 52 | 6.147226287988642E-4 53 | 6.116681437371968E-4 54 | 6.111639353081092E-4 55 | 6.111584809860953E-4 56 | 6.015547721278973E-4 57 | 6.050421650461295E-4 58 | 6.168230477663802E-4 59 | 6.124214320183635E-4 60 | 6.28497550358047E-4 61 | 6.402359581961678E-4 62 | 6.404995708448502E-4 63 | 6.40145281154612E-4 64 | 6.268437087353086E-4 65 | 6.234820043009984E-4 66 | 6.194169053815218E-4 67 | 6.171711524378146E-4 68 | 6.10107316695396E-4 69 | 5.946328148188684E-4 70 | 6.024262543033221E-4 71 | 5.896524192478994E-4 72 | 5.894241408600817E-4 73 | 6.035953343853967E-4 74 | 6.177892860144149E-4 75 | 6.18821508250951E-4 76 | 6.104915615238461E-4 77 | 6.048409538814771E-4 78 | 6.055422558358792E-4 79 | 6.037547747795975E-4 80 | 6.001257207692233E-4 81 | 6.066656558329665E-4 82 | 6.087065306506869E-4 83 | 6.186993364650677E-4 84 | 6.149290987842953E-4 85 | 6.25342044202534E-4 86 | 6.122684705169315E-4 87 | 6.290137641517235E-4 88 | 6.330685461252629E-4 89 | 6.322047609244359E-4 90 | 6.271037980309978E-4 91 | 6.319365840799533E-4 92 | 6.087394223736084E-4 93 | 6.187839216029495E-4 94 | 6.286780430343796E-4 95 | 6.443599395193947E-4 96 | 6.425215913147968E-4 97 | 6.234903098664694E-4 98 | 6.122448276465312E-4 99 | 6.157187281057353E-4 100 | 6.282539288248153E-4 101 | -------------------------------------------------------------------------------- /src/ACO/ACO.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/ACO/ACO.java -------------------------------------------------------------------------------- /src/ACO/Ant.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/ACO/Ant.java -------------------------------------------------------------------------------- /src/DP_TSP.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/DP_TSP.java -------------------------------------------------------------------------------- /src/GA/Chromosome.java: -------------------------------------------------------------------------------- 1 | package GA; 2 | 3 | import java.util.Random; 4 | import java.util.Vector; 5 | 6 | public class Chromosome implements Cloneable { 7 | 8 | private int[] tour; 9 | private int[][] distance; 10 | private int cityNum; 11 | private double fitness; 12 | 13 | public Chromosome() { 14 | cityNum = 30; 15 | tour = new int[cityNum]; 16 | distance = new int[cityNum][cityNum]; 17 | } 18 | 19 | public Chromosome(int num, int[][] distance) { 20 | this.cityNum = num; 21 | tour = new int[cityNum]; 22 | this.distance = distance; 23 | 24 | } 25 | 26 | public void randomGeneration() { 27 | Vector allowedCities = new Vector(); 28 | for (int i = 0; i < cityNum; i++) { 29 | allowedCities.add(Integer.valueOf(i)); 30 | } 31 | 32 | Random r = new Random(System.currentTimeMillis()); 33 | for (int i = 0; i < cityNum; i++) { 34 | 35 | int index = r.nextInt(allowedCities.size()); 36 | int selectedCity = allowedCities.get(index).intValue(); 37 | tour[i] = selectedCity; 38 | allowedCities.remove(index); 39 | } 40 | 41 | } 42 | 43 | public void print() { 44 | for (int i = 0; i < cityNum; i++) { 45 | System.out.print(tour[i] + ","); 46 | } 47 | System.out.println(); 48 | System.out.println("Its fitness measure is: " + getFitness()); 49 | } 50 | 51 | private double calculatefitness() { 52 | /* 53 | * for (int i = 0; i < cityNum; i++) { for (int j = 0; j < cityNum; j++) { 54 | * System.out.print(distance[i][j]+"\t"); } System.out.println(); } 55 | */ 56 | double fitness = 0.0; 57 | int len = 0; 58 | for (int i = 0; i < cityNum - 1; i++) { 59 | len += distance[this.tour[i]][this.tour[i + 1]]; 60 | } 61 | len += distance[0][tour[cityNum - 1]]; 62 | fitness = 1.0 / len; 63 | return fitness; 64 | } 65 | 66 | public int[] getTour() { 67 | return tour; 68 | } 69 | 70 | public void setTour(int[] tour) { 71 | this.tour = tour; 72 | } 73 | 74 | public int[][] getDistance() { 75 | return distance; 76 | } 77 | 78 | public void setDistance(int[][] distance) { 79 | this.distance = distance; 80 | } 81 | 82 | public int getCityNum() { 83 | return cityNum; 84 | } 85 | 86 | public void setCityNum(int cityNum) { 87 | this.cityNum = cityNum; 88 | } 89 | 90 | public double getFitness() { 91 | this.fitness = calculatefitness(); 92 | return fitness; 93 | } 94 | 95 | public void setFitness(double fitness) { 96 | this.fitness = fitness; 97 | } 98 | 99 | @Override 100 | protected Object clone() throws CloneNotSupportedException { 101 | Chromosome chromosome = (Chromosome) super.clone(); 102 | chromosome.cityNum = this.cityNum; 103 | chromosome.distance = this.distance.clone(); 104 | chromosome.tour = this.tour.clone(); 105 | chromosome.fitness = this.fitness; 106 | return chromosome; 107 | } 108 | 109 | } -------------------------------------------------------------------------------- /src/GA/GA.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/GA/GA.java -------------------------------------------------------------------------------- /src/Greedy_TSP.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/Greedy_TSP.java -------------------------------------------------------------------------------- /src/PSO/PSO.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/PSO/PSO.java -------------------------------------------------------------------------------- /src/PSO/SO.java: -------------------------------------------------------------------------------- 1 | package PSO; 2 | 3 | 4 | public class SO { 5 | private int x; 6 | private int y; 7 | 8 | public SO(int x,int y){ 9 | this.x=x; 10 | this.y=y; 11 | } 12 | 13 | public int getX() { 14 | return x; 15 | } 16 | 17 | public void setX(int x) { 18 | this.x = x; 19 | } 20 | 21 | public int getY() { 22 | return y; 23 | } 24 | 25 | public void setY(int y) { 26 | this.y = y; 27 | } 28 | 29 | public void print(){ 30 | System.out.println("x:"+this.x+" y:"+this.y); 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/SA.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/SA.java -------------------------------------------------------------------------------- /src/TabuSearchAlgorithm_TSP.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/TabuSearchAlgorithm_TSP.java -------------------------------------------------------------------------------- /src/util/TspProblem.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/util/TspProblem.java -------------------------------------------------------------------------------- /src/util/TspReader.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Intgrp/TSP/b7d632be41c55ebf2b69fb35f17dcbfc1ce04218/src/util/TspReader.java --------------------------------------------------------------------------------