Home - Kelleth/pyage-aco-solver GitHub Wiki

Requirements

  • Python 2.7.X
  • NumPy
  • Gnuplot

Usage

Running TSP solver

Usage: python -m aco_solver.runner.parallel_runner [options] number_of_ants iterations city_dataset

Options:

  • -t - population type (default 'cs')
  • 'ca' - Classic Ant Population
  • 'cs' - Control Sample Population
  • 'ha' - High Altercentricity Condition Population
  • 'la' - Low Altercentricity Condition Population
  • -a - pheromone influence factor (default 3.0)
  • -b - distance influence factor (default 2.0)
  • -r - pheromone evaporation coefficient (0.01)
  • -q - pheromone deposit (default 1.0)
  • -p - allows user to specify how many times simulation should be run with the same parameters, script will run simulation as parallel process

Options defining proportions in parametrized colony sample - their sum must be equal 1.0 (default values give control sample proportions):

  • --egocentric - proportion of egocentric ants in parametrized colony (between 0.0 and 1.0)
  • --altercentric - proportion of altercentric ants in parametrized colony (between 0.0 and 1.0)
  • --goodconflict - proportion of good at conflict handling ants in parametrized colony (between 0.0 and 1.0)
  • --badconflict - proportion of bad at conflict handling ants in parametrized colony (between 0.0 and 1.0)
  • --classic - proportion of classic ants in parametrized colony (between 0.0 and 1.0)

Options for defining probability of random behavior to all ants - only for populations_random_behavior branch:

  • --probability - between 0 and 100 defines % chance of random behavior

Options for defining good at conflict handling factors for each pheromone - only for good_at_conflict_factors branch:

  • --ecPheromoneFactor - factor for egocentric pheromone value (default = 14.0)
  • --acPheromoneFactor - factor for altercentric pheromone value (default = 2.0)
  • --gcPheromoneFactor - factor for good at conflict pheromone value (default = 2.5)
  • --bcPheromoneFactor - factor for bad at conflict pheromone value (default = 0.5)

Other:

  • number_of_ants - population size
  • iterations - number of iterations used in experiment
  • city_dataset- dataset name from 'inputs/examples/' without '.cities' extension

Input

Input file contains only cities coordinates in float format:

x0 y0
x1 y1
x2 y2
...

Which means that coordinates of city with id = 0 are (x0, y0) etc.

Example inputs

  • TSPLIB examples downloaded from TSPLIB website and converted to format supported by aco-solver. Best-known solutions are placed in file: results
  • Generated examples used for simple performance tests. Additional inputs can be generated with input_generator.py by specifying number of cities and map range.

Output

All output files are stored in 'outputs' directory

  • *_best.dat - file with best path's description found by the population (distance, best iteration, time, fitness inside population) - example
  • *_fitness.dat - same as _best.dat, but fitness is presented in stepped way - example
  • *_avg.dat - file with average values for population (distance, time, fitness inside population) - example
  • *_path.dat - file with coordinates of best found path - example

Generating average summary

Generates average results with standard deviation from parallel_runner's output files, needed by gnuplot.

Usage: python aco_solver/summary/avg_summary_generator.py number_of_ants iterations city_dataset output_directory
  • number_of_ants - population size
  • iterations - number of iterations used in experiment
  • city_dataset- dataset name from 'inputs/examples/' without '.cities' extension
  • output_directory - directory with parallel_runner's output files, summary will be saved to that directory also

Input

Parallel_runner's output files

Output

File with average summary for all computed results for one case - summary for berlin52 10 10