Skip to content

vikbi/Genetic_algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pre Requisites
- python version 3 should be installed on system
- sample input files inst-0.tsp inst-5.tsp and inst-13.tsp should be available

#####################
# compilation steps #
#####################
To run the GA use the following command

>> python TSP_182878.py inst-0.tsp 2 2 1 1

argument1 : (inst-0.tsp) = sample file used for population generation (input data)
argument2 : (2) = selection parameter (1: random selection, 2: stochastic universal sampling)
argument3 : (2) = crossover operator parameter (1: pmx crossover, 2: uniform crossover)
argument4 : (1) = mutation operator parameter (1: inversion mutation, 2: reciprocal mutation)
argument5 : (1) = population generation type (1: random generation, 2: heuristic generation)


configuration settings : following combination of arguments (argument2 to argument5) can be selected 
to generate the expected results as per the configuration settings given in assignments
------------------------------------------------
configuration setting 	| argument combination
------------------------------------------------
       1		| 1 2 1 1
       2		| 1 1 2 1
       3		| 2 2 2 1
       4		| 2 1 2 1
       5		| 2 1 1 1
       6		| 2 2 1 1
       7		| 2 1 2 2
       8		| 2 2 1 2
===============================================

Note : new folder will be generated with the name of input tsp file given 
(ex. here used inst-0.tsp in argument 1 so inst-0 folder will be generated)
all the result files for this input file are stored in above folder
:- result file generted for each configuration setting like result_XXXX.txt where XXXX are the argument (arg2 to arg5) values provided
(ex. here configuration used ..2 2 1 1 so output file is result_2211.txt)
result file will be having following format
> best initial solution and interation 
> respective iteration and fittest value..
> Total iteration and best fitness value
ex.
==================================
Best initial sol: 23008357.3965913
iteration: 0 best: 25019707.014151674
iteration: 8 best: 26884534.37127067
iteration: 36 best: 27663268.05305403
Total iterations: 500 Best: 27663268.05305403
===================================

About

Genetic algorithm for travelling salesman problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages