This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
AICup/execute.md

2.0 KiB

Instructions for execution

Requirements

In order to reproduce the results reported in the Excel table, one must have the following requirements:

  • A Python 3 interpreter and all Python dependencies required for the AI2020BsC repository installed, namely time, matplotlib and numpy;
  • A working C++11 or greater compiler accessible from the c++ command (Modern versions of clang and g++ are both acceptable compilers).

Execution

cd in the code directory and execute python3 ./run.py all from the terminal. The script will automatically compile the C++ companion program and start the TSP computation for each problem.

Results will be saved in <problemname>.sol files where <problemname> is respectively the name of the problem solved.

Execution time for each problem will be computed using the same criteria used for the original AI2020BsC repository. Times and lengths found will be saved in a file named results.csv which will be located in the same directory as run.py.

Should it be necessary to run the TSP algorithm problem by problem (e.g. if the execution time must be measured by an external program, execute first the command:

c++ -O2 -lpthread --std=c++11 -o c_prob/aco aco.cc opt.cc

Then execute python3 run.py <problem name> where <problem name> is the problem name without extension (e.g. rat783)

The c++ may not be repeated when running multiple problems in a one-by-one fashion.

.sol file contents

Solution files are made up of just one line, containing a valid Python expression representing an array. The array in question contains the order in which cities must be visited, representing each city by its number. The array starts and ends with the starting city of the tour.

Here is the Backus Naur grammar for .sol files:

<.sol file> ::= <city array> '\n'
<city array> ::= '[' <start city> ", " <cities> <start city> ']'
<cities> ::= <city> ", " <cities> | <city> ", " 
<start city> ::= unsigned integer
<city> ::= unsigned integer